summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-14 19:46:28 +0000
committerJeremy Allison <jra@samba.org>2001-04-14 19:46:28 +0000
commited449b8ca7697d64ab3cfe8289287dd18566c91e (patch)
tree34541fbdd298c93db6f14d288da98321f69f2aa1
parent548ca26bd56467f7dafaf277e4d42adeb54fb557 (diff)
downloadsamba-ed449b8ca7697d64ab3cfe8289287dd18566c91e.tar.gz
samba-ed449b8ca7697d64ab3cfe8289287dd18566c91e.tar.bz2
samba-ed449b8ca7697d64ab3cfe8289287dd18566c91e.zip
Added POSIX_ACL support for *BSD. Patch from jedgar@fxp.org. Changed
a bit to use AC_TRY_LINK to ensure functions are available for link instead of AC_TRY_COMPILE. Jeremy. (This used to be commit c23628746342b6afa28cb34b0b4eaa61189ad390)
-rw-r--r--source3/acconfig.h1
-rwxr-xr-xsource3/configure60
-rw-r--r--source3/configure.in22
-rw-r--r--source3/include/config.h.in1
-rw-r--r--source3/lib/sysacls.c9
5 files changed, 73 insertions, 20 deletions
diff --git a/source3/acconfig.h b/source3/acconfig.h
index fd319509b9..63af9f78c1 100644
--- a/source3/acconfig.h
+++ b/source3/acconfig.h
@@ -139,6 +139,7 @@
#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
diff --git a/source3/configure b/source3/configure
index 7cf0e29407..4a3b7f07be 100755
--- a/source3/configure
+++ b/source3/configure
@@ -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
diff --git a/source3/configure.in b/source3/configure.in
index c8270d2d5c..16f7f0af1a 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -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>],
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index b13f465691..6a6c856766 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -202,6 +202,7 @@
#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
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index 02018a52b3..ba015e8f8d 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -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)