]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Darwin ACL: avoid using mbr_identifier_to_uuid()
authorMartin Matuska <martin@matuska.org>
Mon, 6 Mar 2017 23:50:12 +0000 (00:50 +0100)
committerMartin Matuska <martin@matuska.org>
Tue, 7 Mar 2017 10:36:40 +0000 (11:36 +0100)
Use mbr_uid_to_uuid() and mbr_gid_to_uuid() for backwards compatibility
instead. These functions have been introduced together with membership.h.

Fixes #882

configure.ac
libarchive/archive_write_disk_acl.c
test_utils/test_common.h
test_utils/test_main.c

index 0592279d96a31bfd1edb70c861573d099d34eef3..355c7540b80b05c35d0e2e56f90c5539097b7e94 100644 (file)
@@ -745,7 +745,7 @@ if test "x$enable_acl" != "xno"; then
                [#include <sys/types.h>
                #include <sys/acl.h>])
 
-    # FreeBSD and MacOS ACL support
+    # MacOS ACL support
     AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_SYNCHRONIZE], [], [],
                [#include <sys/types.h>
                #include <sys/acl.h>])
index 643f3c3a07334f3327ed0bde3ed24f38484d6418..49792749688e3ebb5b158d4badd0ca20d54e4d98 100644 (file)
@@ -424,8 +424,7 @@ set_acl(struct archive *a, int fd, const char *name,
                        acl_set_tag_type(acl_entry, ACL_USER);
                        acl_set_qualifier(acl_entry, &ae_uid);
 #else  /* MacOS */
-                       if (mbr_identifier_to_uuid(ID_TYPE_UID, &ae_uid,
-                           sizeof(uid_t), ae_uuid) != 0)
+                       if (mbr_uid_to_uuid(ae_uid, ae_uuid) != 0)
                                continue;
                        if (acl_set_qualifier(acl_entry, &ae_uuid) != 0)
                                continue;
@@ -437,8 +436,7 @@ set_acl(struct archive *a, int fd, const char *name,
                        acl_set_tag_type(acl_entry, ACL_GROUP);
                        acl_set_qualifier(acl_entry, &ae_gid);
 #else  /* MacOS */
-                       if (mbr_identifier_to_uuid(ID_TYPE_GID, &ae_gid,
-                           sizeof(gid_t), ae_uuid) != 0)
+                       if (mbr_gid_to_uuid(ae_gid, ae_uuid) != 0)
                                continue;
                        if (acl_set_qualifier(acl_entry, &ae_uuid) != 0)
                                continue;
index 0078054178f06a68783d9bac56d17f80597b4d22..44215a3595d571933fd0546381a54e48b258b2bf 100644 (file)
 #if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE
 #if HAVE_DECL_ACL_USER
 #define        HAVE_POSIX_ACL  1
-#elif HAVE_DECL_ACL_TYPE_EXTENDED
+#elif HAVE_DECL_ACL_TYPE_EXTENDED && HAVE_MEMBERSHIP_H
 #define        HAVE_DARWIN_ACL 1
 #endif
 #if HAVE_DECL_ACL_TYPE_NFS4
index 86ab5f1a489f765671fa45e1df2d26db6067a9e6..5d0e287dba3f040e6f9ad23da2a28407bb0aaf1a 100644 (file)
@@ -2605,8 +2605,8 @@ setTestAcl(const char *path)
        failure("acl_set_permset() error: %s", strerror(errno));
        if (assertEqualInt(r, 0) == 0)
                goto testacl_free;
-       r = mbr_identifier_to_uuid(ID_TYPE_UID, &uid, sizeof(uid_t), uuid);
-       failure("mbr_identifier_to_uuid() error: %s", strerror(errno));
+       r = mbr_uid_to_uuid(uid, uuid);
+       failure("mbr_uid_to_uuid() error: %s", strerror(errno));
        if (assertEqualInt(r, 0) == 0)
                goto testacl_free;
        r = acl_set_qualifier(aclent, uuid);