svn commit: samba r22777 - in branches: SAMBA_3_0/source	SAMBA_3_0/source/modules SAMBA_3_0_25/source	SAMBA_3_0_25/source/modules SAMBA_3_0_26/source	SAMBA_3_0_26/source/modules Author: obnox
Date: 2007-05-10 13:31:15 +0000 (Thu, 10 May 2007)
New Revision: 22777

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22777

Log:
Fix for [Bug 4543] - POSIX ACL support on FreeBSD.

This adds vfs_posixacl to the list of static modules and
makes use of HAVE_ACL_GET_PERM_NP.

This is just a quick fix. FreeBSD acl support is still
hardcoded in configure.in, but actually this could be
detected in a unified test for freebsd, linux, *,
as suggested in the bugreport. This has still to be
checked and elaborated.

Michael


Modified:
   branches/SAMBA_3_0/source/configure.in
   branches/SAMBA_3_0/source/modules/vfs_posixacl.c
   branches/SAMBA_3_0_25/source/configure.in
   branches/SAMBA_3_0_25/source/modules/vfs_posixacl.c
   branches/SAMBA_3_0_26/source/configure.in
   branches/SAMBA_3_0_26/source/modules/vfs_posixacl.c


Changeset:
Modified: branches/SAMBA_3_0/source/configure.in
===================================================================
--- branches/SAMBA_3_0/source/configure.in	2007-05-10 12:41:20 UTC (rev 22776)
+++ branches/SAMBA_3_0/source/configure.in	2007-05-10 13:31:15 UTC (rev 22777)
@@ -5303,6 +5303,7 @@
 		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])
+		default_static_modules="$default_static_modules vfs_posixacl"
 		;;
 	*linux*)
 		AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])

Modified: branches/SAMBA_3_0/source/modules/vfs_posixacl.c
===================================================================
--- branches/SAMBA_3_0/source/modules/vfs_posixacl.c	2007-05-10 12:41:20 UTC (rev 22776)
+++ branches/SAMBA_3_0/source/modules/vfs_posixacl.c	2007-05-10 13:31:15 UTC (rev 22777)
@@ -200,9 +200,15 @@
 		return False;
 	}
 	ace->a_perm = 0;
+#ifdef HAVE_ACL_GET_PERM_NP
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_READ) ? SMB_ACL_READ : 0);
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_WRITE) ? SMB_ACL_WRITE : 0);
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
+#else
 	ace->a_perm |= (acl_get_perm(permset, ACL_READ) ? SMB_ACL_READ : 0);
 	ace->a_perm |= (acl_get_perm(permset, ACL_WRITE) ? SMB_ACL_WRITE : 0);
 	ace->a_perm |= (acl_get_perm(permset, ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
+#endif
 	return True;
 }
 

Modified: branches/SAMBA_3_0_25/source/configure.in
===================================================================
--- branches/SAMBA_3_0_25/source/configure.in	2007-05-10 12:41:20 UTC (rev 22776)
+++ branches/SAMBA_3_0_25/source/configure.in	2007-05-10 13:31:15 UTC (rev 22777)
@@ -5140,6 +5140,7 @@
 		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])
+		default_static_modules="$default_static_modules vfs_posixacl"
 		;;
 	*linux*)
 		AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])

Modified: branches/SAMBA_3_0_25/source/modules/vfs_posixacl.c
===================================================================
--- branches/SAMBA_3_0_25/source/modules/vfs_posixacl.c	2007-05-10 12:41:20 UTC (rev 22776)
+++ branches/SAMBA_3_0_25/source/modules/vfs_posixacl.c	2007-05-10 13:31:15 UTC (rev 22777)
@@ -200,9 +200,15 @@
 		return False;
 	}
 	ace->a_perm = 0;
+#ifdef HAVE_ACL_GET_PERM_NP
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_READ) ? SMB_ACL_READ : 0);
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_WRITE) ? SMB_ACL_WRITE : 0);
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
+#else
 	ace->a_perm |= (acl_get_perm(permset, ACL_READ) ? SMB_ACL_READ : 0);
 	ace->a_perm |= (acl_get_perm(permset, ACL_WRITE) ? SMB_ACL_WRITE : 0);
 	ace->a_perm |= (acl_get_perm(permset, ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
+#endif
 	return True;
 }
 

Modified: branches/SAMBA_3_0_26/source/configure.in
===================================================================
--- branches/SAMBA_3_0_26/source/configure.in	2007-05-10 12:41:20 UTC (rev 22776)
+++ branches/SAMBA_3_0_26/source/configure.in	2007-05-10 13:31:15 UTC (rev 22777)
@@ -5140,6 +5140,7 @@
 		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])
+		default_static_modules="$default_static_modules vfs_posixacl"
 		;;
 	*linux*)
 		AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])

Modified: branches/SAMBA_3_0_26/source/modules/vfs_posixacl.c
===================================================================
--- branches/SAMBA_3_0_26/source/modules/vfs_posixacl.c	2007-05-10 12:41:20 UTC (rev 22776)
+++ branches/SAMBA_3_0_26/source/modules/vfs_posixacl.c	2007-05-10 13:31:15 UTC (rev 22777)
@@ -200,9 +200,15 @@
 		return False;
 	}
 	ace->a_perm = 0;
+#ifdef HAVE_ACL_GET_PERM_NP
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_READ) ? SMB_ACL_READ : 0);
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_WRITE) ? SMB_ACL_WRITE : 0);
+	ace->a_perm |= (acl_get_perm_np(permset, ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
+#else
 	ace->a_perm |= (acl_get_perm(permset, ACL_READ) ? SMB_ACL_READ : 0);
 	ace->a_perm |= (acl_get_perm(permset, ACL_WRITE) ? SMB_ACL_WRITE : 0);
 	ace->a_perm |= (acl_get_perm(permset, ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
+#endif
 	return True;
 }
 

