Compare commits
23 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
6b31667ee4 | |||
066c6f685d | |||
e317a8d93e | |||
d3c17d0555 | |||
69c8c543a9 | |||
f39d4eefee | |||
848e039e6d | |||
c5a9cc56e3 | |||
310612174b | |||
ad843f1723 | |||
615dc7e997 | |||
a936409a82 | |||
580b154773 | |||
1da3b17233 | |||
633b4d5f72 | |||
4b031b58ea | |||
7d45c88cff | |||
79baab3fc9 | |||
53b2d6dcd7 | |||
874dc16d92 | |||
34e35865fe | |||
ce831f111c | |||
48ee49a7e0 |
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
libisofs-1.5.0.tar.gz Sat Sep 15 2018
|
||||
===============================================================================
|
||||
* 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
|
||||
* New API calls iso_image_was_blind_attrs(), iso_local_set_attrs_errno().
|
||||
* New flag bit7 with iso_local_set_attrs() to avoid unnecessary write attempts.
|
||||
* New return value 2 of IsoFileSource.get_aa_string() and iso_local_get_attrs().
|
||||
* Now putting user defined padding after appended partitions.
|
||||
* Bug fix: Add-on sessions with partition offset claimed too many blocks as
|
||||
size. Regression of version 1.4.8.
|
||||
* Bug fix: Long Joliet names without dot were mangled with one character too
|
||||
many. Long Joliet names with leading dot were mangled one char
|
||||
too short.
|
||||
* Bug fix: Reading beyond array end for HFS+ production caused SIGSEGV with
|
||||
FreeBSD 11 CLANG -O2. Thanks ASX of GhostBSD.
|
||||
|
||||
libisofs-1.4.8.tar.gz Tue Sep 12 2017
|
||||
===============================================================================
|
||||
* Bug fix: iso_read_opts_set_no_rockridge() did not prevent reading of root
|
||||
|
63
configure.ac
63
configure.ac
@ -1,4 +1,4 @@
|
||||
AC_INIT([libisofs], [1.4.8], [http://libburnia-project.org])
|
||||
AC_INIT([libisofs], [1.4.9], [http://libburnia-project.org])
|
||||
AC_PREREQ([2.50])
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
|
||||
@ -41,7 +41,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
|
||||
dnl
|
||||
LIBISOFS_MAJOR_VERSION=1
|
||||
LIBISOFS_MINOR_VERSION=4
|
||||
LIBISOFS_MICRO_VERSION=8
|
||||
LIBISOFS_MICRO_VERSION=9
|
||||
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
|
||||
|
||||
AC_SUBST(LIBISOFS_MAJOR_VERSION)
|
||||
@ -202,19 +202,68 @@ fi
|
||||
AC_SUBST(LIBACL_DEF)
|
||||
|
||||
|
||||
dnl ts A90123 - B51212
|
||||
dnl ts A90123 - B80508
|
||||
AC_ARG_ENABLE(xattr,
|
||||
[ --enable-xattr Enable use of extended file attributes by libisofs, default=yes],
|
||||
, enable_xattr=yes)
|
||||
AC_ARG_ENABLE(xattr_h_pref_attr,
|
||||
[ --enable-xattr-h-pref-attr Prefer include file attr/xattr.h over sys/xattr.h, default=no],
|
||||
, enable_xattr_h_pref_attr=no)
|
||||
|
||||
XATTR_DEF=
|
||||
XATTR_ADDON_DEF=
|
||||
if test x"$LIBBURNIA_SUPP_FATTR" = xxattr
|
||||
then
|
||||
if test "x$enable_xattr" = xyes; then
|
||||
dnl Check whether there is the header for Linux xattr.
|
||||
dnl If not, erase this macro which would enable use of listxattr and others
|
||||
XATTR_DEF="-DLibisofs_with_aaip_xattR"
|
||||
AC_CHECK_HEADER(attr/xattr.h, AC_CHECK_LIB(c, listxattr, X= ,
|
||||
XATTR_DEF= ), XATTR_DEF= )
|
||||
|
||||
XATTR_A_DEF=
|
||||
XATTR_S_DEF=
|
||||
if test x"$enable_xattr_h_pref_attr" = xyes
|
||||
then
|
||||
echo "prefering include file attr/xattr.h over sys/attr.h"
|
||||
XATTR_A_DEF=1
|
||||
AC_CHECK_HEADER(attr/xattr.h, AC_CHECK_LIB(c, listxattr, X= ,
|
||||
XATTR_A_DEF= ), XATTR_A_DEF= )
|
||||
if test x"$XATTR_A_DEF" = x1
|
||||
then
|
||||
XATTR_DEF="-DLibisofs_with_aaip_xattR"
|
||||
else
|
||||
XATTR_S_DEF=1
|
||||
AC_CHECK_HEADER(sys/xattr.h, AC_CHECK_LIB(c, listxattr, X= ,
|
||||
XATTR_S_DEF= ), XATTR_S_DEF= )
|
||||
if test x"$XATTR_S_DEF" = x1
|
||||
then
|
||||
XATTR_DEF="-DLibisofs_with_aaip_xattR"
|
||||
XATTR_ADDON_DEF="-DLibisofs_with_sys_xattR"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
XATTR_S_DEF=1
|
||||
AC_CHECK_HEADER(sys/xattr.h, AC_CHECK_LIB(c, listxattr, X= ,
|
||||
XATTR_S_DEF= ), XATTR_S_DEF= )
|
||||
if test x"$XATTR_S_DEF" = x1
|
||||
then
|
||||
XATTR_DEF="-DLibisofs_with_aaip_xattR"
|
||||
XATTR_ADDON_DEF="-DLibisofs_with_sys_xattR"
|
||||
else
|
||||
XATTR_A_DEF=1
|
||||
AC_CHECK_HEADER(attr/xattr.h, AC_CHECK_LIB(c, listxattr, X= ,
|
||||
XATTR_A_DEF= ), XATTR_A_DEF= )
|
||||
if test x"$XATTR_A_DEF" = x1
|
||||
then
|
||||
XATTR_DEF="-DLibisofs_with_aaip_xattR"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test x"$XATTR_S_DEF" = x1
|
||||
then
|
||||
echo "decided to include file sys/attr.h"
|
||||
elif test x"$XATTR_A_DEF" = x1
|
||||
then
|
||||
echo "decided to include file attr/xattr.h"
|
||||
fi
|
||||
fi
|
||||
elif test x"$LIBBURNIA_SUPP_FATTR" = xextattr
|
||||
then
|
||||
@ -233,6 +282,8 @@ then
|
||||
else
|
||||
echo "disabled local processing of extended file attributes"
|
||||
fi
|
||||
XATTR_DEF="$XATTR_DEF $XATTR_ADDON_DEF"
|
||||
|
||||
AC_SUBST(XATTR_DEF)
|
||||
|
||||
|
||||
|
@ -4,8 +4,9 @@
|
||||
Collection of Boot Sector Formats for ISO 9660 Images
|
||||
|
||||
|
||||
by Thomas Schmitt - mailto:scdbackup@gmx.net
|
||||
Libburnia project - mailto:libburn-hackers@pykix.org
|
||||
by Thomas Schmitt - scdbackup@gmx.net
|
||||
Libburnia project - bug-xorriso@gnu.org
|
||||
pkg-libburnia-devel@lists.alioth.debian.org
|
||||
|
||||
This information is collected from various sources. Some is backed by
|
||||
specifications, some is just rumor which happens to work (maybe not even that).
|
||||
|
@ -99,10 +99,14 @@ int aaip_set_acl_text(char *path, char *text, int flag)
|
||||
-7 support of ACL not enabled at compile time
|
||||
*/
|
||||
int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag)
|
||||
size_t *value_lengths, char **values, int *errnos,
|
||||
int flag)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for(i= 0; i < num_attrs; i++)
|
||||
errnos[i]= 0;
|
||||
|
||||
for(i= 0; i < num_attrs; i++) {
|
||||
if(names[i] == NULL || values[i] == NULL)
|
||||
continue;
|
||||
|
@ -228,6 +228,10 @@ static int aaip_extattr_make_list(char *path, int attrnamespace,
|
||||
*list_size = 0;
|
||||
return(2);
|
||||
}
|
||||
if(errno == EPERM && attrnamespace == EXTATTR_NAMESPACE_SYSTEM) {
|
||||
*list_size = 0;
|
||||
return(3);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
if(*list_size == 0)
|
||||
@ -312,6 +316,54 @@ static int aaip_extattr_make_namelist(char *path, char *attrnamespace,
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
static int get_single_attr(char *path, char *name, size_t *value_length,
|
||||
char **value_bytes, int flag)
|
||||
{
|
||||
char *namept;
|
||||
int attrnamespace;
|
||||
ssize_t value_ret;
|
||||
|
||||
*value_bytes= NULL;
|
||||
*value_length= 0;
|
||||
if(strncmp(name, "user.", 5) == 0) {
|
||||
attrnamespace= EXTATTR_NAMESPACE_USER;
|
||||
namept= name + 5;
|
||||
} else {
|
||||
if(!(flag & 8))
|
||||
return(0);
|
||||
attrnamespace= EXTATTR_NAMESPACE_SYSTEM;
|
||||
namept= name + 7;
|
||||
}
|
||||
/* Predict length of value */
|
||||
if(flag & 32) /* follow link */
|
||||
value_ret= extattr_get_file(path, attrnamespace, namept, NULL, (size_t) 0);
|
||||
else
|
||||
value_ret= extattr_get_link(path, attrnamespace, namept, NULL, (size_t) 0);
|
||||
if(value_ret == -1)
|
||||
return(0);
|
||||
|
||||
*value_bytes= calloc(value_ret + 1, 1);
|
||||
if(*value_bytes == NULL)
|
||||
return(-1);
|
||||
|
||||
/* Obtain value */
|
||||
if(flag & 32) /* follow link */
|
||||
value_ret= extattr_get_file(path, attrnamespace, namept,
|
||||
*value_bytes, (size_t) value_ret);
|
||||
else
|
||||
value_ret= extattr_get_link(path, attrnamespace, namept,
|
||||
*value_bytes, (size_t) value_ret);
|
||||
if(value_ret == -1) {
|
||||
free(*value_bytes);
|
||||
*value_bytes= NULL;
|
||||
*value_length= 0;
|
||||
return(0);
|
||||
}
|
||||
*value_length= value_ret;
|
||||
return(1);
|
||||
}
|
||||
|
||||
#endif /* Libisofs_with_freebsd_extattR */
|
||||
|
||||
|
||||
@ -332,7 +384,8 @@ static int aaip_extattr_make_namelist(char *path, char *attrnamespace,
|
||||
bit4= do not return trivial ACL that matches st_mode
|
||||
bit5= in case of symbolic link: inquire link target
|
||||
bit15= free memory of names, value_lengths, values
|
||||
@return >0 ok
|
||||
@return 1 ok
|
||||
2 ok, no permission to inspect non-user namespaces
|
||||
<=0 error
|
||||
-1= out of memory
|
||||
-2= program error with prediction of result size
|
||||
@ -350,12 +403,12 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
size_t a_acl_len= 0;
|
||||
#endif
|
||||
#ifdef Libisofs_with_freebsd_extattR
|
||||
char *list= NULL, *user_list= NULL, *sys_list= NULL, *namept;
|
||||
ssize_t value_ret, retry= 0, list_size= 0, user_list_size= 0;
|
||||
char *list= NULL, *user_list= NULL, *sys_list= NULL;
|
||||
ssize_t value_ret, list_size= 0, user_list_size= 0;
|
||||
ssize_t sys_list_size= 0;
|
||||
int attrnamespace;
|
||||
int acl_names= 0;
|
||||
#endif
|
||||
int no_perm_for_system= 0;
|
||||
|
||||
if(flag & (1 << 15)) { /* Free memory */
|
||||
{ret= 1; goto ex;}
|
||||
@ -391,6 +444,8 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
&sys_list, &sys_list_size, flag & 32);
|
||||
if(ret <= 0)
|
||||
{ret= -1; goto ex;}
|
||||
if(ret == 3)
|
||||
no_perm_for_system= 1;
|
||||
}
|
||||
|
||||
/* Check for NUL in names, convert into a linuxish list of namespace.name */
|
||||
@ -445,45 +500,10 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
}
|
||||
|
||||
for(i= 0; (size_t) i < *num_attrs; i++) {
|
||||
if(strncmp((*names)[i], "user.", 5) == 0) {
|
||||
attrnamespace= EXTATTR_NAMESPACE_USER;
|
||||
namept= (*names)[i] + 5;
|
||||
} else {
|
||||
if(!(flag & 8))
|
||||
continue;
|
||||
attrnamespace= EXTATTR_NAMESPACE_SYSTEM;
|
||||
namept= (*names)[i] + 7;
|
||||
}
|
||||
/* Predict length of value */
|
||||
if(flag & 32) /* follow link */
|
||||
value_ret= extattr_get_file(path, attrnamespace, namept,
|
||||
NULL, (size_t) 0);
|
||||
else
|
||||
value_ret= extattr_get_link(path, attrnamespace, namept,
|
||||
NULL, (size_t) 0);
|
||||
if(value_ret == -1)
|
||||
continue;
|
||||
|
||||
(*values)[i]= calloc(value_ret + 1, 1);
|
||||
if((*values)[i] == NULL)
|
||||
value_ret= get_single_attr(path, (*names)[i], *value_lengths + i,
|
||||
*values + i, flag & (8 | 32));
|
||||
if(value_ret <= 0)
|
||||
{ret= -1; goto ex;}
|
||||
|
||||
/* Obtain value */
|
||||
if(flag & 32) /* follow link */
|
||||
value_ret= extattr_get_file(path, attrnamespace, namept,
|
||||
(*values)[i], (size_t) value_ret);
|
||||
else
|
||||
value_ret= extattr_get_link(path, attrnamespace, namept,
|
||||
(*values)[i], (size_t) value_ret);
|
||||
if(value_ret == -1) { /* there could be a race condition */
|
||||
|
||||
if(retry++ > 5)
|
||||
{ret= -1; goto ex;}
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
(*value_lengths)[i]= value_ret;
|
||||
retry= 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,8 +514,11 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
if(flag & 1) { /* Obtain ACL */
|
||||
/* access-ACL */
|
||||
aaip_get_acl_text(path, &a_acl_text, flag & (16 | 32));
|
||||
if(a_acl_text == NULL)
|
||||
{ret= 1; goto ex;} /* empty ACL / only st_mode info was found in ACL */
|
||||
if(a_acl_text == NULL) {
|
||||
/* empty ACL / only st_mode info was found in ACL */
|
||||
ret= 1 + no_perm_for_system;
|
||||
goto ex;
|
||||
}
|
||||
ret= aaip_encode_acl(a_acl_text, (mode_t) 0, &a_acl_len, &a_acl, flag & 2);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
@ -514,7 +537,7 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
|
||||
#endif /* Libisofs_with_aaip_acL */
|
||||
|
||||
ret= 1;
|
||||
ret= 1 + no_perm_for_system;
|
||||
ex:;
|
||||
#ifdef Libisofs_with_aaip_acL
|
||||
if(a_acl != NULL)
|
||||
@ -773,6 +796,15 @@ static int aaip_extattr_delete_names(char *path, int attrnamespace,
|
||||
#endif /* Libisofs_with_freebsd_extattR */
|
||||
|
||||
|
||||
static void register_errno(int *errnos, int i, int in_errno)
|
||||
{
|
||||
if(in_errno > 0)
|
||||
errnos[i]= in_errno;
|
||||
else
|
||||
errnos[i]= -1;
|
||||
}
|
||||
|
||||
|
||||
/* Bring the given attributes and/or ACLs into effect with the given file.
|
||||
@param flag Bitfield for control purposes
|
||||
bit0= decode and set ACLs
|
||||
@ -784,6 +816,8 @@ static int aaip_extattr_delete_names(char *path, int attrnamespace,
|
||||
bit5= in case of symbolic link: manipulate link target
|
||||
bit6= tolerate inappropriate presence or absence of
|
||||
directory default ACL
|
||||
bit7= void setting a name value pair if it already
|
||||
exists and has the desired value.
|
||||
@return 1 success
|
||||
-1 error memory allocation
|
||||
-2 error with decoding of ACL
|
||||
@ -796,17 +830,23 @@ static int aaip_extattr_delete_names(char *path, int attrnamespace,
|
||||
ISO_AAIP_ACL_MULT_OBJ multiple entries of user::, group::, other::
|
||||
*/
|
||||
int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag)
|
||||
size_t *value_lengths, char **values,
|
||||
int *errnos, int flag)
|
||||
{
|
||||
int ret, has_default_acl= 0;
|
||||
int ret, has_default_acl= 0, end_ret= 1;
|
||||
size_t i, consumed, acl_text_fill, acl_idx= 0;
|
||||
char *acl_text= NULL;
|
||||
#ifdef Libisofs_with_freebsd_extattR
|
||||
char *user_list= NULL, *sys_list= NULL, *namept;
|
||||
ssize_t user_list_size= 0, sys_list_size= 0;
|
||||
char *user_list= NULL, *sys_list= NULL, *namept, *old_value;
|
||||
ssize_t user_list_size= 0, sys_list_size= 0, value_ret;
|
||||
int attrnamespace;
|
||||
size_t old_value_l;
|
||||
int skip;
|
||||
#endif
|
||||
|
||||
for(i= 0; i < num_attrs; i++)
|
||||
errnos[i]= 0;
|
||||
|
||||
#ifdef Libisofs_with_freebsd_extattR
|
||||
|
||||
if(flag & 2) { /* Delete all file attributes */
|
||||
@ -855,16 +895,35 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
attrnamespace= EXTATTR_NAMESPACE_SYSTEM;
|
||||
namept= names[i] + 7;
|
||||
} else {
|
||||
{ret= -8; goto ex;}
|
||||
register_errno(errnos, i, (int) EFAULT);
|
||||
end_ret= -8;
|
||||
continue;
|
||||
}
|
||||
skip= 0;
|
||||
if(flag & 128) {
|
||||
value_ret= get_single_attr(path, names[i], &old_value_l,
|
||||
&old_value, flag & (8 | 32));
|
||||
if(value_ret > 0 && old_value_l == value_lengths[i]) {
|
||||
if(memcmp(old_value, values[i], value_lengths[i]) == 0)
|
||||
skip= 1;
|
||||
}
|
||||
if(old_value != NULL)
|
||||
free(old_value);
|
||||
}
|
||||
if(!skip) {
|
||||
if(flag & 32)
|
||||
ret= extattr_set_file(path, attrnamespace, namept,
|
||||
values[i], value_lengths[i]);
|
||||
else
|
||||
ret= extattr_set_link(path, attrnamespace, namept,
|
||||
values[i], value_lengths[i]);
|
||||
if(ret == -1) {
|
||||
register_errno(errnos, i, errno);
|
||||
if(end_ret != 1)
|
||||
end_ret= -4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(flag & 32)
|
||||
ret= extattr_set_file(path, attrnamespace, namept,
|
||||
values[i], value_lengths[i]);
|
||||
else
|
||||
ret= extattr_set_link(path, attrnamespace, namept,
|
||||
values[i], value_lengths[i]);
|
||||
if(ret == -1)
|
||||
{ret= -4; goto ex;}
|
||||
|
||||
#else
|
||||
|
||||
@ -879,8 +938,12 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
}
|
||||
|
||||
/* Decode ACLs */
|
||||
/* It is important that this happens after restoring xattr which might be
|
||||
representations of ACL, too. If isofs ACL are enabled, then they shall
|
||||
override the xattr ones.
|
||||
*/
|
||||
if(acl_idx == 0)
|
||||
{ret= 1; goto ex;}
|
||||
{ret= end_ret; goto ex;}
|
||||
i= acl_idx - 1;
|
||||
|
||||
ret= aaip_decode_acl((unsigned char *) values[i], value_lengths[i],
|
||||
@ -902,6 +965,8 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
|
||||
#ifdef Libisofs_with_aaip_acL
|
||||
ret= aaip_set_acl_text(path, acl_text, flag & (32 | 64));
|
||||
if(ret == -1)
|
||||
register_errno(errnos, i, errno);
|
||||
if(ret <= 0)
|
||||
{ret= -3; goto ex;}
|
||||
#else
|
||||
@ -911,7 +976,7 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
if(has_default_acl && !(flag & 64))
|
||||
{ret= -3; goto ex;}
|
||||
|
||||
ret= 1;
|
||||
ret= end_ret;
|
||||
ex:;
|
||||
if(acl_text != NULL)
|
||||
free(acl_text);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
To be included by aaip_0_2.c for Linux
|
||||
|
||||
Copyright (c) 2009 - 2016 Thomas Schmitt, libburnia project, GPLv2+
|
||||
Copyright (c) 2009 - 2018 Thomas Schmitt, libburnia project, GPLv2+
|
||||
|
||||
*/
|
||||
|
||||
@ -30,8 +30,12 @@
|
||||
#endif
|
||||
|
||||
#ifdef Libisofs_with_aaip_xattR
|
||||
#ifdef Libisofs_with_sys_xattR
|
||||
#include <sys/xattr.h>
|
||||
#else
|
||||
#include <attr/xattr.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------ Inquiry --------------------------------- */
|
||||
@ -159,6 +163,41 @@ int aaip_get_acl_text(char *path, char **text, int flag)
|
||||
}
|
||||
|
||||
|
||||
#ifdef Libisofs_with_aaip_xattR
|
||||
|
||||
static int get_single_attr(char *path, char *name, size_t *value_length,
|
||||
char **value_bytes, int flag)
|
||||
{
|
||||
ssize_t value_ret;
|
||||
|
||||
*value_bytes= NULL;
|
||||
*value_length= 0;
|
||||
if(flag & 32)
|
||||
value_ret= getxattr(path, name, NULL, 0);
|
||||
else
|
||||
value_ret= lgetxattr(path, name, NULL, 0);
|
||||
if(value_ret == -1)
|
||||
return(0);
|
||||
*value_bytes= calloc(value_ret + 1, 1);
|
||||
if(*value_bytes == NULL)
|
||||
return(-1);
|
||||
if(flag & 32)
|
||||
value_ret= getxattr(path, name, *value_bytes, value_ret);
|
||||
else
|
||||
value_ret= lgetxattr(path, name, *value_bytes, value_ret);
|
||||
if(value_ret == -1) {
|
||||
free(*value_bytes);
|
||||
*value_bytes= NULL;
|
||||
*value_length= 0;
|
||||
return(0);
|
||||
}
|
||||
*value_length= value_ret;
|
||||
return(1);
|
||||
}
|
||||
|
||||
#endif /* Libisofs_with_aaip_xattR */
|
||||
|
||||
|
||||
/* Obtain the Extended Attributes and/or the ACLs of the given file in a form
|
||||
that is ready for aaip_encode().
|
||||
@param path Path to the file
|
||||
@ -176,7 +215,9 @@ int aaip_get_acl_text(char *path, char **text, int flag)
|
||||
bit4= do not return trivial ACL that matches st_mode
|
||||
bit5= in case of symbolic link: inquire link target
|
||||
bit15= free memory of names, value_lengths, values
|
||||
@return >0 ok
|
||||
@return 1 ok
|
||||
(reserved for FreeBSD: 2 ok, no permission to inspect
|
||||
non-user namespaces.)
|
||||
<=0 error
|
||||
-1= out of memory
|
||||
-2= program error with prediction of result size
|
||||
@ -195,7 +236,7 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
#endif
|
||||
#ifdef Libisofs_with_aaip_xattR
|
||||
char *list= NULL;
|
||||
ssize_t value_ret, retry= 0, list_size= 0;
|
||||
ssize_t value_ret, list_size= 0;
|
||||
#define Libisofs_aaip_get_attr_activE yes
|
||||
#endif
|
||||
#ifdef Libisofs_aaip_get_attr_activE
|
||||
@ -288,27 +329,10 @@ ex:;
|
||||
if(!(flag & 8))
|
||||
if(strncmp((*names)[i], "user.", 5))
|
||||
continue;
|
||||
if(flag & 32)
|
||||
value_ret= getxattr(path, (*names)[i], NULL, 0);
|
||||
else
|
||||
value_ret= lgetxattr(path, (*names)[i], NULL, 0);
|
||||
if(value_ret == -1)
|
||||
continue;
|
||||
(*values)[i]= calloc(value_ret + 1, 1);
|
||||
if((*values)[i] == NULL)
|
||||
value_ret= get_single_attr(path, (*names)[i], *value_lengths + i,
|
||||
*values + i, flag & 32);
|
||||
if(value_ret <= 0)
|
||||
{ret= -1; goto ex;}
|
||||
if(flag & 32)
|
||||
value_ret= getxattr(path, (*names)[i], (*values)[i], value_ret);
|
||||
else
|
||||
value_ret= lgetxattr(path, (*names)[i], (*values)[i], value_ret);
|
||||
if(value_ret == -1) { /* there could be a race condition */
|
||||
if(retry++ > 5)
|
||||
{ret= -1; goto ex;}
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
(*value_lengths)[i]= value_ret;
|
||||
retry= 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,6 +458,15 @@ ex:
|
||||
}
|
||||
|
||||
|
||||
static void register_errno(int *errnos, int i)
|
||||
{
|
||||
if(errno > 0)
|
||||
errnos[i]= errno;
|
||||
else
|
||||
errnos[i]= -1;
|
||||
}
|
||||
|
||||
|
||||
/* Bring the given attributes and/or ACLs into effect with the given file.
|
||||
@param flag Bitfield for control purposes
|
||||
bit0= decode and set ACLs
|
||||
@ -445,6 +478,8 @@ ex:
|
||||
bit5= in case of symbolic link: manipulate link target
|
||||
bit6= tolerate inappropriate presence or absence of
|
||||
directory default ACL
|
||||
bit7= avoid setting a name value pair if it already
|
||||
exists and has the desired value.
|
||||
@return 1 success
|
||||
-1 error memory allocation
|
||||
-2 error with decoding of ACL
|
||||
@ -457,20 +492,25 @@ ex:
|
||||
ISO_AAIP_ACL_MULT_OBJ multiple entries of user::, group::, other::
|
||||
*/
|
||||
int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag)
|
||||
size_t *value_lengths, char **values,
|
||||
int *errnos, int flag)
|
||||
{
|
||||
int ret;
|
||||
int ret, end_ret= 1;
|
||||
size_t i, consumed, acl_text_fill, acl_idx= 0;
|
||||
char *acl_text= NULL;
|
||||
#ifdef Libisofs_with_aaip_xattR
|
||||
char *list= NULL;
|
||||
ssize_t list_size= 0;
|
||||
char *list= NULL, *old_value;
|
||||
ssize_t list_size= 0, value_ret;
|
||||
size_t old_value_l;
|
||||
int skip;
|
||||
#endif
|
||||
#ifdef Libisofs_with_aaip_acL
|
||||
size_t h_consumed;
|
||||
int has_default_acl= 0;
|
||||
#endif
|
||||
|
||||
for(i= 0; i < num_attrs; i++)
|
||||
errnos[i]= 0;
|
||||
|
||||
#ifdef Libisofs_with_aaip_xattR
|
||||
|
||||
@ -525,12 +565,28 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
|
||||
#ifdef Libisofs_with_aaip_xattR
|
||||
|
||||
if(flag & 32)
|
||||
ret= setxattr(path, names[i], values[i], value_lengths[i], 0);
|
||||
else
|
||||
ret= lsetxattr(path, names[i], values[i], value_lengths[i], 0);
|
||||
if(ret == -1)
|
||||
{ret= -4; goto ex;}
|
||||
skip= 0;
|
||||
if(flag & 128) {
|
||||
value_ret= get_single_attr(path, names[i], &old_value_l,
|
||||
&old_value, flag & 32);
|
||||
if(value_ret > 0 && old_value_l == value_lengths[i]) {
|
||||
if(memcmp(old_value, values[i], value_lengths[i]) == 0)
|
||||
skip= 1;
|
||||
}
|
||||
if(old_value != NULL)
|
||||
free(old_value);
|
||||
}
|
||||
if(!skip) {
|
||||
if(flag & 32)
|
||||
ret= setxattr(path, names[i], values[i], value_lengths[i], 0);
|
||||
else
|
||||
ret= lsetxattr(path, names[i], values[i], value_lengths[i], 0);
|
||||
if(ret == -1) {
|
||||
register_errno(errnos, i);
|
||||
end_ret= -4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@ -540,9 +596,13 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
|
||||
}
|
||||
|
||||
/* Decode ACLs */
|
||||
/* Decode ACLs */
|
||||
/* It is important that this happens after restoring xattr which might be
|
||||
representations of ACL, too. If isofs ACL are enabled, then they shall
|
||||
override the xattr ones.
|
||||
*/
|
||||
if(acl_idx == 0)
|
||||
{ret= 1; goto ex;}
|
||||
{ret= end_ret; goto ex;}
|
||||
i= acl_idx - 1;
|
||||
/* "access" ACL */
|
||||
ret= aaip_decode_acl((unsigned char *) values[i], value_lengths[i],
|
||||
@ -566,6 +626,8 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
has_default_acl= (ret == 2);
|
||||
|
||||
ret= aaip_set_acl_text(path, acl_text, flag & 32);
|
||||
if(ret == -1)
|
||||
register_errno(errnos, i);
|
||||
if(ret <= 0)
|
||||
{ret= -3; goto ex;}
|
||||
/* "default" ACL */
|
||||
@ -590,6 +652,8 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
if(ret <= 0)
|
||||
{ret= -2; goto ex;}
|
||||
ret= aaip_set_acl_text(path, acl_text, 1 | (flag & 32));
|
||||
if(ret == -1)
|
||||
register_errno(errnos, i);
|
||||
if(ret <= 0)
|
||||
{ret= -3; goto ex;}
|
||||
} else {
|
||||
@ -601,7 +665,7 @@ int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
|
||||
}
|
||||
}
|
||||
ret= 1;
|
||||
ret= end_ret;
|
||||
|
||||
#else
|
||||
|
||||
|
@ -2188,6 +2188,11 @@ ex:;
|
||||
/* ----------------------- Adapter for operating systems ----------------- */
|
||||
|
||||
|
||||
#ifdef Libisofs_use_os_dummY
|
||||
|
||||
#include "aaip-os-dummy.c"
|
||||
|
||||
#else
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#include "aaip-os-freebsd.c"
|
||||
@ -2239,4 +2244,5 @@ ex:;
|
||||
#endif /* ! __NetBSD__ */
|
||||
#endif /* ! __FreeBSD_kernel__ */
|
||||
#endif /* ! __FreeBSD__ */
|
||||
#endif /* ! Libisofs_use_os_dummY */
|
||||
|
||||
|
@ -507,7 +507,8 @@ int aaip_set_acl_text(char *path, char *text, int flag);
|
||||
ISO_AAIP_ACL_MULT_OBJ multiple entries of user::, group::, other::
|
||||
*/
|
||||
int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag);
|
||||
size_t *value_lengths, char **values,
|
||||
int *errnos, int flag);
|
||||
|
||||
#endif /* ! Aaip_h_is_includeD */
|
||||
|
||||
|
@ -252,8 +252,11 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
||||
/* Obtain ownership of eventual AAIP string */
|
||||
ret = iso_file_source_get_aa_string(src, &aa_string,
|
||||
1 | (image->builder_ignore_acl << 1) |
|
||||
(image->builder_ignore_ea << 2 ));
|
||||
if (ret == 1 && aa_string != NULL) {
|
||||
(image->builder_ignore_ea << 2) |
|
||||
(image->builder_take_all_ea << 3));
|
||||
if(ret == 2)
|
||||
image->blind_on_local_get_attrs = 1;
|
||||
if (ret > 0 && aa_string != NULL) {
|
||||
ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string);
|
||||
if (ret < 0)
|
||||
goto ex;
|
||||
|
@ -198,12 +198,12 @@ and "protective-msdos-label"
|
||||
ChangeLog
|
||||
Updated change log
|
||||
|
||||
[]
|
||||
12 Sep 2017 [dfc6de9]
|
||||
configure.ac
|
||||
libisofs/libisofs.h
|
||||
Version leap to 1.4.8.
|
||||
|
||||
[]
|
||||
12 Sep 2017 [bdfd4c4]
|
||||
libisofs/changelog.txt
|
||||
Updated change log
|
||||
|
||||
@ -225,10 +225,142 @@ Updated change log
|
||||
* New API call iso_write_opts_set_iso_mbr_part_type().
|
||||
|
||||
|
||||
[]
|
||||
12 Sep 2017 [48ee49a]
|
||||
configure.ac
|
||||
libisofs/libisofs.h
|
||||
Version leap to 1.4.9
|
||||
|
||||
12 Sep 2017 [ce831f1]
|
||||
ChangeLog
|
||||
libisofs/changelog.txt
|
||||
Updated change log
|
||||
|
||||
------------------------------------ release - libisofs-1.5.0 -
|
||||
15 Sep 2017 [34e3586]
|
||||
libisofs/node.c
|
||||
Silenced harmless compiler warning -Wimplicit-fallthrough
|
||||
|
||||
16 Sep 2017 [874dc16]
|
||||
libisofs/hfsplus.c
|
||||
Fixed a message typo found by lintian
|
||||
|
||||
22 Sep 2017 [53b2d6d]
|
||||
libisofs/hfsplus_classes.c
|
||||
Bug fix: Reading beyond array end for HFS+ production caused SIGSEGV with
|
||||
FreeBSD 11 CLANG -O2. Thanks ASX of GhostBSD.
|
||||
|
||||
22 Sep 2017 [79baab3]
|
||||
libisofs/hfsplus_classes.c
|
||||
Fixed a harmless lapse with static array initialization
|
||||
|
||||
07 Oct 2017 [7d45c88]
|
||||
libisofs/libisofs.h
|
||||
libisofs/image.h
|
||||
libisofs/image.c
|
||||
libisofs/builder.c
|
||||
libisofs/fs_local.c
|
||||
libisofs/libisofs.ver
|
||||
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
|
||||
|
||||
23 Oct 2017 [4b031b5]
|
||||
libisofs/libisofs.h
|
||||
libisofs/image.h
|
||||
libisofs/image.c
|
||||
libisofs/fs_local.c
|
||||
libisofs/builder.c
|
||||
libisofs/aaip_0_2.h
|
||||
libisofs/aaip_0_2.c
|
||||
libisofs/aaip-os-linux.c
|
||||
libisofs/aaip-os-freebsd.c
|
||||
libisofs/aaip-os-dummy.c
|
||||
libisofs/libisofs.ver
|
||||
New flag bit7 with iso_local_set_attrs() to avoid unnecessary write attempts.
|
||||
New return value 2 of IsoFileSource.get_aa_string() and iso_local_get_attrs().
|
||||
New API calls iso_image_was_blind_attrs(), iso_local_set_attrs_errno().
|
||||
|
||||
23 Oct 2017 [633b4d5]
|
||||
doc/boot_sectors.txt
|
||||
Updated project mail addresses
|
||||
|
||||
31 Oct 2017 [1da3b17]
|
||||
libisofs/aaip-os-linux.c
|
||||
Changed a comment in Linux OS adapter
|
||||
|
||||
31 Oct 2017 [580b154]
|
||||
libisofs/node.c
|
||||
Adapted iso_node_merge_xattr to handling of all namespaces
|
||||
|
||||
22 Nov 2017 [a936409]
|
||||
libisofs/system_area.c
|
||||
Fixed failure to compile with experimental Libisofs_appended_partitions_inlinE
|
||||
|
||||
30 Mar 2018 [615dc7e]
|
||||
libisofs/ecma119.h
|
||||
libisofs/ecma119.c
|
||||
libisofs/system_area.c
|
||||
Bug fix: Add-on sessions with partition offset claimed too many blocks as size.
|
||||
Regression of version 1.4.8.
|
||||
|
||||
31 Mar 2018 [ad843f1]
|
||||
libisofs/joliet.c
|
||||
Bug fix: Long Joliet names without dot were mangled with one character too many
|
||||
|
||||
31 Mar 2018 [3106121]
|
||||
libisofs/joliet.c
|
||||
Bug fix: Long Joliet names with leading dot were mangled one char too short
|
||||
|
||||
01 May 2018 [c5a9cc5]
|
||||
libisofs/ecma119.h
|
||||
libisofs/ecma119.c
|
||||
libisofs/system_area.c
|
||||
Changed bug fix 615dc7e9978ea0ba1eed7b4b661fe4e9f6f2769e of Mar 30 13:51:21 2018 +0200
|
||||
|
||||
18 May 2018 [848e039]
|
||||
configure.ac
|
||||
libisofs/aaip-os-linux.c
|
||||
Preferring Linux include file sys/xattr.h over attr/attr.h
|
||||
|
||||
04 Jun 2018 [f39d4ee]
|
||||
libisofs/ecma119.h
|
||||
libisofs/system_area.h
|
||||
libisofs/ecma119.c
|
||||
libisofs/system_area.c
|
||||
Putting user defined padding after appended partitions
|
||||
|
||||
10 Jun 2018 [69c8c54]
|
||||
libisofs/libisofs.h
|
||||
libisofs/messages.c
|
||||
libisofs/fs_image.c
|
||||
Improved message at image load time about hidden El Torito images for EFI
|
||||
|
||||
15 Sep 2018 [d3c17d0]
|
||||
libisofs/libisofs.h
|
||||
Version leap to 1.5.0.
|
||||
|
||||
15 Sep 2018 [e317a8d]
|
||||
ChangeLog
|
||||
libisofs/changelog.txt
|
||||
Updated change log
|
||||
|
||||
16 Sep 2018 [066c6f6]
|
||||
libisofs/aaip-os-freebsd.c
|
||||
Fixed failure to build on NetBSD because of undeclared variable
|
||||
|
||||
|
||||
------------------------------------ release - libisofs-1.5.0 - 15 Sep 2018
|
||||
* 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
|
||||
* New API calls iso_image_was_blind_attrs(), iso_local_set_attrs_errno().
|
||||
* New flag bit7 with iso_local_set_attrs() to avoid unnecessary write attempts.
|
||||
* New return value 2 of IsoFileSource.get_aa_string() and iso_local_get_attrs().
|
||||
* Now putting user defined padding after appended partitions.
|
||||
* Bug fix: Add-on sessions with partition offset claimed too many blocks as
|
||||
size. Regression of version 1.4.8.
|
||||
* Bug fix: Long Joliet names without dot were mangled with one character too
|
||||
many. Long Joliet names with leading dot were mangled one char
|
||||
too short.
|
||||
* Bug fix: Reading beyond array end for HFS+ production caused SIGSEGV with
|
||||
FreeBSD 11 CLANG -O2. Thanks ASX of GhostBSD.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
* Copyright (c) 2007 Mario Danic
|
||||
* Copyright (c) 2009 - 2017 Thomas Schmitt
|
||||
* Copyright (c) 2009 - 2018 Thomas Schmitt
|
||||
*
|
||||
* 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
|
||||
@ -573,10 +573,8 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
|
||||
vol.vol_desc_version[0] = 1;
|
||||
strncpy_pad((char*)vol.system_id, system_id, 32);
|
||||
strncpy_pad((char*)vol.volume_id, vol_id, 32);
|
||||
if (t->pvd_size_is_total_size) {
|
||||
iso_bb(vol.vol_space_size,
|
||||
t->total_size / 2048 + t->opts->ms_block - t->eff_partition_offset,
|
||||
4);
|
||||
if (t->pvd_size_is_total_size && t->eff_partition_offset <= 0) {
|
||||
iso_bb(vol.vol_space_size, t->total_size / 2048, 4);
|
||||
} else {
|
||||
iso_bb(vol.vol_space_size,
|
||||
t->vol_space_size - t->eff_partition_offset, 4);
|
||||
@ -1190,6 +1188,13 @@ int tail_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
{
|
||||
int ret;
|
||||
Ecma119Image *target;
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
|
||||
target = writer->target;
|
||||
|
||||
#else
|
||||
|
||||
struct iso_zero_writer_data_struct *data;
|
||||
char msg[80];
|
||||
|
||||
@ -1204,21 +1209,57 @@ int tail_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
iso_msgs_submit(0, msg, 0, "NOTE", 0);
|
||||
data->num_blocks = target->opts->tail_blocks;
|
||||
}
|
||||
|
||||
#endif /* ! Libisofs_part_align_writeR */
|
||||
|
||||
if (target->opts->tail_blocks <= 0)
|
||||
return ISO_SUCCESS;
|
||||
ret = zero_writer_compute_data_blocks(writer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
int part_align_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||
{
|
||||
int ret;
|
||||
Ecma119Image *target;
|
||||
struct iso_zero_writer_data_struct *data;
|
||||
char msg[80];
|
||||
|
||||
target = writer->target;
|
||||
|
||||
/* Default setting in case no alignment is needed */
|
||||
target->alignment_end_block = target->curblock;
|
||||
|
||||
ret = iso_align_isohybrid(target, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
data = (struct iso_zero_writer_data_struct *) writer->data;
|
||||
if (target->part_align_blocks != 0) {
|
||||
sprintf(msg, "Aligned image size to cylinder size by %d blocks",
|
||||
target->part_align_blocks);
|
||||
iso_msgs_submit(0, msg, 0, "NOTE", 0);
|
||||
data->num_blocks = target->part_align_blocks;
|
||||
}
|
||||
if (target->part_align_blocks <= 0)
|
||||
return ISO_SUCCESS;
|
||||
ret = zero_writer_compute_data_blocks(writer);
|
||||
target->alignment_end_block = target->curblock;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@param flag bit0= use tail_writer_compute_data_blocks rather than
|
||||
zero_writer_compute_data_blocks
|
||||
@param flag bit0-3= compute_data_blocks mode:
|
||||
0= zero_writer_compute_data_blocks
|
||||
1= tail_writer_compute_data_blocks
|
||||
2= part_align_writer_compute_data_blocks
|
||||
*/
|
||||
static
|
||||
int zero_writer_create(Ecma119Image *target, uint32_t num_blocks, int flag)
|
||||
{
|
||||
IsoImageWriter *writer;
|
||||
struct iso_zero_writer_data_struct *data;
|
||||
int mode;
|
||||
|
||||
writer = malloc(sizeof(IsoImageWriter));
|
||||
if (writer == NULL) {
|
||||
@ -1231,8 +1272,11 @@ int zero_writer_create(Ecma119Image *target, uint32_t num_blocks, int flag)
|
||||
}
|
||||
data->num_blocks = num_blocks;
|
||||
|
||||
if (flag & 1) {
|
||||
mode = (flag & 15);
|
||||
if (mode == 1) {
|
||||
writer->compute_data_blocks = tail_writer_compute_data_blocks;
|
||||
} else if (mode == 2) {
|
||||
writer->compute_data_blocks = part_align_writer_compute_data_blocks;
|
||||
} else {
|
||||
writer->compute_data_blocks = zero_writer_compute_data_blocks;
|
||||
}
|
||||
@ -2134,7 +2178,7 @@ void *write_function(void *arg)
|
||||
{
|
||||
int res, i;
|
||||
#ifndef Libisofs_appended_partitions_inlinE
|
||||
int first_partition = 1, last_partition = 0, sa_type;
|
||||
int first_partition = 1, last_partition = 0;
|
||||
#endif
|
||||
IsoImageWriter *writer;
|
||||
|
||||
@ -2163,14 +2207,7 @@ void *write_function(void *arg)
|
||||
#ifndef Libisofs_appended_partitions_inlinE
|
||||
|
||||
/* Append partition data */
|
||||
sa_type = (target->system_area_options >> 2) & 0x3f;
|
||||
if (sa_type == 0) { /* MBR */
|
||||
first_partition = 1;
|
||||
last_partition = 4;
|
||||
} else if (sa_type == 3) { /* SUN Disk Label */
|
||||
first_partition = 2;
|
||||
last_partition = 8;
|
||||
}
|
||||
iso_count_appended_partitions(target, &first_partition, &last_partition);
|
||||
for (i = first_partition - 1; i <= last_partition - 1; i++) {
|
||||
if (target->opts->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
@ -2449,6 +2486,12 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
int system_area_options = 0;
|
||||
char *system_area = NULL;
|
||||
int write_count = 0, write_count_mem;
|
||||
uint32_t vol_space_size_mem;
|
||||
off_t total_size_mem;
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
int fap, lap, app_part_count;
|
||||
#endif
|
||||
|
||||
/* 1. Allocate target and attach a copy of in_opts there */
|
||||
target = calloc(1, sizeof(Ecma119Image));
|
||||
@ -2643,6 +2686,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
|
||||
target->wthread_is_running = 0;
|
||||
|
||||
target->part_align_blocks = 0;
|
||||
target->alignment_end_block = 0;
|
||||
target->post_iso_part_pad = 0;
|
||||
target->prep_part_size = 0;
|
||||
target->efi_boot_part_size = 0;
|
||||
@ -2741,6 +2786,12 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
nwriters+= 2;
|
||||
}
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
|
||||
nwriters++; /* part_align_blocks writer */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
|
||||
nwriters++; /* Inline Partition Append Writer */
|
||||
@ -2867,34 +2918,26 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
goto target_cleanup;
|
||||
#endif /* ! Libisofs_gpt_writer_lasT */
|
||||
|
||||
|
||||
/* >>> Should not the checksum writer come before the zero writer ?
|
||||
*/
|
||||
#define Libisofs_checksums_before_paddinG yes
|
||||
#ifndef Libisofs_checksums_before_paddinG
|
||||
|
||||
/* >>> ??? Why is this important ? */
|
||||
/* IMPORTANT: This must be the last writer before the checksum writer */
|
||||
ret = zero_writer_create(target, opts->tail_blocks, 1);
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
|
||||
#endif /* !Libisofs_checksums_before_paddinG */
|
||||
|
||||
if ((opts->md5_file_checksums & 1) || opts->md5_session_checksum) {
|
||||
ret = checksum_writer_create(target);
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
}
|
||||
|
||||
#ifdef Libisofs_checksums_before_paddinG
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
|
||||
/* Alignment padding before appended partitions */
|
||||
ret = zero_writer_create(target, 0, 2);
|
||||
|
||||
#else
|
||||
|
||||
ret = zero_writer_create(target, opts->tail_blocks, 1);
|
||||
|
||||
#endif /* ! Libisofs_part_align_writeR */
|
||||
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
|
||||
#endif /* Libisofs_checksums_before_paddinG */
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
|
||||
ret = partappend_writer_create(target);
|
||||
@ -2903,9 +2946,18 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
|
||||
#endif /* Libisofs_appended_partitions_inlinE */
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
|
||||
ret = zero_writer_create(target, opts->tail_blocks, 0);
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
|
||||
#endif /* Libisofs_part_align_writeR */
|
||||
|
||||
#ifdef Libisofs_gpt_writer_lasT
|
||||
/* This writer shall be the last one in the list, because it protects the
|
||||
image on media which are seen as GPT partitioned.
|
||||
/* This writer shall be the last one in the list of writers of valuable
|
||||
data, because it protects the image on media which are seen as GPT
|
||||
partitioned.
|
||||
In any case it has to come after any writer which might request
|
||||
production of APM or GPT partition entries by its compute_data_blocks()
|
||||
method.
|
||||
@ -2989,13 +3041,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
goto target_cleanup;
|
||||
}
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
|
||||
target->vol_space_size = target->curblock - opts->ms_block;
|
||||
target->total_size = (off_t) target->vol_space_size * BLOCK_SIZE;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
ret = iso_patch_eltoritos(target);
|
||||
@ -3007,12 +3052,24 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
goto target_cleanup;
|
||||
}
|
||||
|
||||
#ifndef Libisofs_appended_partitions_inlinE
|
||||
|
||||
/*
|
||||
* The volume space size is just the size of the last session, in
|
||||
* case of ms images.
|
||||
*/
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
|
||||
app_part_count = iso_count_appended_partitions(target, &fap, &lap);
|
||||
if (app_part_count == 0)
|
||||
target->vol_space_size = target->curblock - opts->ms_block;
|
||||
else
|
||||
target->vol_space_size = target->alignment_end_block - opts->ms_block;
|
||||
|
||||
target->total_size = (off_t) (target->curblock - opts->ms_block) *
|
||||
BLOCK_SIZE;
|
||||
|
||||
#else /* Libisofs_appended_partitions_inlinE */
|
||||
|
||||
target->vol_space_size = target->curblock - opts->ms_block;
|
||||
target->total_size = (off_t) target->vol_space_size * BLOCK_SIZE;
|
||||
|
||||
@ -3049,6 +3106,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
}
|
||||
|
||||
/* check if we need to provide a copy of volume descriptors */
|
||||
vol_space_size_mem = target->vol_space_size;
|
||||
if (opts->overwrite != NULL) {
|
||||
|
||||
/* opts->overwrite must be larger by partion_offset
|
||||
@ -3060,12 +3118,15 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
* In the PVM to be written in the 16th sector of the disc, we
|
||||
* need to specify the full size.
|
||||
*/
|
||||
target->vol_space_size = target->curblock;
|
||||
target->vol_space_size += opts->ms_block;
|
||||
|
||||
/* System area and volume descriptors */
|
||||
target->opts_overwrite = (char *) opts->overwrite;
|
||||
total_size_mem = target->total_size;
|
||||
target->total_size += target->opts->ms_block * BLOCK_SIZE;
|
||||
ret = write_head_part1(target, &write_count, 1 | 2);
|
||||
target->opts_overwrite = NULL;
|
||||
target->total_size = total_size_mem;
|
||||
if (ret < 0)
|
||||
goto target_cleanup;
|
||||
|
||||
@ -3127,10 +3188,11 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
||||
"Error reading overwrite volume descriptors");
|
||||
goto target_cleanup;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* This was possibly altered by above overwrite buffer production */
|
||||
target->vol_space_size = target->curblock - opts->ms_block;
|
||||
target->vol_space_size = vol_space_size_mem;
|
||||
|
||||
/*
|
||||
*/
|
||||
@ -3294,11 +3356,6 @@ int bs_set_size(struct burn_source *bs, off_t size)
|
||||
{
|
||||
Ecma119Image *target = (Ecma119Image*)bs->data;
|
||||
|
||||
/*
|
||||
* just set the value to be returned by get_size. This is not used at
|
||||
* all by libisofs, it is here just for helping libburn to correctly pad
|
||||
* the image if needed.
|
||||
*/
|
||||
target->total_size = size;
|
||||
return 1;
|
||||
}
|
||||
@ -4540,3 +4597,30 @@ ex: /* LIBISO_ALLOC_MEM failed */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Obtains start and end number of appended partition range and returns
|
||||
the number of valid entries in the list of appended partitions.
|
||||
*/
|
||||
int iso_count_appended_partitions(Ecma119Image *target,
|
||||
int *first_partition, int *last_partition)
|
||||
{
|
||||
int sa_type, i, count= 0;
|
||||
|
||||
sa_type = (target->system_area_options >> 2) & 0x3f;
|
||||
if (sa_type == 3) { /* SUN Disk Label */
|
||||
*first_partition = 2;
|
||||
*last_partition = 8;
|
||||
} else {
|
||||
*first_partition = 1;
|
||||
*last_partition = 4;
|
||||
}
|
||||
for (i = *first_partition - 1; i <= *last_partition - 1; i++) {
|
||||
if (target->opts->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
if (target->opts->appended_partitions[i][0] == 0)
|
||||
continue;
|
||||
count++;
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
* Copyright (c) 2009 - 2017 Thomas Schmitt
|
||||
* Copyright (c) 2009 - 2018 Thomas Schmitt
|
||||
*
|
||||
* 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
|
||||
@ -799,6 +799,11 @@ struct ecma119_image
|
||||
*/
|
||||
IsoFileSrc *sparc_core_src;
|
||||
|
||||
/* Trailing padding of ISO filesystem partition for cylinder alignment */
|
||||
/* Only in effect with Libisofs_part_align_writeR */
|
||||
uint32_t part_align_blocks;
|
||||
uint32_t alignment_end_block;
|
||||
|
||||
/* Counted in blocks of 2048 */
|
||||
uint32_t appended_part_prepad[ISO_MAX_PARTITIONS];
|
||||
uint32_t appended_part_start[ISO_MAX_PARTITIONS];
|
||||
@ -1044,6 +1049,10 @@ int iso_interval_reader_start_size(Ecma119Image *t, char *path,
|
||||
off_t *start_byte, off_t *byte_count,
|
||||
int flag);
|
||||
|
||||
|
||||
/* Obtains start and end number of appended partition range and returns
|
||||
the number of valid entries in the list of appended partitions.
|
||||
*/
|
||||
int iso_count_appended_partitions(Ecma119Image *target,
|
||||
int *first_partition, int *last_partition);
|
||||
|
||||
#endif /*LIBISO_ECMA119_H_*/
|
||||
|
@ -5885,6 +5885,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
memcpy(boot_image->id_string, data->id_strings[idx], 28);
|
||||
memcpy(boot_image->selection_crit, data->selection_crits, 20);
|
||||
boot_image->appended_idx = -1;
|
||||
boot_image->appended_start = data->bootblocks[idx];
|
||||
|
||||
catalog->bootimages[catalog->num_bootimages] = boot_image;
|
||||
boot_image = NULL;
|
||||
@ -5956,10 +5957,21 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
||||
|
||||
|
||||
/* warn about hidden images */
|
||||
iso_msg_submit(image->id, ISO_EL_TORITO_HIDDEN, 0,
|
||||
if (image->bootcat->bootimages[idx]->platform_id == 0xef) {
|
||||
iso_msg_submit(image->id, ISO_ELTO_EFI_HIDDEN, 0,
|
||||
"Found hidden El-Torito image for EFI.");
|
||||
iso_msg_submit(image->id, ISO_GENERAL_NOTE, 0,
|
||||
"EFI image start and size: %lu * 2048 , %lu * 512",
|
||||
(unsigned long int)
|
||||
image->bootcat->bootimages[idx]->appended_start,
|
||||
(unsigned long int)
|
||||
image->bootcat->bootimages[idx]->load_size);
|
||||
} else {
|
||||
iso_msg_submit(image->id, ISO_EL_TORITO_HIDDEN, 0,
|
||||
"Found hidden El-Torito image. Its size could not "
|
||||
"be figured out, so image modify or boot image "
|
||||
"patching may lead to bad results.");
|
||||
}
|
||||
}
|
||||
if (image->bootcat->node == NULL) {
|
||||
IsoNode *node;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License version 2
|
||||
@ -499,7 +499,7 @@ void lfs_free(IsoFileSource *src)
|
||||
static
|
||||
int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
|
||||
{
|
||||
int ret;
|
||||
int ret, no_non_user_perm= 0;
|
||||
size_t num_attrs = 0, *value_lengths = NULL, result_len;
|
||||
ssize_t sret;
|
||||
char *path = NULL, **names = NULL, **values = NULL;
|
||||
@ -507,7 +507,7 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
|
||||
|
||||
*aa_string = NULL;
|
||||
|
||||
if ((flag & 3 ) == 3) {
|
||||
if ((flag & 6 ) == 6) { /* Neither ACL nor xattr shall be read */
|
||||
ret = 1;
|
||||
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,
|
||||
&value_lengths, &values,
|
||||
(!(flag & 2)) | 2 | (flag & 4) | 16);
|
||||
(!(flag & 2)) | 2 | (flag & 4) | (flag & 8) | 16);
|
||||
if (ret <= 0) {
|
||||
if (ret == -2)
|
||||
ret = ISO_AAIP_NO_GET_LOCAL;
|
||||
@ -529,6 +529,9 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
|
||||
ret = ISO_FILE_ERROR;
|
||||
goto ex;
|
||||
}
|
||||
if(ret == 2)
|
||||
no_non_user_perm= 1;
|
||||
|
||||
if (num_attrs == 0)
|
||||
result = NULL;
|
||||
else {
|
||||
@ -540,7 +543,7 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
|
||||
}
|
||||
}
|
||||
*aa_string = result;
|
||||
ret = 1;
|
||||
ret = 1 + no_non_user_perm;
|
||||
ex:;
|
||||
if (path != NULL)
|
||||
free(path);
|
||||
@ -867,17 +870,19 @@ int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
|
||||
(flag & (1 | 4 | 8 | 32 | (1 << 15))) | 2 | 16);
|
||||
if (ret <= 0)
|
||||
return ISO_AAIP_NO_GET_LOCAL;
|
||||
return 1;
|
||||
return 1 + (ret == 2);
|
||||
}
|
||||
|
||||
|
||||
int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag)
|
||||
int iso_local_set_attrs_errno(char *disk_path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values,
|
||||
int *errnos, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = aaip_set_attr_list(disk_path, num_attrs, names, value_lengths,
|
||||
values, (flag & (8 | 32 | 64)) | !(flag & 1));
|
||||
values, errnos,
|
||||
(flag & (8 | 32 | 64 | 128)) | !(flag & 1));
|
||||
if (ret <= 0) {
|
||||
if (ret == -1)
|
||||
return ISO_OUT_OF_MEM;
|
||||
@ -895,6 +900,25 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
|
||||
}
|
||||
|
||||
|
||||
int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values, int flag)
|
||||
{
|
||||
int ret;
|
||||
int *errnos = NULL;
|
||||
|
||||
if(num_attrs > 0) {
|
||||
errnos= calloc(num_attrs, sizeof(int));
|
||||
if(errnos == NULL)
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
ret= iso_local_set_attrs_errno(disk_path, num_attrs, names, value_lengths,
|
||||
values, errnos, flag);
|
||||
if(errnos != NULL)
|
||||
free(errnos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag)
|
||||
{
|
||||
struct stat stbuf;
|
||||
|
@ -91,7 +91,7 @@ int filesrc_block_and_size(Ecma119Image *t, IsoFileSrc *src,
|
||||
*total_size += src->sections[i].size;
|
||||
if (pos != src->sections[i].block) {
|
||||
iso_msg_submit(t->image->id, ISO_SECT_SCATTERED, 0,
|
||||
"File sections do not form consequtive array of blocks");
|
||||
"File sections do not form consecutive array of blocks");
|
||||
return ISO_SECT_SCATTERED;
|
||||
}
|
||||
/* If .size is not aligned to blocks then there is a byte gap.
|
||||
|
@ -422,6 +422,10 @@ static uint16_t class_page_data[] = {
|
||||
0x21, 0x230,
|
||||
0x22, 0x230,
|
||||
0x23, 0x230,
|
||||
0x00,
|
||||
|
||||
/* End of list */
|
||||
0x00
|
||||
};
|
||||
|
||||
uint16_t *hfsplus_class_pages[256];
|
||||
@ -434,7 +438,7 @@ void make_hfsplus_class_pages()
|
||||
uint16_t *rpt, *page_pt;
|
||||
int page_count = 0;
|
||||
|
||||
memset(class_pages, 0, 19 * 256);
|
||||
memset(class_pages, 0, 19 * 256 * sizeof(uint16_t));
|
||||
for (i = 0; i < 256; i++)
|
||||
hfsplus_class_pages[i] = NULL;
|
||||
|
||||
|
@ -203,6 +203,7 @@ int iso_image_new(const char *name, IsoImage **image)
|
||||
img->hfsplus_blessed[i] = NULL;
|
||||
img->collision_warnings = 0;
|
||||
img->imported_sa_info = NULL;
|
||||
img->blind_on_local_get_attrs = 0;
|
||||
|
||||
*image = img;
|
||||
return ISO_SUCCESS;
|
||||
@ -610,6 +611,15 @@ void iso_image_set_ignore_aclea(IsoImage *image, int what)
|
||||
{
|
||||
image->builder_ignore_acl = (what & 1);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -1128,3 +1138,15 @@ int iso_image_truncate_name(IsoImage *image, const char *name, char **namept,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* API */
|
||||
int iso_image_was_blind_attrs(IsoImage *image, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = image->blind_on_local_get_attrs;
|
||||
if (flag & 1)
|
||||
image->blind_on_local_get_attrs = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ -241,6 +247,11 @@ struct Iso_Image
|
||||
/* Contains the assessment of boot aspects of the loaded image */
|
||||
struct iso_imported_sys_area *imported_sa_info;
|
||||
|
||||
/* Whether some local filesystem xattr namespace could not be explored
|
||||
* during node building.
|
||||
*/
|
||||
int blind_on_local_get_attrs;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
* Copyright (c) 2007 Mario Danic
|
||||
* Copyright (c) 2011-2014 Thomas Schmitt
|
||||
* Copyright (c) 2011-2018 Thomas Schmitt
|
||||
*
|
||||
* 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
|
||||
@ -401,6 +401,20 @@ int joliet_create_mangled_name(uint16_t *dest, uint16_t *src, int digits,
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* From Joliet specs:
|
||||
* "ISO 9660 (Section 7.5.1) states that the sum of the following shall not
|
||||
* exceed 30:
|
||||
* - If there is a file name, the length of the file name.
|
||||
* - If there is a file name extension, the length of the file name extension.
|
||||
* On Joliet compliant media, however, the sum as calculated above shall not
|
||||
* exceed 128 [bytes], to allow for longer file identifiers."
|
||||
*
|
||||
* I.e. the dot does not count.
|
||||
*
|
||||
* (We have an option to lift the limit from 64*2 to 103*2, which is the
|
||||
* maximum to fit into an ISO 9660 directory record.)
|
||||
*/
|
||||
static
|
||||
int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
{
|
||||
@ -481,25 +495,26 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
ext = dot + 1;
|
||||
|
||||
extlen = ucslen(ext);
|
||||
max = maxchar + 1 - extlen - 1 - digits;
|
||||
max = maxchar - extlen - digits;
|
||||
if (max <= 0) {
|
||||
/* this can happen if extension is too long */
|
||||
if (extlen + max > 3) {
|
||||
/*
|
||||
* This can happen if the extension is too long.
|
||||
* Reduce its length, to give name at least one
|
||||
* original character, if it has any.
|
||||
*/
|
||||
max = (dot > full_name);
|
||||
extlen = maxchar - max - digits;
|
||||
if (extlen < 3) {
|
||||
/*
|
||||
* reduce extension len, to give name an extra char
|
||||
* note that max is negative or 0
|
||||
*/
|
||||
extlen = extlen + max - 1;
|
||||
ext[extlen] = 0;
|
||||
max = maxchar + 2 - extlen - 1 - digits;
|
||||
} else {
|
||||
/*
|
||||
* error, we don't support extensions < 3
|
||||
* This can't happen with current limit of digits.
|
||||
* error, we do not reduce extensions to length < 3
|
||||
*
|
||||
* This cannot happen with current limit of digits
|
||||
* because maxchar is at least 64 and digits at most 7.
|
||||
*/
|
||||
ret = ISO_ERROR;
|
||||
goto mangle_cleanup;
|
||||
}
|
||||
ext[extlen] = 0;
|
||||
}
|
||||
/* ok, reduce name by digits */
|
||||
if (name + max < dot) {
|
||||
@ -508,10 +523,10 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
|
||||
} else {
|
||||
/* Directory, or file without extension */
|
||||
if (children[i]->type == JOLIET_DIR) {
|
||||
max = maxchar + 1 - digits;
|
||||
max = maxchar - digits;
|
||||
dot = NULL; /* dots have no meaning in dirs */
|
||||
} else {
|
||||
max = maxchar + 1 - digits;
|
||||
max = maxchar - digits;
|
||||
}
|
||||
name = full_name;
|
||||
if ((size_t) max < ucslen(name)) {
|
||||
|
@ -93,8 +93,8 @@ extern "C" {
|
||||
* @since 0.6.2
|
||||
*/
|
||||
#define iso_lib_header_version_major 1
|
||||
#define iso_lib_header_version_minor 4
|
||||
#define iso_lib_header_version_micro 8
|
||||
#define iso_lib_header_version_minor 5
|
||||
#define iso_lib_header_version_micro 0
|
||||
|
||||
/**
|
||||
* Get version of the libisofs library at runtime.
|
||||
@ -867,6 +867,10 @@ struct IsoFileSource_Iface
|
||||
* The caller is responsible for finally calling free()
|
||||
* on non-NULL results.
|
||||
* @return 1 means success (*aa_string == NULL is possible)
|
||||
* 2 means success, but it is possible that attributes
|
||||
* exist in non-user namespaces which could not be
|
||||
* explored due to lack of permission.
|
||||
* @since 1.5.0
|
||||
* <0 means failure and must b a valid libisofs error code
|
||||
* (e.g. ISO_FILE_ERROR if no better one can be found).
|
||||
* @since 0.6.14
|
||||
@ -1280,6 +1284,8 @@ int iso_image_new(const char *name, IsoImage **image);
|
||||
* A bit field which sets the behavior:
|
||||
* bit0= ignore ACLs 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
|
||||
*
|
||||
* @since 0.6.14
|
||||
@ -1287,6 +1293,19 @@ int iso_image_new(const char *name, IsoImage **image);
|
||||
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
|
||||
* desired with the correspondent setters.
|
||||
@ -6342,6 +6361,28 @@ int iso_tree_clone(IsoNode *node,
|
||||
*/
|
||||
int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
|
||||
|
||||
/**
|
||||
* Inquire whether some local filesystem xattr namespace could not be explored
|
||||
* during node building. This may happen due to lack of adminstrator privileges
|
||||
* e.g. on FreeBSD namespace "system".
|
||||
* It may well be that the processed local files have no attributes which
|
||||
* would require special privileges. But already their existence was neither
|
||||
* denied nor confirmed.
|
||||
*
|
||||
* @param image
|
||||
* The image to inquire.
|
||||
* @param flag
|
||||
* Bitfield for control purposes:
|
||||
* bit0 = reset internal value to 0
|
||||
* @return
|
||||
* 1 = Exploration was prevented
|
||||
* 0 = No such prevention occured
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
int iso_image_was_blind_attrs(IsoImage *image, int flag);
|
||||
|
||||
|
||||
/**
|
||||
* Locate a node by its absolute path in the image.
|
||||
* The IsoImage context defines a maximum permissible name length and a mode
|
||||
@ -6918,6 +6959,9 @@ int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
|
||||
* not be able to produce it again.
|
||||
* bit1= No need to get ACL (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)
|
||||
* <0 means failure and must b a valid libisofs error code
|
||||
* (e.g. ISO_FILE_ERROR if no better one can be found).
|
||||
@ -7567,6 +7611,9 @@ int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag);
|
||||
* bit15= free memory
|
||||
* @return
|
||||
* 1 ok
|
||||
* 2 ok, but it is possible that attributes exist in non-user namespaces
|
||||
* which could not be explored due to lack of permission.
|
||||
* @since 1.5.0
|
||||
* < 0 failure
|
||||
*
|
||||
* @since 0.6.14
|
||||
@ -7590,6 +7637,11 @@ int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
|
||||
* Array of byte lengths for each attribute payload
|
||||
* @param values
|
||||
* Array of pointers to the attribute payload bytes
|
||||
* @param errnos
|
||||
* Array of integers to return error numbers if encountered at the attempt
|
||||
* to process the name-value pair at the given array index number:
|
||||
* 0 = no error , -1 = unknown error
|
||||
* >0 = errno as of local system calls to set xattr and ACLs
|
||||
* @param flag
|
||||
* Bitfield for control purposes
|
||||
* bit0= do not attach ACLs from an eventual attribute with empty name
|
||||
@ -7597,12 +7649,24 @@ int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
|
||||
* I.e. those with a name which does not begin by "user."
|
||||
* bit5= in case of symbolic link: manipulate link target
|
||||
* bit6= @since 1.1.6
|
||||
tolerate inappropriate presence or absence of
|
||||
* tolerate inappropriate presence or absence of
|
||||
* directory "default" ACL
|
||||
* bit7= @since 1.5.0
|
||||
* avoid setting a name value pair if it already exists and
|
||||
* has the desired value.
|
||||
* @return
|
||||
* 1 = ok
|
||||
* < 0 = error
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
int iso_local_set_attrs_errno(char *disk_path, size_t num_attrs, char **names,
|
||||
size_t *value_lengths, char **values,
|
||||
int *errnos, int flag);
|
||||
/**
|
||||
* Older version of iso_local_set_attrs_errno() without the errnos array.
|
||||
* All other parameters and the return value have the same meaning.
|
||||
*
|
||||
* @since 0.6.14
|
||||
*/
|
||||
int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
|
||||
@ -8891,6 +8955,9 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
|
||||
(FAILURE, HIGH, -420) */
|
||||
#define ISO_MULTI_OVER_IMPORTED 0xE830FE5C
|
||||
|
||||
/** El-Torito EFI image is hidden (NOTE,HIGH, -421) */
|
||||
#define ISO_ELTO_EFI_HIDDEN 0xB030FE5B
|
||||
|
||||
|
||||
/* Internal developer note:
|
||||
Place new error codes directly above this comment.
|
||||
|
@ -84,6 +84,7 @@ iso_image_add_new_special;
|
||||
iso_image_add_new_symlink;
|
||||
iso_image_attach_data;
|
||||
iso_image_create_burn_source;
|
||||
iso_image_dir_get_node;
|
||||
iso_image_filesystem_new;
|
||||
iso_image_fs_get_abstract_file_id;
|
||||
iso_image_fs_get_application_id;
|
||||
@ -106,8 +107,8 @@ iso_image_get_bootcat;
|
||||
iso_image_get_boot_image;
|
||||
iso_image_get_copyright_file_id;
|
||||
iso_image_get_data_preparer_id;
|
||||
iso_image_dir_get_node;
|
||||
iso_image_get_hppa_palo;
|
||||
iso_image_get_ignore_aclea;
|
||||
iso_image_get_mips_boot_files;
|
||||
iso_image_get_msg_id;
|
||||
iso_image_get_publisher_id;
|
||||
@ -152,6 +153,7 @@ iso_image_set_volume_id;
|
||||
iso_image_tree_clone;
|
||||
iso_image_unref;
|
||||
iso_image_update_sizes;
|
||||
iso_image_was_blind_attrs;
|
||||
iso_init;
|
||||
iso_init_with_flag;
|
||||
iso_interval_reader_destroy;
|
||||
@ -165,6 +167,7 @@ iso_local_get_attrs;
|
||||
iso_local_get_perms_wo_acl;
|
||||
iso_local_set_acl_text;
|
||||
iso_local_set_attrs;
|
||||
iso_local_set_attrs_errno;
|
||||
iso_md5_clone;
|
||||
iso_md5_compute;
|
||||
iso_md5_end;
|
||||
|
@ -553,6 +553,8 @@ const char *iso_error_to_msg(int errcode)
|
||||
return "Zero sized, oversized, or mislocated SUSP CE area found";
|
||||
case ISO_MULTI_OVER_IMPORTED:
|
||||
return "Multi-session would overwrite imported_iso interval";
|
||||
case ISO_ELTO_EFI_HIDDEN:
|
||||
return "El-Torito EFI image is hidden";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
|
@ -1365,7 +1365,11 @@ int iso_dir_insert(IsoDir *dir, IsoNode *node, IsoNode **pos,
|
||||
/* old file is newer */
|
||||
return ISO_NODE_NAME_NOT_UNIQUE;
|
||||
}
|
||||
/* fall down */
|
||||
if ((node->mode & S_IFMT) != ((*pos)->mode & S_IFMT)) {
|
||||
/* different file types */
|
||||
return ISO_NODE_NAME_NOT_UNIQUE;
|
||||
}
|
||||
break;
|
||||
case ISO_REPLACE_IF_SAME_TYPE:
|
||||
if ((node->mode & S_IFMT) != ((*pos)->mode & S_IFMT)) {
|
||||
/* different file types */
|
||||
@ -1824,6 +1828,7 @@ int attr_enlarge_list(char ***names, size_t **value_lengths, char ***values,
|
||||
(but not if bit2 is set)
|
||||
bit2= delete the given names rather than overwrite
|
||||
their content
|
||||
bit3= with bit0: delete all old non-"isofs." names
|
||||
bit4= do not overwrite value of empty name
|
||||
bit5= do not overwrite isofs attributes
|
||||
bit15= release memory and return 1
|
||||
@ -1849,9 +1854,11 @@ int iso_node_merge_xattr(IsoNode *node, size_t num_attrs, char **names,
|
||||
return ret;
|
||||
|
||||
if ((flag & 1) && (!(flag & 4))) {
|
||||
/* Delete unmatched user space pairs */
|
||||
/* Delete unmatched settable pairs */
|
||||
for (j = 0; j < *m_num_attrs; j++) {
|
||||
if (strncmp((*m_names)[j], "user.", 5) != 0)
|
||||
if (strncmp((*m_names)[j], "isofs.", 6) == 0)
|
||||
continue;
|
||||
if (strncmp((*m_names)[j], "user.", 5) != 0 && !(flag & 8))
|
||||
continue;
|
||||
for (i = 0; i < num_attrs; i++) {
|
||||
if (names[i] == NULL || (*m_names)[j] == NULL)
|
||||
@ -1980,7 +1987,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
|
||||
node, num_attrs, names, value_lengths, values,
|
||||
&m_num, &m_names, &m_value_lengths, &m_values,
|
||||
(flag & 4) | (!(flag & 2)) | ((!(flag & 1)) << 4) |
|
||||
((flag & 16) << 1));
|
||||
((flag & 16) << 1) | (flag & 8));
|
||||
if (ret < 0)
|
||||
goto ex;
|
||||
num_attrs = m_num;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Vreixo Formoso
|
||||
* Copyright (c) 2010 - 2017 Thomas Schmitt
|
||||
* Copyright (c) 2010 - 2018 Thomas Schmitt
|
||||
*
|
||||
* 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
|
||||
@ -165,7 +165,17 @@ int iso_compute_append_partitions(Ecma119Image *t, int flag)
|
||||
else
|
||||
cyl_size /= 4;
|
||||
}
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
|
||||
pos = t->curblock;
|
||||
|
||||
#else
|
||||
|
||||
pos = (t->vol_space_size + t->opts->ms_block);
|
||||
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ISO_MAX_PARTITIONS; i++) {
|
||||
if (t->opts->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
@ -1856,7 +1866,12 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
img_blocks = t->vol_space_size;
|
||||
#else
|
||||
img_blocks = t->curblock;
|
||||
#endif
|
||||
|
||||
if (t->system_area_data != NULL) {
|
||||
/* Write more or less opaque boot image */
|
||||
memcpy(buf, t->system_area_data, 16 * BLOCK_SIZE);
|
||||
@ -2069,7 +2084,17 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
/* Adjust partition table to partition offset.
|
||||
With t->mbr_req_count > 0 this has already been done,
|
||||
*/
|
||||
img_blocks = t->curblock; /* value might be altered */
|
||||
|
||||
#ifndef Libisofs_appended_partitions_inlinE
|
||||
|
||||
img_blocks = t->curblock; /* value might have been altered */
|
||||
|
||||
#else
|
||||
|
||||
/* A change of t->curblock does not matter in this case */
|
||||
|
||||
#endif
|
||||
|
||||
if (part_type == 0xee && t->gpt_req_count > 0) {
|
||||
mbrp1_blocks = t->total_size / BLOCK_SIZE + t->opts->ms_block;
|
||||
offset_flag |= 2 | 1; /* protective MBR, no other partitions */
|
||||
@ -2177,8 +2202,10 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||
if ((((t->system_area_options >> 2) & 0x3f) == 0 &&
|
||||
(t->system_area_options & 3) == 1) ||
|
||||
t->opts->partition_offset > 0) {
|
||||
/* Protective MBR || partition offset */
|
||||
/* ISO will not be a partition. It can span the whole image. */
|
||||
/* Protective MBR || partition offset
|
||||
ISO will not be a partition or add-on session.
|
||||
It can span the whole image.
|
||||
*/
|
||||
t->pvd_size_is_total_size = 1;
|
||||
}
|
||||
|
||||
@ -2221,6 +2248,10 @@ int iso_align_isohybrid(Ecma119Image *t, int flag)
|
||||
off_t imgsize, cylsize = 0, frac;
|
||||
char *msg = NULL;
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
int fap, lap, app_part_count;
|
||||
#endif
|
||||
|
||||
LIBISO_ALLOC_MEM(msg, char, 160);
|
||||
sa_type = (t->system_area_options >> 2) & 0x3f;
|
||||
if (sa_type != 0)
|
||||
@ -2234,7 +2265,22 @@ int iso_align_isohybrid(Ecma119Image *t, int flag)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
|
||||
/* If partitions get appended then t->opts->tail_blocks and
|
||||
t->gpt_backup_size come after the alignment padding.
|
||||
*/
|
||||
app_part_count = iso_count_appended_partitions(t, &fap, &lap);
|
||||
img_blocks = t->curblock;
|
||||
if (app_part_count == 0)
|
||||
img_blocks += t->opts->tail_blocks + t->gpt_backup_size;
|
||||
|
||||
#else
|
||||
|
||||
img_blocks = t->curblock + t->opts->tail_blocks + t->gpt_backup_size;
|
||||
|
||||
#endif
|
||||
|
||||
imgsize = ((off_t) img_blocks) * (off_t) 2048;
|
||||
if ((!(t->opts->appended_as_gpt && t->have_appended_partitions))
|
||||
&& ((t->system_area_options & 3) || always_align)
|
||||
@ -2313,7 +2359,17 @@ int iso_align_isohybrid(Ecma119Image *t, int flag)
|
||||
t->post_iso_part_pad);
|
||||
iso_msgs_submit(0, msg, 0, "WARNING", 0);
|
||||
}
|
||||
|
||||
#ifdef Libisofs_part_align_writeR
|
||||
|
||||
t->part_align_blocks = (frac + 2047) / 2048;
|
||||
|
||||
#else
|
||||
|
||||
t->opts->tail_blocks += (frac + 2047) / 2048;
|
||||
|
||||
#endif /* ! Libisofs_part_align_writeR */
|
||||
|
||||
ret = ISO_SUCCESS;
|
||||
ex:;
|
||||
LIBISO_FREE_MEM(msg);
|
||||
@ -3136,7 +3192,7 @@ static int partappend_writer_write_data(IsoImageWriter *writer)
|
||||
target->opts->appended_partitions[i],
|
||||
target->appended_part_prepad[i],
|
||||
target->appended_part_size[i],
|
||||
target->appended_part_flags[i] & 1);
|
||||
target->opts->appended_part_flags[i] & 1);
|
||||
if (res < 0)
|
||||
return res;
|
||||
target->curblock += target->appended_part_size[i];
|
||||
|
@ -317,9 +317,13 @@ void iso_ascii_utf_16le(uint8_t gap_name[72]);
|
||||
#define Libisofs_grub2_sparc_patch_size_poS 0x230
|
||||
|
||||
|
||||
/* >>> It is unclear whether there is a use case for appended partitions
|
||||
inside the ISO filesystem range.
|
||||
# define Libisofs_appended_partitions_inlinE yes
|
||||
/* Put appended partitions into the writer range
|
||||
*/
|
||||
#define Libisofs_appended_partitions_inlinE yes
|
||||
#ifdef Libisofs_appended_partitions_inlinE
|
||||
/* For padding after appended partitions (and also after backup GPT)
|
||||
*/
|
||||
#define Libisofs_part_align_writeR yes
|
||||
#endif
|
||||
|
||||
#endif /* SYSTEM_AREA_H_ */
|
||||
|
Reference in New Issue
Block a user