Added POSIX_ACL support for *BSD. Patch from jedgar@fxp.org. Changed
authorJeremy Allison <jra@samba.org>
Sat, 14 Apr 2001 19:46:28 +0000 (19:46 +0000)
committerJeremy Allison <jra@samba.org>
Sat, 14 Apr 2001 19:46:28 +0000 (19:46 +0000)
a bit to use AC_TRY_LINK to ensure functions are available for link
instead of AC_TRY_COMPILE.
Jeremy.

source/acconfig.h
source/configure
source/configure.in
source/include/config.h.in
source/lib/sysacls.c

index fd319509b9c67afad215f0e1b2e4ee32bdc2851f..63af9f78c17237877bf89c498841be2fadd977a1 100644 (file)
 #undef MIPS_SPINLOCKS
 #undef POWERPC_SPINLOCKS
 #undef HAVE_POSIX_ACLS
+#undef HAVE_ACL_GET_PERM_NP
 #undef HAVE_UNIXWARE_ACLS
 #undef HAVE_SOLARIS_ACLS
 #undef HAVE_IRIX_ACLS
index 7cf0e29407ae86fc59c6037f95819423682fa279..4a3b7f07bedeb1ff08596bf0488b74c93afff648 100755 (executable)
@@ -12041,7 +12041,7 @@ EOF
 
                        ;;
         *)
-            echo $ac_n "checking for acl_get_file in -lacl""... $ac_c" 1>&6
+                       echo $ac_n "checking for acl_get_file in -lacl""... $ac_c" 1>&6
 echo "configure:12046: checking for acl_get_file in -lacl" >&5
 ac_lib_var=`echo acl'_'acl_get_file | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
@@ -12088,13 +12088,13 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
-            echo $ac_n "checking for ACL support""... $ac_c" 1>&6
+                       echo $ac_n "checking for ACL support""... $ac_c" 1>&6
 echo "configure:12093: checking for ACL support" >&5
 if eval "test \"`echo '$''{'samba_cv_HAVE_POSIX_ACLS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
-            cat > conftest.$ac_ext <<EOF
+                       cat > conftest.$ac_ext <<EOF
 #line 12099 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
@@ -12103,7 +12103,7 @@ int main() {
  acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);
 ; return 0; }
 EOF
-if { (eval echo configure:12107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   samba_cv_HAVE_POSIX_ACLS=yes
 else
@@ -12116,21 +12116,55 @@ rm -f conftest*
 fi
 
 echo "$ac_t""$samba_cv_HAVE_POSIX_ACLS" 1>&6
-            if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
-                echo "$ac_t""Using posix ACLs" 1>&6
-                cat >> confdefs.h <<\EOF
+                       if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
+                               echo "$ac_t""Using posix ACLs" 1>&6
+                               cat >> confdefs.h <<\EOF
 #define HAVE_POSIX_ACLS 1
 EOF
 
-            fi
+                               echo $ac_n "checking for acl_get_perm_np""... $ac_c" 1>&6
+echo "configure:12127: checking for acl_get_perm_np" >&5
+if eval "test \"`echo '$''{'samba_cv_HAVE_ACL_GET_PERM_NP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+                               cat > conftest.$ac_ext <<EOF
+#line 12133 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/acl.h>
+int main() {
+ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);
+; return 0; }
+EOF
+if { (eval echo configure:12141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  samba_cv_HAVE_ACL_GET_PERM_NP=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  samba_cv_HAVE_ACL_GET_PERM_NP=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$samba_cv_HAVE_ACL_GET_PERM_NP" 1>&6
+                               if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
+                                       cat >> confdefs.h <<\EOF
+#define HAVE_ACL_GET_PERM_NP 1
+EOF
+
+                               fi
+                       fi
                        echo $ac_n "checking for XFS ACL support""... $ac_c" 1>&6
-echo "configure:12128: checking for XFS ACL support" >&5
+echo "configure:12162: checking for XFS ACL support" >&5
 if eval "test \"`echo '$''{'samba_cv_HAVE_XFS_ACLS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                        cat > conftest.$ac_ext <<EOF
-#line 12134 "configure"
+#line 12168 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <acl/acl.h>
@@ -12138,7 +12172,7 @@ int main() {
  char test_str[13] = SGI_ACL_FILE; 
 ; return 0; }
 EOF
-if { (eval echo configure:12142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   samba_cv_HAVE_XFS_ACLS=yes
 else
@@ -12183,11 +12217,11 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 12187 "configure"
+#line 12221 "configure"
 #include "confdefs.h"
 #include "${srcdir-.}/tests/summary.c"
 EOF
-if { (eval echo configure:12191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   echo "configure OK";
 else
index c8270d2d5c48fae71db3614ad9c4689d71a65377..16f7f0af1a7a758e8dc2836f03fff123900e003c 100644 (file)
@@ -2075,16 +2075,24 @@ AC_ARG_WITH(acl-support,
                        AC_DEFINE(HAVE_IRIX_ACLS)
                        ;;
         *)
-            AC_CHECK_LIB(acl,acl_get_file)
-            AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
-            AC_TRY_COMPILE([#include <sys/types.h>
+                       AC_CHECK_LIB(acl,acl_get_file)
+                       AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
+                       AC_TRY_LINK([#include <sys/types.h>
 #include <sys/acl.h>],
 [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
-            if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
-                AC_MSG_RESULT(Using posix ACLs)
-                AC_DEFINE(HAVE_POSIX_ACLS)
-            fi
+                       if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
+                               AC_MSG_RESULT(Using posix ACLs)
+                               AC_DEFINE(HAVE_POSIX_ACLS)
+                               AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
+                               AC_TRY_LINK([#include <sys/types.h>
+#include <sys/acl.h>],
+[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
+samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
+                               if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
+                                       AC_DEFINE(HAVE_ACL_GET_PERM_NP)
+                               fi
+                       fi
                        AC_CACHE_CHECK([for XFS ACL support],samba_cv_HAVE_XFS_ACLS,[
                        AC_TRY_COMPILE([#include <sys/types.h>
 #include <acl/acl.h>],
index b13f465691e8543b4143698dc494ae54700ebeb4..6a6c8567665b76c3dbf313374a398f39dd6d4b35 100644 (file)
 #undef MIPS_SPINLOCKS
 #undef POWERPC_SPINLOCKS
 #undef HAVE_POSIX_ACLS
+#undef HAVE_ACL_GET_PERM_NP
 #undef HAVE_UNIXWARE_ACLS
 #undef HAVE_SOLARIS_ACLS
 #undef HAVE_IRIX_ACLS
index 02018a52b37f6c12ed66ebf3985661d5e952827f..ba015e8f8d147f7e3958fc6437c7a2ce0735ddd9 100644 (file)
@@ -113,7 +113,16 @@ int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
 
 int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
 {
+#if defined(HAVE_ACL_GET_PERM_NP)
+       /*
+        * Required for TrustedBSD-based ACL implementations where
+        * non-POSIX.1e functions are denoted by a _np (non-portable)
+        * suffix.
+        */
+       return acl_get_perm_np(permset, perm);
+#else
        return acl_get_perm(permset, perm);
+#endif
 }
 
 char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen)