diff --git a/Makefile.am b/Makefile.am index e2005d4..ea83d5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -214,6 +214,7 @@ EXTRA_DIST = \ ChangeLog \ Roadmap \ doc/susp_aaip_0_2.txt \ + libisofs/aaip-os-dummy.c \ libisofs/aaip-os-linux.c \ libisofs/aaip-os-freebsd.c diff --git a/libisofs/aaip-os-dummy.c b/libisofs/aaip-os-dummy.c new file mode 100644 index 0000000..8058b6b --- /dev/null +++ b/libisofs/aaip-os-dummy.c @@ -0,0 +1,93 @@ + +/* + + aaip-os-dummy.c + + Idle placeholder for: + Arbitrary Attribute Interchange Protocol , system adapter for getting and + setting of ACLs and XFS-style Extended Attributes. + + See aaip-os-linux.c for a real implementation of this interface. + + To be included by aaip_0_2.c +*/ + +#include +#include +#include +#include +#include +#include +#include + + +/* ------------------------------ Getters --------------------------------- */ + +/* Obtain the ACL of the given file in long text form. + @return 0 ACL support not enabled at compile time +*/ +int aaip_get_acl_text(char *path, char **text, int flag) +{ + return(0); +} + + +/* Obtain the Extended Attributes and/or the ACLs of the given file in a form + that is ready for aaip_encode(). + @return 1 ok +*/ +int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names, + size_t **value_lengths, char ***values, int flag) +{ + *num_attrs= 0; + *names= NULL; + *value_lengths= NULL; + *values= NULL; + return(1); +} + + +/* ------------------------------ Setters --------------------------------- */ + + +/* Set the ACL of the given file to a given list in long text form. + @return 0 ACL support not enabled at compile time +*/ +int aaip_set_acl_text(char *path, char *text, int flag) +{ + return(0); +} + + +/* Bring the given attributes and/or ACLs into effect with the given file. + @param flag Bitfield for control purposes + bit0= decode and set ACLs + bit1= first clear all existing attributes of the file + bit2= do not set attributes other than ACLs + @return 1 success (there was nothing to do) + -6 support of xattr not enabled at compile time + -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 i; + + for(i= 0; i < num_attrs; i++) { + if(names[i] == NULL || values[i] == NULL) + continue; + if(names[i][0] == 0) { /* ACLs */ + if(flag & 1) + return(-7); + continue; + } + /* Extended Attribute */ + if(!(flag & 4)) + return(-6); + } + if(flag & 2) + return(-6); + return(1); +} + + diff --git a/libisofs/aaip_0_2.c b/libisofs/aaip_0_2.c index 44c0ad0..dab5705 100644 --- a/libisofs/aaip_0_2.c +++ b/libisofs/aaip_0_2.c @@ -2059,8 +2059,14 @@ ex:; #include "aaip-os-freebsd.c" #else +#ifdef __linux #include "aaip-os-linux.c" -#endif +#else + +#include "aaip-os-dummy.c" + +#endif /* ! __linux */ +#endif /* ! __FreeBSD__ */ diff --git a/libisofs/aaip_0_2.h b/libisofs/aaip_0_2.h index be24481..a8e9e03 100644 --- a/libisofs/aaip_0_2.h +++ b/libisofs/aaip_0_2.h @@ -483,7 +483,8 @@ int aaip_set_acl_text(char *path, char *text, int flag); -3 error with setting ACL -4 error with setting attribute -5 error with deleting attributes - + -6 support of xattr not enabled at compile time + -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); diff --git a/libisofs/node.c b/libisofs/node.c index d9a71b0..17ab4ef 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -1631,7 +1631,7 @@ int iso_node_set_acl_text(IsoNode *node, char *acl_text, int flag) mode_t st_mode; st_mode = iso_node_get_permissions(node); - if (!(flag & 2)) { /* want to update ACL by st_mode */ + if (!(flag & 2)) { /* want not to update ACL by st_mode */ /* >>> validate and rectify text */;