More graceful reaction on filesystems where ACL are not enabled.
This commit is contained in:
parent
c874a159e2
commit
819e3218f6
@ -290,7 +290,7 @@ described here. This feature allows scdbackup to omit its own checksum filter
|
||||
if using xorriso as ISO 9660 formatter program.
|
||||
Such a tag makes only sense if the session begins at LBA 0.
|
||||
|
||||
See scdbackup-*/README, appendix VERIFY for a specification
|
||||
See scdbackup-*/README, appendix VERIFY for a specification.
|
||||
|
||||
Example of a scdbackup checksum tag:
|
||||
scdbackup_checksum_tag_v0.1 2456606865 61 2_2 B00109.143415 2456606865 485bbef110870c45754d7adcc844a72c c2355d5ea3c94d792ff5893dfe0d6d7b
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef Libisofs_with_aaip_acL
|
||||
/* It seems ACL is fixely integrated in FreeBSD libc. There is no libacl. */
|
||||
@ -37,13 +38,14 @@
|
||||
finally has to be freed by a call to this function
|
||||
with bit15 of flag.
|
||||
@param flag Bitfield for control purposes
|
||||
bit0= obtain default ACL rather than access ACL
|
||||
(bit0= obtain default ACL rather than access ACL)
|
||||
bit4= set *text = NULL and return 2
|
||||
if the ACL matches st_mode permissions.
|
||||
bit5= in case of symbolic link: inquire link target
|
||||
bit15= free text and return 1
|
||||
@return > 0 ok
|
||||
0 ACL support not enabled at compile time
|
||||
or filesystem does not support ACL
|
||||
-1 failure of system ACL service (see errno)
|
||||
-2 attempt to inquire ACL of a symbolic
|
||||
link without bit4 or bit5
|
||||
@ -88,8 +90,18 @@ int aaip_get_acl_text(char *path, char **text, int flag)
|
||||
|
||||
acl= acl_get_file(path, ACL_TYPE_ACCESS);
|
||||
|
||||
if(acl == NULL)
|
||||
if(acl == NULL) {
|
||||
if(errno == EOPNOTSUPP) {
|
||||
/* filesystem does not support ACL */
|
||||
if(flag & 16)
|
||||
return(2);
|
||||
|
||||
/* >>> ??? fake ACL from POSIX permissions ? */;
|
||||
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
*text= acl_to_text(acl, NULL);
|
||||
acl_free(acl);
|
||||
|
||||
@ -181,10 +193,8 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
||||
|
||||
if(flag & 1) { /* Obtain ACL */
|
||||
/* access-ACL */
|
||||
ret= aaip_get_acl_text(path, &acl_text, flag & (16 | 32));
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(ret == 2)
|
||||
aaip_get_acl_text(path, &acl_text, flag & (16 | 32));
|
||||
if(acl_text == NULL)
|
||||
{ret= 1; goto ex;} /* empty ACL / only st_mode info was found in ACL */
|
||||
ret= aaip_encode_acl(acl_text, (mode_t) 0, &a_acl_len, &a_acl, flag & 2);
|
||||
if(ret <= 0)
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifdef Libisofs_with_aaip_acL
|
||||
#include <sys/acl.h>
|
||||
@ -46,6 +48,7 @@
|
||||
2 only st_mode permissions exist and bit 4 is set
|
||||
or empty ACL and bit0 is set
|
||||
0 ACL support not enabled at compile time
|
||||
or filesystem does not support ACL
|
||||
-1 failure of system ACL service (see errno)
|
||||
-2 attempt to inquire ACL of a symbolic link without
|
||||
bit4 or bit5 resp. with no suitable link target
|
||||
@ -79,8 +82,18 @@ int aaip_get_acl_text(char *path, char **text, int flag)
|
||||
}
|
||||
|
||||
acl= acl_get_file(path, (flag & 1) ? ACL_TYPE_DEFAULT : ACL_TYPE_ACCESS);
|
||||
if(acl == NULL)
|
||||
if(acl == NULL) {
|
||||
if(errno == ENOTSUP) {
|
||||
/* filesystem does not support ACL */
|
||||
if(flag & 16)
|
||||
return(2);
|
||||
|
||||
/* >>> ??? fake ACL from POSIX permissions ? */;
|
||||
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
*text= acl_to_text(acl, NULL);
|
||||
acl_free(acl);
|
||||
|
||||
|
@ -4566,7 +4566,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
|
||||
* @return
|
||||
* 1 ok
|
||||
* 2 ok, trivial ACL found while bit4 is set, *text is NULL
|
||||
* 0 no ACL manipulation adapter available
|
||||
* 0 no ACL manipulation adapter available / ACL not supported on fs
|
||||
* -1 failure of system ACL service (see errno)
|
||||
* -2 attempt to inquire ACL of a symbolic link without bit4 or bit5
|
||||
* resp. with no suitable link target
|
||||
|
Loading…
Reference in New Issue
Block a user