New API call iso_image_get_ignore_aclea(),

new iso_image_set_ignore_aclea() and iso_file_source_get_aa_string() flag bit3 to import all xattr namespaces
This commit is contained in:
Thomas Schmitt 2017-10-07 16:51:07 +02:00
parent 79baab3fc9
commit 7d45c88cff
6 changed files with 41 additions and 6 deletions

View File

@ -252,7 +252,8 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
/* Obtain ownership of eventual AAIP string */ /* Obtain ownership of eventual AAIP string */
ret = iso_file_source_get_aa_string(src, &aa_string, ret = iso_file_source_get_aa_string(src, &aa_string,
1 | (image->builder_ignore_acl << 1) | 1 | (image->builder_ignore_acl << 1) |
(image->builder_ignore_ea << 2 )); (image->builder_ignore_ea << 2) |
(image->builder_take_all_ea << 3));
if (ret == 1 && aa_string != NULL) { if (ret == 1 && aa_string != NULL) {
ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string); ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string);
if (ret < 0) if (ret < 0)

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2011 Thomas Schmitt * Copyright (c) 2009 - 2017 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -507,7 +507,7 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
*aa_string = NULL; *aa_string = NULL;
if ((flag & 3 ) == 3) { if ((flag & 6 ) == 6) { /* Neither ACL nor xattr shall be read */
ret = 1; ret = 1;
goto ex; goto ex;
} }
@ -521,7 +521,7 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
} }
ret = aaip_get_attr_list(path, &num_attrs, &names, ret = aaip_get_attr_list(path, &num_attrs, &names,
&value_lengths, &values, &value_lengths, &values,
(!(flag & 2)) | 2 | (flag & 4) | 16); (!(flag & 2)) | 2 | (flag & 4) | (flag & 8) | 16);
if (ret <= 0) { if (ret <= 0) {
if (ret == -2) if (ret == -2)
ret = ISO_AAIP_NO_GET_LOCAL; ret = ISO_AAIP_NO_GET_LOCAL;

View File

@ -610,6 +610,15 @@ void iso_image_set_ignore_aclea(IsoImage *image, int what)
{ {
image->builder_ignore_acl = (what & 1); image->builder_ignore_acl = (what & 1);
image->builder_ignore_ea = !!(what & 2); image->builder_ignore_ea = !!(what & 2);
image->builder_take_all_ea = !!(what & 8);
}
int iso_image_get_ignore_aclea(IsoImage *image)
{
return image->builder_ignore_acl |
(image->builder_ignore_ea << 1) |
(image->builder_take_all_ea << 3);
} }

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2016 Thomas Schmitt * Copyright (c) 2009 - 2017 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -145,6 +145,12 @@ struct Iso_Image
*/ */
unsigned int builder_ignore_ea : 1; unsigned int builder_ignore_ea : 1;
/**
* If not builder_ignore_ea : import all xattr namespaces from local
* filesystem, not only "user.
*/
unsigned int builder_take_all_ea : 1;
/** /**
* Files to exclude. Wildcard support is included. * Files to exclude. Wildcard support is included.
*/ */

View File

@ -1280,6 +1280,8 @@ int iso_image_new(const char *name, IsoImage **image);
* A bit field which sets the behavior: * A bit field which sets the behavior:
* bit0= ignore ACLs if the external file object bears some * bit0= ignore ACLs if the external file object bears some
* bit1= ignore xattr if the external file object bears some * bit1= ignore xattr if the external file object bears some
* bit3= if not bit1: import all xattr namespaces, not only "user."
* @since 1.5.0
* all other bits are reserved * all other bits are reserved
* *
* @since 0.6.14 * @since 0.6.14
@ -1287,6 +1289,19 @@ int iso_image_new(const char *name, IsoImage **image);
void iso_image_set_ignore_aclea(IsoImage *image, int what); void iso_image_set_ignore_aclea(IsoImage *image, int what);
/**
* Obtain the current setting of iso_image_set_ignore_aclea().
*
* @param image
* The image to be inquired
* @return
* The currently set value.
*
* @since 1.5.0
*/
int iso_image_get_ignore_aclea(IsoImage *image);
/** /**
* Creates an IsoWriteOpts for writing an image. You should set the options * Creates an IsoWriteOpts for writing an image. You should set the options
* desired with the correspondent setters. * desired with the correspondent setters.
@ -6918,6 +6933,9 @@ int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
* not be able to produce it again. * not be able to produce it again.
* bit1= No need to get ACL (but no guarantee of exclusion) * bit1= No need to get ACL (but no guarantee of exclusion)
* bit2= No need to get xattr (but no guarantee of exclusion) * bit2= No need to get xattr (but no guarantee of exclusion)
* bit3= if not bit2: import all xattr namespaces from
* local filesystem, not only "user."
* @since 1.5.0
* @return 1 means success (*aa_string == NULL is possible) * @return 1 means success (*aa_string == NULL is possible)
* <0 means failure and must b a valid libisofs error code * <0 means failure and must b a valid libisofs error code
* (e.g. ISO_FILE_ERROR if no better one can be found). * (e.g. ISO_FILE_ERROR if no better one can be found).

View File

@ -84,6 +84,7 @@ iso_image_add_new_special;
iso_image_add_new_symlink; iso_image_add_new_symlink;
iso_image_attach_data; iso_image_attach_data;
iso_image_create_burn_source; iso_image_create_burn_source;
iso_image_dir_get_node;
iso_image_filesystem_new; iso_image_filesystem_new;
iso_image_fs_get_abstract_file_id; iso_image_fs_get_abstract_file_id;
iso_image_fs_get_application_id; iso_image_fs_get_application_id;
@ -106,8 +107,8 @@ iso_image_get_bootcat;
iso_image_get_boot_image; iso_image_get_boot_image;
iso_image_get_copyright_file_id; iso_image_get_copyright_file_id;
iso_image_get_data_preparer_id; iso_image_get_data_preparer_id;
iso_image_dir_get_node;
iso_image_get_hppa_palo; iso_image_get_hppa_palo;
iso_image_get_ignore_aclea;
iso_image_get_mips_boot_files; iso_image_get_mips_boot_files;
iso_image_get_msg_id; iso_image_get_msg_id;
iso_image_get_publisher_id; iso_image_get_publisher_id;