summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-08-10 20:49:46 +0000
committerJeremy Allison <jra@samba.org>2001-08-10 20:49:46 +0000
commit41837701e4f67d2f8e5436714a7083cb2688abbb (patch)
tree1b5eb99bb68bae9b9cb2f700bfba780ddd69f19c
parent9675de08c4a38f0be670918b8222b73ca2ca4ab1 (diff)
downloadsamba-41837701e4f67d2f8e5436714a7083cb2688abbb.tar.gz
samba-41837701e4f67d2f8e5436714a7083cb2688abbb.tar.xz
samba-41837701e4f67d2f8e5436714a7083cb2688abbb.zip
Added Mike Davidsons Tru64 ACL patch.
Jeremy.
-rw-r--r--source/acconfig.h2
-rwxr-xr-xsource/configure6
-rw-r--r--source/configure.in4
-rw-r--r--source/include/config.h.in2
-rw-r--r--source/include/smb_acls.h4
-rw-r--r--source/lib/sysacls.c36
-rw-r--r--source/locking/locking.c28
7 files changed, 60 insertions, 22 deletions
diff --git a/source/acconfig.h b/source/acconfig.h
index a180c0c723d..d598b3a8991 100644
--- a/source/acconfig.h
+++ b/source/acconfig.h
@@ -148,7 +148,7 @@
#undef HAVE_SOLARIS_ACLS
#undef HAVE_IRIX_ACLS
#undef HAVE_AIX_ACLS
-#undef HAVE_DRAFT13_POSIX_ACLS
+#undef HAVE_TRU64_ACLS
#undef HAVE_NO_ACLS
#undef HAVE_LIBPAM
#undef HAVE_ASPRINTF_DECL
diff --git a/source/configure b/source/configure
index 1dc3f572b7d..de183a12479 100755
--- a/source/configure
+++ b/source/configure
@@ -1067,7 +1067,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-for ac_prog in mawk gawk nawk awk
+for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -12097,9 +12097,9 @@ EOF
;;
*osf*)
- echo "$ac_t""Using Draft 13 Posix ACLs" 1>&6
+ echo "$ac_t""Using Tru64 ACLs" 1>&6
cat >> confdefs.h <<\EOF
-#define HAVE_DRAFT13_POSIX_ACLS 1
+#define HAVE_TRU64_ACLS 1
EOF
LIBS="$LIBS -lpacl"
diff --git a/source/configure.in b/source/configure.in
index 7890783ad79..1c119defcaf 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -2251,8 +2251,8 @@ AC_ARG_WITH(acl-support,
AC_DEFINE(HAVE_AIX_ACLS)
;;
*osf*)
- AC_MSG_RESULT(Using Draft 13 Posix ACLs)
- AC_DEFINE(HAVE_DRAFT13_POSIX_ACLS)
+ AC_MSG_RESULT(Using Tru64 ACLs)
+ AC_DEFINE(HAVE_TRU64_ACLS)
LIBS="$LIBS -lpacl"
;;
*)
diff --git a/source/include/config.h.in b/source/include/config.h.in
index ddf79720795..bb8dada051e 100644
--- a/source/include/config.h.in
+++ b/source/include/config.h.in
@@ -211,7 +211,7 @@
#undef HAVE_SOLARIS_ACLS
#undef HAVE_IRIX_ACLS
#undef HAVE_AIX_ACLS
-#undef HAVE_DRAFT13_POSIX_ACLS
+#undef HAVE_TRU64_ACLS
#undef HAVE_NO_ACLS
#undef HAVE_LIBPAM
#undef HAVE_ASPRINTF_DECL
diff --git a/source/include/smb_acls.h b/source/include/smb_acls.h
index 4b282481ff3..37aa7cb65c2 100644
--- a/source/include/smb_acls.h
+++ b/source/include/smb_acls.h
@@ -54,9 +54,9 @@
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
-#elif defined(HAVE_DRAFT13_POSIX_ACLS)
+#elif defined(HAVE_TRU64_ACLS)
-/* This is for DEC OSF/1 */
+/* This is for DEC/Compaq Tru64 UNIX */
#define SMB_ACL_TAG_T acl_tag_t
#define SMB_ACL_TYPE_T acl_type_t
diff --git a/source/lib/sysacls.c b/source/lib/sysacls.c
index f151a772e07..0f488888a8f 100644
--- a/source/lib/sysacls.c
+++ b/source/lib/sysacls.c
@@ -191,8 +191,17 @@ int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype)
return acl_free(qual);
}
-#elif defined(HAVE_DRAFT13_POSIX_ACLS)
-
+#elif defined(HAVE_TRU64_ACLS)
+/*
+ * The interface to DEC/Compaq Tru64 UNIX ACLs
+ * is based on Draft 13 of the POSIX spec which is
+ * slightly different from the Draft 16 interface.
+ *
+ * Also, some of the permset manipulation functions
+ * such as acl_clear_perm() and acl_add_perm() appear
+ * to be broken on Tru64 so we have to manipulate
+ * the permission bits in the permset directly.
+ */
int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
{
SMB_ACL_ENTRY_T entry;
@@ -237,25 +246,26 @@ SMB_ACL_T sys_acl_get_fd(int fd)
int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset)
{
- return acl_clear_perm(permset);
+ *permset = 0; /* acl_clear_perm() is broken on Tru64 */
+
+ return 0;
}
int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
{
- return acl_add_perm(permset, perm);
+ if (perm & ~(SMB_ACL_READ | SMB_ACL_WRITE | SMB_ACL_EXECUTE)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ *permset |= perm; /* acl_add_perm() is broken on Tru64 */
+
+ return 0;
}
int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
{
-#if defined(HAVE_ACL_GET_PERM_NP)
- return acl_get_perm_np(permset, perm);
-#else
- /*
- * if we don't have an acl_get_perm() interface
- * this will probably work for most implementations
- */
- return *permset & perm;
-#endif
+ return *permset & perm; /* Tru64 doesn't have acl_get_perm() */
}
char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen)
diff --git a/source/locking/locking.c b/source/locking/locking.c
index ea9f8b48ba9..b6b563b4e5f 100644
--- a/source/locking/locking.c
+++ b/source/locking/locking.c
@@ -359,18 +359,35 @@ static TDB_DATA locking_key_fsp(files_struct *fsp)
return locking_key(fsp->dev, fsp->inode);
}
+#ifndef LOCK_SHARE_ENTRY_SPIN_COUNT
+#define LOCK_SHARE_ENTRY_SPIN_COUNT 100
+#endif
+
/*******************************************************************
Lock a hash bucket entry.
******************************************************************/
+
BOOL lock_share_entry(connection_struct *conn,
SMB_DEV_T dev, SMB_INO_T inode)
{
+#if 1 /* JRATEST */
+ int count = 0;
+ for (count = 0; count < LOCK_SHARE_ENTRY_SPIN_COUNT; count++)
+ if (tdb_chainlock(tdb, locking_key(dev, inode)) == 0)
+ return True;
+ else
+ DEBUG(0,("lock_share_entry: locking (%d) for dev = %x, inode = %.0f failed with error %s\n",
+ count, (unsigned int)dev, (double)inode, strerror(errno) ));
+ return False;
+#else
return tdb_chainlock(tdb, locking_key(dev, inode)) == 0;
+#endif
}
/*******************************************************************
Unlock a hash bucket entry.
******************************************************************/
+
void unlock_share_entry(connection_struct *conn,
SMB_DEV_T dev, SMB_INO_T inode)
{
@@ -383,7 +400,18 @@ void unlock_share_entry(connection_struct *conn,
******************************************************************/
BOOL lock_share_entry_fsp(files_struct *fsp)
{
+#if 1 /* JRATEST */
+ int count = 0;
+ for (count = 0; count < LOCK_SHARE_ENTRY_SPIN_COUNT; count++)
+ if (tdb_chainlock(tdb, locking_key(fsp->dev, fsp->inode)) == 0)
+ return True;
+ else
+ DEBUG(0,("lock_share_entry_fsp: locking (%d) for dev = %x, inode = %.0f failed with error %s\n",
+ count, (unsigned int)fsp->dev, (double)fsp->inode, strerror(errno) ));
+ return False;
+#else
return tdb_chainlock(tdb, locking_key(fsp->dev, fsp->inode)) == 0;
+#endif
}
/*******************************************************************