]> git.saurik.com Git - apple/libc.git/blobdiff - gen/filesec.c
Libc-1158.20.4.tar.gz
[apple/libc.git] / gen / filesec.c
index 55d29d5fff2008777e6c3369c94b48e3944d4a2b..64e73d0e7731e2d2ecc19f57dfe76cdf9807fe1b 100644 (file)
 #include <errno.h>
 #include <uuid/uuid.h>
 
+/*
+ * Versions of copy_int/copy_ext that retain native endianity.
+ */
+extern ssize_t acl_copy_ext_native(void *buf_p, acl_t acl, ssize_t size);
+extern acl_t   acl_copy_int_native(const void *buf_p);
 
 struct _filesec {
        int     fs_valid;
@@ -149,7 +154,7 @@ filesec_get_property(filesec_t fsec, filesec_property_t property, void *propptr)
                        if (fsec->fs_aclbuf == _FILESEC_REMOVE_ACL) {
                                *(acl_t *)propptr = _FILESEC_REMOVE_ACL;
                        } else {
-                               *(acl_t *)propptr = acl_copy_int(fsec->fs_aclbuf);
+                               *(acl_t *)propptr = acl_copy_int_native(fsec->fs_aclbuf);
                                if (*(acl_t *)propptr == NULL)
                                        error = errno;
                        }
@@ -252,7 +257,7 @@ filesec_set_property(filesec_t fsec, filesec_property_t property, const void *pr
                                error = errno;
                                break;
                        }
-                       copysize = acl_copy_ext(aclbuf, acl, aclsize);
+                       copysize = acl_copy_ext_native(aclbuf, acl, aclsize);
                        if (copysize < 0) {
                                free(aclbuf);
                                error = EINVAL;
@@ -289,6 +294,12 @@ filesec_set_property(filesec_t fsec, filesec_property_t property, const void *pr
        return (0);
 }
 
+int
+filesec_unset_property(filesec_t fsec, filesec_property_t property)
+{
+       return filesec_set_property(fsec, property, _FILESEC_UNSET_PROPERTY);
+}
+
 int
 filesec_query_property(filesec_t fsec, filesec_property_t property, int *validptr)
 {