1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent 8051406588
commit c236287463
5 changed files with 73 additions and 20 deletions

View File

@ -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

60
source/configure vendored
View File

@ -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

View 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>],

View File

@ -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

View 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)