svn commit: samba r2582 - in branches/SAMBA_4_0/source: build/m4 include utils

tpot at samba.org tpot at samba.org
Fri Sep 24 04:49:45 GMT 2004


Author: tpot
Date: 2004-09-24 04:49:45 +0000 (Fri, 24 Sep 2004)
New Revision: 2582

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2582&nolog=1

Log:
Merge checks for xattr and acl libraries from Samba3 so the {get,set}ntacl
programs can build on non-xattr machines.

Modified:
   branches/SAMBA_4_0/source/build/m4/rewrite.m4
   branches/SAMBA_4_0/source/include/includes.h
   branches/SAMBA_4_0/source/utils/getntacl.c
   branches/SAMBA_4_0/source/utils/setntacl.c


Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/rewrite.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/rewrite.m4	2004-09-24 03:34:55 UTC (rev 2581)
+++ branches/SAMBA_4_0/source/build/m4/rewrite.m4	2004-09-24 04:49:45 UTC (rev 2582)
@@ -1547,3 +1547,117 @@
 if test x"$samba_cv_HAVE_COMPARISON_FN_T" = x"yes"; then
 	AC_DEFINE(HAVE_COMPARISON_FN_T,1,[Whether or not we have comparison_fn_t])
 fi
+
+############################################
+# Check if we have extended attributes
+AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h)
+AC_SEARCH_LIBS(getxattr, [attr])
+AC_CHECK_FUNCS(getxattr lgetxattr fgetxattr listxattr llistxattr)
+AC_CHECK_FUNCS(flistxattr removexattr lremovexattr fremovexattr)
+AC_CHECK_FUNCS(setxattr lsetxattr fsetxattr)
+AC_CHECK_FUNCS(attr_get attr_list attr_set attr_remove)
+AC_CHECK_FUNCS(attr_getf attr_listf attr_setf attr_removef)
+
+#################################################
+# check for ACL support
+
+AC_MSG_CHECKING(whether to support ACLs)
+AC_ARG_WITH(acl-support,
+[  --with-acl-support      Include ACL support (default=no)],
+[ case "$withval" in
+  yes)
+
+	case "$host_os" in
+	*sysv5*)
+		AC_MSG_RESULT(Using UnixWare ACLs)
+		AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
+		;;
+	*solaris*)
+		AC_MSG_RESULT(Using solaris ACLs)
+		AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
+		;;
+	*hpux*)
+		AC_MSG_RESULT(Using HPUX ACLs)
+		AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
+		;;
+	*irix*)
+		AC_MSG_RESULT(Using IRIX ACLs)
+		AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
+		;;
+	*aix*)
+		AC_MSG_RESULT(Using AIX ACLs)
+		AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
+		;;
+	*osf*)
+		AC_MSG_RESULT(Using Tru64 ACLs)
+		AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
+		ACL_LIBS="$ACL_LIBS -lpacl"
+		;;
+	*freebsd5*)
+		AC_MSG_RESULT(Using FreeBSD posix ACLs)
+		AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether FreeBSD POSIX ACLs are available])
+		AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
+		;;
+	*linux*)
+		AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
+       		AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
+		AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
+		acl_LIBS=$LIBS
+		LIBS="$LIBS -lacl"
+		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)
+		LIBS=$acl_LIBS])
+			if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
+				AC_MSG_RESULT(Using posix ACLs)
+				AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
+				AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
+				acl_LIBS=$LIBS
+				LIBS="$LIBS -lacl"
+				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)
+				LIBS=$acl_LIBS])
+				if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
+					AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
+				fi
+			fi
+            ;;
+         *)
+		AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
+		AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
+		acl_LIBS=$LIBS
+		LIBS="$LIBS -lacl"
+		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)
+		LIBS=$acl_LIBS])
+			if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
+				AC_MSG_RESULT(Using posix ACLs)
+				AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
+				AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
+				acl_LIBS=$LIBS
+				LIBS="$LIBS -lacl"
+				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)
+				LIBS=$acl_LIBS])
+				if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
+					AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
+				fi
+			fi
+            ;;
+        esac
+        ;;
+  *)
+    AC_MSG_RESULT(no)
+    AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
+    ;;
+  esac ],
+  AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
+  AC_MSG_RESULT(no)
+)

Modified: branches/SAMBA_4_0/source/include/includes.h
===================================================================
--- branches/SAMBA_4_0/source/include/includes.h	2004-09-24 03:34:55 UTC (rev 2581)
+++ branches/SAMBA_4_0/source/include/includes.h	2004-09-24 04:49:45 UTC (rev 2582)
@@ -1057,5 +1057,16 @@
 #define VXFS_QUOTA
 #endif
 
+#if HAVE_SYS_ATTRIBUTES_H
+#include <sys/attributes.h>
+#endif
+
+/* mutually exclusive (SuSE 8.2) */
+#if HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#elif HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+#endif
+
 #endif /* _INCLUDES_H */
 

Modified: branches/SAMBA_4_0/source/utils/getntacl.c
===================================================================
--- branches/SAMBA_4_0/source/utils/getntacl.c	2004-09-24 03:34:55 UTC (rev 2581)
+++ branches/SAMBA_4_0/source/utils/getntacl.c	2004-09-24 04:49:45 UTC (rev 2582)
@@ -21,8 +21,17 @@
 */
 
 #include "includes.h"
-#include <attr/xattr.h>
 
+#ifdef HAVE_NO_ACLS
+
+int main(int argc, char **argv)
+{
+	printf("ACL support not compiled in.");
+	return 1;
+}
+
+#else
+
 /* Display a security descriptor in "psec" format which is as follows.
 
    The first two lines describe the owner user and owner group of the
@@ -114,3 +123,5 @@
 	print_psec(data, &sd);
 	return 0;
 }
+
+#endif /* HAVE_NO_ACLS */

Modified: branches/SAMBA_4_0/source/utils/setntacl.c
===================================================================
--- branches/SAMBA_4_0/source/utils/setntacl.c	2004-09-24 03:34:55 UTC (rev 2581)
+++ branches/SAMBA_4_0/source/utils/setntacl.c	2004-09-24 04:49:45 UTC (rev 2582)
@@ -21,8 +21,17 @@
 */
 
 #include "includes.h"
-#include <attr/xattr.h>
 
+#ifdef HAVE_NO_ACLS
+
+int main(int argc, char **argv)
+{
+	printf("ACL support not compiled in.");
+	return 1;
+}
+
+#else
+
 static void setntacl(char *filename, struct security_descriptor *sd)
 {
 	NTSTATUS status;
@@ -103,3 +112,5 @@
 
 	return 0;
 }
+
+#endif /* HAVE_NO_ACLS */



More information about the samba-cvs mailing list