From 8f0f7973af8c9446a22eb278746b96ee89db95ea Mon Sep 17 00:00:00 2001 From: joerg Date: Sun, 12 Mar 2017 06:45:16 +0000 Subject: [PATCH] Merge 60f0931d3b97e00616d7122321e34116d926bcc5: Reorganize ACL defines and fix detection of ACL_SYNCHRONIZE on Mac OS Adjust MacOS part of test_acl_platform_nfs4 --- archivers/libarchive/files/CMakeLists.txt | 45 ++++++------ .../libarchive/files/build/cmake/config.h.in | 49 ++++++++++--- archivers/libarchive/files/config.h.in | 68 ++++++++++++------- archivers/libarchive/files/configure | 58 +++++++++++----- archivers/libarchive/files/configure.ac | 27 +++----- .../files/libarchive/archive_platform.h | 9 ++- .../archive_read_disk_entry_from_file.c | 24 +++---- .../files/libarchive/archive_write_disk_acl.c | 16 ++--- .../libarchive/test/test_acl_platform_nfs4.c | 8 ++- .../libarchive/files/test_utils/test_common.h | 9 ++- 10 files changed, 198 insertions(+), 115 deletions(-) diff --git a/archivers/libarchive/files/CMakeLists.txt b/archivers/libarchive/files/CMakeLists.txt index 1ca9d8fdc066..1c84870f2f70 100644 --- a/archivers/libarchive/files/CMakeLists.txt +++ b/archivers/libarchive/files/CMakeLists.txt @@ -1618,29 +1618,29 @@ IF(ENABLE_ACL) CHECK_FUNCTION_EXISTS(acl_get_link_np HAVE_ACL_GET_LINK_NP) CHECK_FUNCTION_EXISTS(acl_is_trivial_np HAVE_ACL_IS_TRIVIAL_NP) CHECK_FUNCTION_EXISTS(acl_set_link_np HAVE_ACL_SET_LINK_NP) - CHECK_SYMBOL_EXISTS(ACL_TYPE_NFS4 "${INCLUDES}" HAVE_ACL_TYPE_NFS4) + CHECK_SYMBOL_EXISTS(ACL_TYPE_NFS4 "${INCLUDES}" HAVE_DECL_ACL_TYPE_NFS4) # MacOS has an acl.h that isn't POSIX. It can be detected by # checking for ACL_USER - CHECK_SYMBOL_EXISTS(ACL_USER "${INCLUDES}" HAVE_ACL_USER) + CHECK_SYMBOL_EXISTS(ACL_USER "${INCLUDES}" HAVE_DECL_ACL_USER) CHECK_C_SOURCE_COMPILES("#include #include -int main(void) { return ACL_TYPE_EXTENDED; }" HAVE_ACL_TYPE_EXTENDED) +int main(void) { return ACL_TYPE_EXTENDED; }" HAVE_DECL_ACL_TYPE_EXTENDED) + CHECK_C_SOURCE_COMPILES("#include +#include +int main(void) { return ACL_SYNCHRONIZE; }" HAVE_DECL_ACL_SYNCHRONIZE) # Solaris and derivates ACLs - CHECK_LIBRARY_EXISTS(sec "acl_get" "" HAVE_LIBSEC) - IF(HAVE_LIBSEC) - SET(CMAKE_REQUIRED_LIBRARIES "sec") - FIND_LIBRARY(SEC_LIBRARY NAMES sec) - LIST(APPEND ADDITIONAL_LIBS ${SEC_LIBRARY}) - ENDIF(HAVE_LIBSEC) - # CHECK_TYPE_EXISTS(aclent_t "${INCLUDES}" HAVE_ACLENT_T) CHECK_TYPE_EXISTS(ace_t "${INCLUDES}" HAVE_ACE_T) - CHECK_FUNCTION_EXISTS(acl_get HAVE_FACL_GET) - CHECK_FUNCTION_EXISTS(facl_get HAVE_FACL_GET) - CHECK_FUNCTION_EXISTS(acl_set HAVE_FACL_SET) - CHECK_FUNCTION_EXISTS(facl_set HAVE_FACL_SET) + CHECK_FUNCTION_EXISTS(acl HAVE_ACL) + CHECK_FUNCTION_EXISTS(facl HAVE_FACL) + CHECK_SYMBOL_EXISTS(GETACL "${INCLUDES}" HAVE_DECL_GETACL) + CHECK_SYMBOL_EXISTS(GETACLCNT "${INCLUDES}" HAVE_DECL_GETACLCNT) + CHECK_SYMBOL_EXISTS(SETACL "${INCLUDES}" HAVE_DECL_SETACL) + CHECK_SYMBOL_EXISTS(ACE_GETACL "${INCLUDES}" HAVE_DECL_ACE_GETACL) + CHECK_SYMBOL_EXISTS(ACE_GETACLCNT "${INCLUDES}" HAVE_DECL_ACE_GETACLCNT) + CHECK_SYMBOL_EXISTS(ACE_SETACL "${INCLUDES}" HAVE_DECL_ACE_SETACL) ELSE(ENABLE_ACL) # If someone runs cmake, then disables ACL support, we need # to forcibly override the cached values for these. @@ -1655,15 +1655,20 @@ ELSE(ENABLE_ACL) SET(HAVE_ACL_SET_FD FALSE) SET(HAVE_ACL_SET_FD_NP FALSE) SET(HAVE_ACL_SET_FILE FALSE) - SET(HAVE_ACL_TYPE_NFS4 FALSE) - SET(HAVE_ACL_USER FALSE) SET(HAVE_ACL_TYPE_EXTENDED FALSE) - SET(HAVE_ACL_GET FALSE) SET(HAVE_ACLENT_T FALSE) SET(HAVE_ACE_T FALSE) - SET(HAVE_FACL_GET FALSE) - SET(HAVE_ACL_SET FALSE) - SET(HAVE_FACL_SET FALSE) + SET(HAVE_DECL_ACL_TYPE_NFS4 FALSE) + SET(HAVE_DECL_ACL_USER FALSE) + SET(HAVE_DECL_ACL_SYNCHRONIZE FALSE) + SET(HAVE_DECL_GETACL FALSE) + SET(HAVE_DECL_GETACLCNT FALSE) + SET(HAVE_DECL_SETACL FALSE) + SET(HAVE_DECL_ACE_GETACL FALSE) + SET(HAVE_DECL_ACE_GETACLCNT FALSE) + SET(HAVE_DECL_ACE_SETACL FALSE) + SET(HAVE_ACL FALSE) + SET(HAVE_FACL FALSE) ENDIF(ENABLE_ACL) # diff --git a/archivers/libarchive/files/build/cmake/config.h.in b/archivers/libarchive/files/build/cmake/config.h.in index 923a78e51738..fd4fbdcd8ff1 100644 --- a/archivers/libarchive/files/build/cmake/config.h.in +++ b/archivers/libarchive/files/build/cmake/config.h.in @@ -326,15 +326,6 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `acl_set_file' function. */ #cmakedefine HAVE_ACL_SET_FILE 1 -/* True for FreeBSD with NFSv4 ACL support */ -#cmakedefine HAVE_ACL_TYPE_NFS4 1 - -/* True for MacOS ACL support */ -#cmakedefine HAVE_ACL_TYPE_EXTENDED 1 - -/* True for systems with POSIX ACL support */ -#cmakedefine HAVE_ACL_USER 1 - /* Define to 1 if you have the `arc4random_buf' function. */ #cmakedefine HAVE_ARC4RANDOM_BUF 1 @@ -371,6 +362,34 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `cygwin_conv_path' function. */ #cmakedefine HAVE_CYGWIN_CONV_PATH 1 +/* Define to 1 if you have the declaration of `ACE_GETACL', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_ACE_GETACL 1 + +/* Define to 1 if you have the declaration of `ACE_GETACLCNT', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_ACE_GETACLCNT 1 + +/* Define to 1 if you have the declaration of `ACE_SETACL', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_ACE_SETACL 1 + +/* Define to 1 if you have the declaration of `ACL_SYNCHRONIZE', and to 0 if + you don't. */ +#cmakedefine HAVE_DECL_ACL_SYNCHRONIZE 1 + +/* Define to 1 if you have the declaration of `ACL_TYPE_EXTENDED', and to 0 if + you don't. */ +#cmakedefine HAVE_DECL_ACL_TYPE_EXTENDED 1 + +/* Define to 1 if you have the declaration of `ACL_TYPE_NFS4', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_ACL_TYPE_NFS4 1 + +/* Define to 1 if you have the declaration of `ACL_USER', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_ACL_USER 1 + /* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you don't. */ #cmakedefine HAVE_DECL_INT32_MAX 1 @@ -395,6 +414,10 @@ typedef uint64_t uintmax_t; don't. */ #cmakedefine HAVE_DECL_INTMAX_MIN 1 +/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't. + */ +#cmakedefine HAVE_DECL_SETACL 1 + /* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you don't. */ #cmakedefine HAVE_DECL_SIZE_MAX 1 @@ -468,6 +491,14 @@ typedef uint64_t uintmax_t; /* Define to 1 if EXTATTR_NAMESPACE_USER is defined in sys/extattr.h. */ #cmakedefine HAVE_DECL_EXTATTR_NAMESPACE_USER 1 +/* Define to 1 if you have the declaration of `GETACL', and to 0 if you don't. + */ +#cmakedefine HAVE_DECL_GETACL 1 + +/* Define to 1 if you have the declaration of `GETACLCNT', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_GETACLCNT 1 + /* Define to 1 if you have the `fchdir' function. */ #cmakedefine HAVE_FCHDIR 1 diff --git a/archivers/libarchive/files/config.h.in b/archivers/libarchive/files/config.h.in index 2b1438affe33..68e3062cb9ec 100644 --- a/archivers/libarchive/files/config.h.in +++ b/archivers/libarchive/files/config.h.in @@ -129,15 +129,15 @@ /* Define to 1 if the system has the type `ace_t'. */ #undef HAVE_ACE_T +/* Define to 1 if you have the `acl' function. */ +#undef HAVE_ACL + /* Define to 1 if the system has the type `aclent_t'. */ #undef HAVE_ACLENT_T /* Define to 1 if you have the `acl_create_entry' function. */ #undef HAVE_ACL_CREATE_ENTRY -/* Define to 1 if you have the `acl_get' function. */ -#undef HAVE_ACL_GET - /* Define to 1 if you have the `acl_get_fd_np' function. */ #undef HAVE_ACL_GET_FD_NP @@ -165,9 +165,6 @@ /* Define to 1 if the system has the type `acl_permset_t'. */ #undef HAVE_ACL_PERMSET_T -/* Define to 1 if you have the `acl_set' function. */ -#undef HAVE_ACL_SET - /* Define to 1 if you have the `acl_set_fd' function. */ #undef HAVE_ACL_SET_FD @@ -177,15 +174,6 @@ /* Define to 1 if you have the `acl_set_file' function. */ #undef HAVE_ACL_SET_FILE -/* True for MacOS ACL support */ -#undef HAVE_ACL_TYPE_EXTENDED - -/* True for FreeBSD with NFSv4 ACL support */ -#undef HAVE_ACL_TYPE_NFS4 - -/* True for systems with POSIX ACL support */ -#undef HAVE_ACL_USER - /* Define to 1 if you have the `arc4random_buf' function. */ #undef HAVE_ARC4RANDOM_BUF @@ -219,10 +207,46 @@ /* Define to 1 if you have the `cygwin_conv_path' function. */ #undef HAVE_CYGWIN_CONV_PATH +/* Define to 1 if you have the declaration of `ACE_GETACL', and to 0 if you + don't. */ +#undef HAVE_DECL_ACE_GETACL + +/* Define to 1 if you have the declaration of `ACE_GETACLCNT', and to 0 if you + don't. */ +#undef HAVE_DECL_ACE_GETACLCNT + +/* Define to 1 if you have the declaration of `ACE_SETACL', and to 0 if you + don't. */ +#undef HAVE_DECL_ACE_SETACL + +/* Define to 1 if you have the declaration of `ACL_SYNCHRONIZE', and to 0 if + you don't. */ +#undef HAVE_DECL_ACL_SYNCHRONIZE + +/* Define to 1 if you have the declaration of `ACL_TYPE_EXTENDED', and to 0 if + you don't. */ +#undef HAVE_DECL_ACL_TYPE_EXTENDED + +/* Define to 1 if you have the declaration of `ACL_TYPE_NFS4', and to 0 if you + don't. */ +#undef HAVE_DECL_ACL_TYPE_NFS4 + +/* Define to 1 if you have the declaration of `ACL_USER', and to 0 if you + don't. */ +#undef HAVE_DECL_ACL_USER + /* Define to 1 if you have the declaration of `EXTATTR_NAMESPACE_USER', and to 0 if you don't. */ #undef HAVE_DECL_EXTATTR_NAMESPACE_USER +/* Define to 1 if you have the declaration of `GETACL', and to 0 if you don't. + */ +#undef HAVE_DECL_GETACL + +/* Define to 1 if you have the declaration of `GETACLCNT', and to 0 if you + don't. */ +#undef HAVE_DECL_GETACLCNT + /* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you don't. */ #undef HAVE_DECL_INT32_MAX @@ -247,6 +271,10 @@ don't. */ #undef HAVE_DECL_INTMAX_MIN +/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't. + */ +#undef HAVE_DECL_SETACL + /* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you don't. */ #undef HAVE_DECL_SIZE_MAX @@ -314,11 +342,8 @@ /* Define to 1 if you have the `extattr_set_file' function. */ #undef HAVE_EXTATTR_SET_FILE -/* Define to 1 if you have the `facl_get' function. */ -#undef HAVE_FACL_GET - -/* Define to 1 if you have the `facl_set' function. */ -#undef HAVE_FACL_SET +/* Define to 1 if you have the `facl' function. */ +#undef HAVE_FACL /* Define to 1 if you have the `fchdir' function. */ #undef HAVE_FCHDIR @@ -500,9 +525,6 @@ /* Define to 1 if you have the `regex' library (-lregex). */ #undef HAVE_LIBREGEX -/* Define to 1 if you have the `sec' library (-lsec). */ -#undef HAVE_LIBSEC - /* Define to 1 if you have the `xml2' library (-lxml2). */ #undef HAVE_LIBXML2 diff --git a/archivers/libarchive/files/configure b/archivers/libarchive/files/configure index c281e46fee66..4b1aef288d74 100755 --- a/archivers/libarchive/files/configure +++ b/archivers/libarchive/files/configure @@ -18160,37 +18160,60 @@ fi done - # Check for ACL_TYPE_NFS4 - ac_fn_c_check_decl "$LINENO" "ACL_TYPE_NFS4" "ac_cv_have_decl_ACL_TYPE_NFS4" "#include + # FreeBSD and POSIX + # MacOS has no ACL_USER in acl.h + ac_fn_c_check_decl "$LINENO" "ACL_TYPE_NFS4" "ac_cv_have_decl_ACL_TYPE_NFS4" "#include + #include " if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = xyes; then : - -$as_echo "#define HAVE_ACL_TYPE_NFS4 1" >>confdefs.h - + ac_have_decl=1 +else + ac_have_decl=0 fi - - # MacOS has an acl.h that isn't POSIX. It can be detected by - # checking for ACL_USER - ac_fn_c_check_decl "$LINENO" "ACL_USER" "ac_cv_have_decl_ACL_USER" "#include +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ACL_TYPE_NFS4 $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "ACL_USER" "ac_cv_have_decl_ACL_USER" "#include + #include " if test "x$ac_cv_have_decl_ACL_USER" = xyes; then : - -$as_echo "#define HAVE_ACL_USER 1" >>confdefs.h - + ac_have_decl=1 +else + ac_have_decl=0 fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ACL_USER $ac_have_decl +_ACEOF - # MacOS has ACL_TYPE_EXTENDED instead + + # FreeBSD and MacOS ACL support ac_fn_c_check_decl "$LINENO" "ACL_TYPE_EXTENDED" "ac_cv_have_decl_ACL_TYPE_EXTENDED" "#include #include " if test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = xyes; then : - -$as_echo "#define HAVE_ACL_TYPE_EXTENDED 1" >>confdefs.h - + ac_have_decl=1 +else + ac_have_decl=0 fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ACL_TYPE_EXTENDED $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "ACL_SYNCHRONIZE" "ac_cv_have_decl_ACL_SYNCHRONIZE" "#include + #include +" +if test "x$ac_cv_have_decl_ACL_SYNCHRONIZE" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ACL_SYNCHRONIZE $ac_have_decl +_ACEOF + # Solaris and derivates ACLs ac_fn_c_check_type "$LINENO" "aclent_t" "ac_cv_type_aclent_t" "#include @@ -18260,8 +18283,7 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETACLCNT $ac_have_decl _ACEOF - - ac_fn_c_check_decl "$LINENO" "ACE_GETACL" "ac_cv_have_decl_ACE_GETACL" "#include +ac_fn_c_check_decl "$LINENO" "ACE_GETACL" "ac_cv_have_decl_ACE_GETACL" "#include " if test "x$ac_cv_have_decl_ACE_GETACL" = xyes; then : ac_have_decl=1 diff --git a/archivers/libarchive/files/configure.ac b/archivers/libarchive/files/configure.ac index 882af8b42f84..4c6c84d95a4d 100644 --- a/archivers/libarchive/files/configure.ac +++ b/archivers/libarchive/files/configure.ac @@ -737,23 +737,15 @@ if test "x$enable_acl" != "xno"; then #endif ]) - # Check for ACL_TYPE_NFS4 - AC_CHECK_DECL([ACL_TYPE_NFS4], - [AC_DEFINE(HAVE_ACL_TYPE_NFS4, 1, [True for FreeBSD with NFSv4 ACL support])], - [], - [#include ]) + # FreeBSD and POSIX + # MacOS has no ACL_USER in acl.h + AC_CHECK_DECLS([ACL_TYPE_NFS4, ACL_USER], + [], [], + [#include + #include ]) - # MacOS has an acl.h that isn't POSIX. It can be detected by - # checking for ACL_USER - AC_CHECK_DECL([ACL_USER], - [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])], - [], - [#include ]) - - # MacOS has ACL_TYPE_EXTENDED instead - AC_CHECK_DECL([ACL_TYPE_EXTENDED], - [AC_DEFINE(HAVE_ACL_TYPE_EXTENDED, 1, [True for MacOS ACL support])], - [], + # FreeBSD and MacOS ACL support + AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_SYNCHRONIZE], [], [], [#include #include ]) @@ -761,8 +753,7 @@ if test "x$enable_acl" != "xno"; then AC_CHECK_TYPES([aclent_t], [], [], [[#include ]]) AC_CHECK_TYPES([ace_t], [], [], [[#include ]]) AC_CHECK_FUNCS(acl facl) - AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT], [], [], [#include ]) - AC_CHECK_DECLS([ACE_GETACL, ACE_SETACL, ACE_GETACLCNT], [], [], [#include ]) + AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT, ACE_GETACL, ACE_SETACL, ACE_GETACLCNT], [], [], [#include ]) fi # Additional requirements diff --git a/archivers/libarchive/files/libarchive/archive_platform.h b/archivers/libarchive/files/libarchive/archive_platform.h index 9a5c7c72385b..128f0e08878c 100644 --- a/archivers/libarchive/files/libarchive/archive_platform.h +++ b/archivers/libarchive/files/libarchive/archive_platform.h @@ -148,11 +148,14 @@ * POSIX.1e draft functions used in archive_read_extract.c. */ #if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE -#if HAVE_ACL_USER +#if HAVE_DECL_ACL_USER #define HAVE_POSIX_ACL 1 -#elif HAVE_ACL_TYPE_EXTENDED +#elif HAVE_DECL_ACL_TYPE_EXTENDED #define HAVE_DARWIN_ACL 1 #endif +#if HAVE_DECL_ACL_TYPE_NFS4 +#define HAVE_FREEBSD_NFS4_ACL 1 +#endif #endif /* @@ -169,7 +172,7 @@ #endif /* Define if platform supports NFSv4 ACLs */ -#if (HAVE_POSIX_ACL && HAVE_ACL_TYPE_NFS4) || HAVE_SUN_NFS4_ACL || HAVE_DARWIN_ACL +#if HAVE_FREEBSD_NFS4_ACL || HAVE_SUN_NFS4_ACL || HAVE_DARWIN_ACL #define HAVE_NFS4_ACL 1 #endif diff --git a/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c b/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c index 61710df0671e..8c0394e99982 100644 --- a/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c +++ b/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c @@ -126,7 +126,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_entry_from_file.c 2010 /* NFSv4 platform ACL type */ #if HAVE_DARWIN_ACL #define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_EXTENDED -#elif HAVE_ACL_TYPE_NFS4 +#elif HAVE_FREEBSD_NFS4_ACL #define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_NFS4 #endif @@ -768,14 +768,14 @@ static const struct { {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_SECURITY}, {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_SECURITY}, {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_CHANGE_OWNER}, -#ifdef ACL_SYNCHRONIZE +#if HAVE_DECL_ACL_SYNCHRONIZE {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} #endif #else /* POSIX.1e ACL permissions */ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, -#if HAVE_ACL_TYPE_NFS4 /* FreeBSD NFSv4 ACL permissions */ +#if HAVE_FREEBSD_NFS4_ACL /* FreeBSD NFSv4 ACL permissions */ {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, @@ -1267,11 +1267,11 @@ translate_acl(struct archive_read_disk *a, struct archive_entry *entry, acl_t acl, int default_entry_acl_type) { acl_tag_t acl_tag; -#if HAVE_ACL_TYPE_NFS4 +#if HAVE_FREEBSD_NFS4_ACL acl_entry_type_t acl_type; int brand; #endif -#if HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL +#if HAVE_FREEBSD_NFS4_ACL || HAVE_DARWIN_ACL acl_flagset_t acl_flagset; #endif acl_entry_t acl_entry; @@ -1283,7 +1283,7 @@ translate_acl(struct archive_read_disk *a, #endif const char *ae_name; -#if HAVE_ACL_TYPE_NFS4 +#if HAVE_FREEBSD_NFS4_ACL // FreeBSD "brands" ACLs as POSIX.1e or NFSv4 // Make sure the "brand" on this ACL is consistent // with the default_entry_acl_type bits provided. @@ -1374,7 +1374,7 @@ translate_acl(struct archive_read_disk *a, case ACL_OTHER: ae_tag = ARCHIVE_ENTRY_ACL_OTHER; break; -#if HAVE_ACL_TYPE_NFS4 +#if HAVE_FREEBSD_NFS4_ACL case ACL_EVERYONE: ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE; break; @@ -1409,9 +1409,9 @@ translate_acl(struct archive_read_disk *a, // XXX acl_type maps to allow/deny/audit/YYYY bits entry_acl_type = default_entry_acl_type; #endif -#if HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL +#if HAVE_FREEBSD_NFS4_ACL || HAVE_DARWIN_ACL if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) { -#if HAVE_ACL_TYPE_NFS4 +#if HAVE_FREEBSD_NFS4_ACL /* * acl_get_entry_type_np() fails with non-NFSv4 ACLs */ @@ -1438,7 +1438,7 @@ translate_acl(struct archive_read_disk *a, "Invalid NFSv4 ACL entry type"); return (ARCHIVE_WARN); } -#endif /* HAVE_ACL_TYPE_NFS4 */ +#endif /* HAVE_FREEBSD_NFS4_ACL */ /* * Libarchive stores "flag" (NFSv4 inheritance bits) @@ -1463,7 +1463,7 @@ translate_acl(struct archive_read_disk *a, ae_perm |= acl_inherit_map[i].archive_inherit; } } -#endif /* HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL */ +#endif /* HAVE_FREEBSD_NFS4_ACL || HAVE_DARWIN_ACL */ if (acl_get_permset(acl_entry, &acl_permset) != 0) { archive_set_error(&a->archive, errno, @@ -1484,7 +1484,7 @@ translate_acl(struct archive_read_disk *a, ae_perm |= acl_perm_map[i].archive_perm; } -#if defined(HAVE_DARWIN_ACL) && !defined(ACL_SYNCHRONIZE) +#if HAVE_DARWIN_ACL && !HAVE_DECL_ACL_SYNCHRONIZE /* On Mac OS X without ACL_SYNCHRONIZE assume it is set */ ae_perm |= ARCHIVE_ENTRY_ACL_SYNCHRONIZE; #endif diff --git a/archivers/libarchive/files/libarchive/archive_write_disk_acl.c b/archivers/libarchive/files/libarchive/archive_write_disk_acl.c index c98eda0ed7d7..643f3c3a0733 100644 --- a/archivers/libarchive/files/libarchive/archive_write_disk_acl.c +++ b/archivers/libarchive/files/libarchive/archive_write_disk_acl.c @@ -63,7 +63,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, #if HAVE_DARWIN_ACL #define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_EXTENDED -#elif HAVE_ACL_TYPE_NFS4 +#elif HAVE_FREEBSD_NFS4_ACL #define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_NFS4 #endif @@ -162,14 +162,14 @@ static const struct { {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_SECURITY}, {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_SECURITY}, {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_CHANGE_OWNER}, -#ifdef ACL_SYNCHRONIZE +#if HAVE_DECL_ACL_SYNCHRONIZE {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} #endif #else /* POSIX.1e ACL permissions */ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, -#if HAVE_ACL_TYPE_NFS4 /* FreeBSD NFSv4 ACL permissions */ +#if HAVE_FREEBSD_NFS4_ACL /* FreeBSD NFSv4 ACL permissions */ {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, @@ -246,11 +246,11 @@ set_acl(struct archive *a, int fd, const char *name, acl_t acl; acl_entry_t acl_entry; acl_permset_t acl_permset; -#if HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL +#if HAVE_FREEBSD_NFS4_ACL || HAVE_DARWIN_ACL acl_flagset_t acl_flagset; #endif #endif /* HAVE_SUN_ACL */ -#if HAVE_ACL_TYPE_NFS4 +#if HAVE_FREEBSD_NFS4_ACL int r; #endif int ret; @@ -457,7 +457,7 @@ set_acl(struct archive *a, int fd, const char *name, case ARCHIVE_ENTRY_ACL_OTHER: acl_set_tag_type(acl_entry, ACL_OTHER); break; -#if HAVE_ACL_TYPE_NFS4 /* FreeBSD only */ +#if HAVE_FREEBSD_NFS4_ACL /* FreeBSD only */ case ARCHIVE_ENTRY_ACL_EVERYONE: acl_set_tag_type(acl_entry, ACL_EVERYONE); break; @@ -471,7 +471,7 @@ set_acl(struct archive *a, int fd, const char *name, goto exit_free; } -#if HAVE_ACL_TYPE_NFS4 || HAVE_SUN_ACL +#if HAVE_FREEBSD_NFS4_ACL || HAVE_SUN_ACL r = 0; switch (ae_type) { #if HAVE_SUN_ACL @@ -545,7 +545,7 @@ set_acl(struct archive *a, int fd, const char *name, ret = ARCHIVE_FAILED; goto exit_free; } -#endif /* HAVE_ACL_TYPE_NFS4 || HAVE_SUN_ACL */ +#endif /* HAVE_FREEBSD_NFS4_ACL || HAVE_SUN_ACL */ #if HAVE_SUN_ACL if (aclent != NULL) { diff --git a/archivers/libarchive/files/libarchive/test/test_acl_platform_nfs4.c b/archivers/libarchive/files/libarchive/test/test_acl_platform_nfs4.c index 9260cfb4f26c..5783e5234d29 100644 --- a/archivers/libarchive/files/libarchive/test/test_acl_platform_nfs4.c +++ b/archivers/libarchive/files/libarchive/test/test_acl_platform_nfs4.c @@ -311,12 +311,14 @@ set_acls(struct archive_entry *ae, struct myacl_t *acls, int start, int end) int i; archive_entry_acl_clear(ae); +#if !HAVE_DARWIN_ACL if (start > 0) { assertEqualInt(ARCHIVE_OK, archive_entry_acl_add_entry(ae, acls[0].type, acls[0].permset, acls[0].tag, acls[0].qual, acls[0].name)); } +#endif for (i = start; i < end; i++) { assertEqualInt(ARCHIVE_OK, archive_entry_acl_add_entry(ae, @@ -368,7 +370,9 @@ acl_permset_to_bitmap(acl_permset_t opaque_ps) {ACL_READ_SECURITY, ARCHIVE_ENTRY_ACL_READ_ACL}, {ACL_WRITE_SECURITY, ARCHIVE_ENTRY_ACL_WRITE_ACL}, {ACL_CHANGE_OWNER, ARCHIVE_ENTRY_ACL_WRITE_OWNER}, +#if HAVE_DECL_ACL_SYNCHRONIZE {ACL_SYNCHRONIZE, ARCHIVE_ENTRY_ACL_SYNCHRONIZE}, +#endif #else /* FreeBSD NFSv4 ACL permissions */ {ACL_EXECUTE, ARCHIVE_ENTRY_ACL_EXECUTE}, {ACL_WRITE, ARCHIVE_ENTRY_ACL_WRITE}, @@ -647,11 +651,13 @@ compare_acls( marker = malloc(sizeof(marker[0]) * (n + 1)); for (i = 0; i < n; i++) marker[i] = i + start; +#if !HAVE_DARWIN_ACL /* Always include the first ACE. */ if (start > 0) { marker[n] = 0; ++n; } +#endif /* * Iterate over acls in system acl object, try to match each @@ -802,7 +808,7 @@ DEFINE_TEST(test_acl_platform_nfs4) * verify that the local filesystem does support ACLs. * If it doesn't, we'll simply skip the remaining tests. */ -#if HAVE_POSIX_ACL && HAVE_ACL_TYPE_NFS4 +#if HAVE_FREEBSD_NFS4_ACL acl = acl_from_text("owner@:rwxp::allow,group@:rwp:f:allow"); failure("acl_from_text(): errno = %d (%s)", errno, strerror(errno)); assert((void *)acl != NULL); diff --git a/archivers/libarchive/files/test_utils/test_common.h b/archivers/libarchive/files/test_utils/test_common.h index b2c3bfb3b415..d8fd9c486b5e 100644 --- a/archivers/libarchive/files/test_utils/test_common.h +++ b/archivers/libarchive/files/test_utils/test_common.h @@ -127,11 +127,14 @@ * POSIX.1e draft functions used in archive_read_extract.c. */ #if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE -#if HAVE_ACL_USER +#if HAVE_DECL_ACL_USER #define HAVE_POSIX_ACL 1 -#elif HAVE_ACL_TYPE_EXTENDED +#elif HAVE_DECL_ACL_TYPE_EXTENDED #define HAVE_DARWIN_ACL 1 #endif +#if HAVE_DECL_ACL_TYPE_NFS4 +#define HAVE_FREEBSD_NFS4_ACL 1 +#endif #endif /* @@ -148,7 +151,7 @@ #endif /* Define if platform supports NFSv4 ACLs */ -#if (HAVE_POSIX_ACL && HAVE_ACL_TYPE_NFS4) || HAVE_SUN_NFS4_ACL || HAVE_DARWIN_ACL +#if HAVE_FREEBSD_NFS4_ACL || HAVE_SUN_NFS4_ACL || HAVE_DARWIN_ACL #define HAVE_NFS4_ACL 1 #endif