
From jedgar@fxp.org Thu Apr 12 23:41:26 2001
Date: Thu, 12 Apr 2001 22:10:12 -0400
From: Chris Faulhaber <jedgar@fxp.org>
To: Robert Watson <rwatson@FreeBSD.org>
Subject: Samba/ACL diffs

See attached...

- acl_get_perm_np.diff: patches src/sys/sys/acl.h and
  src/lib/libc/posix1e/acl_get.c
- samba.acl.diff: patches acconfig.h, configure.in,
  include/config.h.in, lib/sysacls.c; run autoconf prior
  to './configure --with-acl-support'

-- 
Chris D. Faulhaber - jedgar@fxp.org - jedgar@FreeBSD.org
--------------------------------------------------------
FreeBSD: The Power To Serve   -   http://www.FreeBSD.org

  [ Part 1.2: "Attached Text" ]

Index: acconfig.h
===================================================================
RCS file: /cvsroot/samba/source/acconfig.h,v
retrieving revision 1.44.4.9
diff -u -r1.44.4.9 acconfig.h
--- acconfig.h	2001/04/03 00:34:36	1.44.4.9
+++ acconfig.h	2001/04/10 00:53:42
@@ -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
Index: configure.in
===================================================================
RCS file: /cvsroot/samba/source/configure.in,v
retrieving revision 1.130.4.23
diff -u -r1.130.4.23 configure.in
--- configure.in	2001/04/06 18:31:20	1.130.4.23
+++ configure.in	2001/04/10 00:53:59
@@ -2059,6 +2059,14 @@
 			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_COMPILE([#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>
Index: include/config.h.in
===================================================================
RCS file: /cvsroot/samba/source/include/config.h.in,v
retrieving revision 1.83.4.11
diff -u -r1.83.4.11 config.h.in
--- include/config.h.in	2001/04/03 00:34:41	1.83.4.11
+++ include/config.h.in	2001/04/10 00:54:01
@@ -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
Index: lib/sysacls.c
===================================================================
RCS file: /cvsroot/samba/source/lib/sysacls.c,v
retrieving revision 1.8.2.11
diff -u -r1.8.2.11 sysacls.c
--- lib/sysacls.c	2001/04/05 20:52:04	1.8.2.11
+++ lib/sysacls.c	2001/04/10 00:54:03
@@ -112,7 +112,16 @@
 
 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)

  [ Part 1.3: "Attached Text" ]

Index: lib/libc/posix1e/acl_get.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/posix1e/acl_get.c,v
retrieving revision 1.7
diff -u -r1.7 acl_get.c
--- lib/libc/posix1e/acl_get.c	2001/04/04 18:00:51	1.7
+++ lib/libc/posix1e/acl_get.c	2001/04/13 02:07:40
@@ -104,6 +104,12 @@
 }
 
 int
+acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
+{
+	return *permset_d & perm;
+}
+
+int
 acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p)
 {
 
Index: sys/sys/acl.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/acl.h,v
retrieving revision 1.15
diff -u -r1.15 acl.h
--- sys/sys/acl.h	2001/04/11 02:19:01	1.15
+++ sys/sys/acl.h	2001/04/13 02:07:40
@@ -93,6 +93,9 @@
 #define	ACL_PERM_BITS		(ACL_EXECUTE | ACL_WRITE | ACL_READ)
 #define	ACL_POSIX1E_BITS	(ACL_EXECUTE | ACL_WRITE | ACL_READ)
 
+#define	ACL_FIRST_ENTRY		1
+#define	ACL_NEXT_ENTRY		2
+
 #ifdef _KERNEL
 
 /*
@@ -154,6 +157,7 @@
 acl_t	acl_get_fd_np(int fd, acl_type_t _type);
 acl_t	acl_get_file(const char *_path_p, acl_type_t _type);
 void	*acl_get_qualifier(acl_entry_t _entry_d);
+int	acl_get_perm_np(acl_permset_t _permset_d, acl_perm_t _perm);
 int	acl_get_permset(acl_entry_t _entry_d, acl_permset_t *_permset_p);
 int	acl_get_tag_type(acl_entry_t _entry_d, acl_tag_t *_tag_type_p);
 acl_t	acl_init(int _count);

  [Part 2, Application/PGP-SIGNATURE  240bytes]
  [Unable to print this part]

