svn commit: samba r15125 - in branches/tmp/vl-posixacls/source: .
lib modules
vlendec at samba.org
vlendec at samba.org
Tue Apr 18 15:08:49 GMT 2006
Author: vlendec
Date: 2006-04-18 15:08:48 +0000 (Tue, 18 Apr 2006)
New Revision: 15125
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15125
Log:
Add skeleton modules for the remaining acl types
Modified:
branches/tmp/vl-posixacls/source/Makefile.in
branches/tmp/vl-posixacls/source/configure.in
branches/tmp/vl-posixacls/source/lib/sysacls.c
branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c
Changeset:
Modified: branches/tmp/vl-posixacls/source/Makefile.in
===================================================================
--- branches/tmp/vl-posixacls/source/Makefile.in 2006-04-18 14:30:05 UTC (rev 15124)
+++ branches/tmp/vl-posixacls/source/Makefile.in 2006-04-18 15:08:48 UTC (rev 15125)
@@ -374,6 +374,10 @@
VFS_AFSACL_OBJ = modules/vfs_afsacl.o
VFS_POSIXACL_OBJ = modules/vfs_posixacl.o
VFS_AIXACL_OBJ = modules/vfs_aixacl.o
+VFS_SOLARISACL_OBJ = modules/vfs_solarisacl.o
+VFS_HPUXACL_OBJ = modules/vfs_hpuxacl.o
+VFS_IRIXACL_OBJ = modules/vfs_irixacl.o
+VFS_TRU64ACL_OBJ = modules/vfs_tru64acl.o
VFS_CATIA_OBJ = modules/vfs_catia.o
PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
Modified: branches/tmp/vl-posixacls/source/configure.in
===================================================================
--- branches/tmp/vl-posixacls/source/configure.in 2006-04-18 14:30:05 UTC (rev 15124)
+++ branches/tmp/vl-posixacls/source/configure.in 2006-04-18 15:08:48 UTC (rev 15125)
@@ -4653,19 +4653,23 @@
*sysv5*)
AC_MSG_RESULT(Using UnixWare ACLs)
AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
+ default_static_modules="$default_static_modules vfs_solarisacl"
;;
*solaris*)
AC_MSG_RESULT(Using solaris ACLs)
AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
ACL_LIBS="$ACL_LIBS -lsec"
+ default_static_modules="$default_static_modules vfs_solarisacl"
;;
*hpux*)
AC_MSG_RESULT(Using HPUX ACLs)
AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
+ default_static_modules="$default_static_modules vfs_hpuxacl"
;;
*irix*)
AC_MSG_RESULT(Using IRIX ACLs)
AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
+ default_static_modules="$default_static_modules vfs_irixacl"
;;
*aix*)
AC_MSG_RESULT(Using AIX ACLs)
@@ -4676,6 +4680,7 @@
AC_MSG_RESULT(Using Tru64 ACLs)
AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
ACL_LIBS="$ACL_LIBS -lpacl"
+ default_static_modules="$default_static_modules vfs_tru64acl"
;;
*freebsd[[5-9]]*)
AC_MSG_RESULT(Using FreeBSD posix ACLs)
@@ -5440,6 +5445,10 @@
SMB_MODULE(vfs_afsacl, \$(VFS_AFSACL_OBJ), "bin/afsacl.$SHLIBEXT", VFS)
SMB_MODULE(vfs_posixacl, \$(VFS_POSIXACL_OBJ), "bin/posixacl.$SHLIBEXT", VFS)
SMB_MODULE(vfs_aixacl, \$(VFS_AIXACL_OBJ), "bin/aixacl.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_solarisacl, \$(VFS_SOLARISACL_OBJ), "bin/solarisacl.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_irixacl, \$(VFS_IRIXACL_OBJ), "bin/irixacl.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_hpuxacl, \$(VFS_HPUXACL_OBJ), "bin/hpuxacl.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_tru64acl, \$(VFS_TRU64ACL_OBJ), "bin/tru64acl.$SHLIBEXT", VFS)
SMB_MODULE(vfs_catia, \$(VFS_CATIA_OBJ), "bin/catia.$SHLIBEXT", VFS)
SMB_SUBSYSTEM(VFS,smbd/vfs.o)
Modified: branches/tmp/vl-posixacls/source/lib/sysacls.c
===================================================================
--- branches/tmp/vl-posixacls/source/lib/sysacls.c 2006-04-18 14:30:05 UTC (rev 15124)
+++ branches/tmp/vl-posixacls/source/lib/sysacls.c 2006-04-18 15:08:48 UTC (rev 15125)
@@ -2,6 +2,8 @@
Unix SMB/CIFS implementation.
Samba system utilities for ACL support.
Copyright (C) Jeremy Allison 2000.
+ Copyright (C) Volker Lendecke 2006
+ Copyright (C) Michael Adam 2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -415,11 +417,135 @@
return aixacl_sys_acl_delete_def_file(handle, conn, path);
}
-#else
+#elif defined(HAVE_TRU64_ACLS)
SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn,
const char *path_p, SMB_ACL_TYPE_T type)
{
+ return tru64acl_sys_acl_get_file(handle, conn, path_p, type);
+}
+
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+{
+ return tru64acl_sys_acl_get_fd(handle, fsp, fd);
+}
+
+int sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+{
+ return tru64acl_sys_acl_set_file(handle, conn, name, type, acl_d);
+}
+
+int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+ int fd, SMB_ACL_T acl_d)
+{
+ return tru64acl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+}
+
+int sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path)
+{
+ return tru64acl_sys_acl_delete_def_file(handle, conn, path);
+}
+
+#elif defined(HAVE_SOLARIS_ACLS) || defined(HAVE_UNIXWARE_ACLS)
+
+SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path_p, SMB_ACL_TYPE_T type)
+{
+ return solarisacl_sys_acl_get_file(handle, conn, path_p, type);
+}
+
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+{
+ return solarisacl_sys_acl_get_fd(handle, fsp, fd);
+}
+
+int sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+{
+ return solarisacl_sys_acl_set_file(handle, conn, name, type, acl_d);
+}
+
+int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+ int fd, SMB_ACL_T acl_d)
+{
+ return solarisacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+}
+
+int sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path)
+{
+ return solarisacl_sys_acl_delete_def_file(handle, conn, path);
+}
+
+#elif defined(HAVE_HPUX_ACLS)
+
+SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path_p, SMB_ACL_TYPE_T type)
+{
+ return hpuxacl_sys_acl_get_file(handle, conn, path_p, type);
+}
+
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+{
+ return hpuxacl_sys_acl_get_fd(handle, fsp, fd);
+}
+
+int sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+{
+ return hpuxacl_sys_acl_set_file(handle, conn, name, type, acl_d);
+}
+
+int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+ int fd, SMB_ACL_T acl_d)
+{
+ return hpuxacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+}
+
+int sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path)
+{
+ return hpuxacl_sys_acl_delete_def_file(handle, conn, path);
+}
+
+#elif defined(HAVE_IRIX_ACLS)
+
+SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path_p, SMB_ACL_TYPE_T type)
+{
+ return irixacl_sys_acl_get_file(handle, conn, path_p, type);
+}
+
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
+{
+ return irixacl_sys_acl_get_fd(handle, fsp, fd);
+}
+
+int sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+{
+ return irixacl_sys_acl_set_file(handle, conn, name, type, acl_d);
+}
+
+int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+ int fd, SMB_ACL_T acl_d)
+{
+ return irixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
+}
+
+int sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path)
+{
+ return irixacl_sys_acl_delete_def_file(handle, conn, path);
+}
+
+#else /* No ACLs. */
+
+SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path_p, SMB_ACL_TYPE_T type)
+{
errno = ENOTSUP;
return NULL;
}
Modified: branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c
===================================================================
--- branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c 2006-04-18 14:30:05 UTC (rev 15124)
+++ branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c 2006-04-18 15:08:48 UTC (rev 15125)
@@ -20,7 +20,126 @@
#include "includes.h"
+
+/* prototypes for static functions first - for clarity */
+
static BOOL smb_ace_to_internal(acl_entry_t posix_ace,
+ struct smb_acl_entry *ace);
+static struct smb_acl_t *smb_acl_to_internal(acl_t acl);
+static int smb_acl_set_mode(acl_entry_t entry, SMB_ACL_PERM_T perm);
+static acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
+
+
+/* public functions - the api */
+
+SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
+ connection_struct *conn,
+ const char *path_p,
+ SMB_ACL_TYPE_T type)
+{
+ struct smb_acl_t *result;
+ acl_type_t acl_type;
+ acl_t acl;
+
+ switch(type) {
+ case SMB_ACL_TYPE_ACCESS:
+ acl_type = ACL_TYPE_ACCESS;
+ break;
+ case SMB_ACL_TYPE_DEFAULT:
+ acl_type = ACL_TYPE_DEFAULT;
+ break;
+ default:
+ errno = EINVAL;
+ return NULL;
+ }
+
+ acl = acl_get_file(path_p, acl_type);
+
+ if (acl == NULL) {
+ return NULL;
+ }
+
+ result = smb_acl_to_internal(acl);
+ acl_free(acl);
+ return result;
+}
+
+SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
+ files_struct *fsp,
+ int fd)
+{
+ struct smb_acl_t *result;
+ acl_t acl = acl_get_fd(fd);
+
+ if (acl == NULL) {
+ return NULL;
+ }
+
+ result = smb_acl_to_internal(acl);
+ acl_free(acl);
+ return result;
+}
+
+int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
+ connection_struct *conn,
+ const char *name,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T theacl)
+{
+ int res;
+ acl_type_t acl_type;
+ acl_t acl;
+
+ DEBUG(10, ("Calling acl_set_file: %s, %d\n", name, type));
+
+ switch(type) {
+ case SMB_ACL_TYPE_ACCESS:
+ acl_type = ACL_TYPE_ACCESS;
+ break;
+ case SMB_ACL_TYPE_DEFAULT:
+ acl_type = ACL_TYPE_DEFAULT;
+ break;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+ if ((acl = smb_acl_to_posix(theacl)) == NULL) {
+ return -1;
+ }
+ res = acl_set_file(name, acl_type, acl);
+ if (res != 0) {
+ DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno)));
+ }
+ acl_free(acl);
+ return res;
+}
+
+int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
+ files_struct *fsp,
+ int fd, SMB_ACL_T theacl)
+{
+ int res;
+ acl_t acl = smb_acl_to_posix(theacl);
+ if (acl == NULL) {
+ return -1;
+ }
+ res = acl_set_fd(fd, acl);
+ acl_free(acl);
+ return res;
+}
+
+int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
+ connection_struct *conn,
+ const char *path)
+{
+ return acl_delete_def_file(path);
+}
+
+
+/* private functions */
+
+static BOOL smb_ace_to_internal(acl_entry_t posix_ace,
struct smb_acl_entry *ace)
{
acl_tag_t tag;
@@ -122,54 +241,6 @@
return result;
}
-SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
- connection_struct *conn,
- const char *path_p,
- SMB_ACL_TYPE_T type)
-{
- struct smb_acl_t *result;
- acl_type_t acl_type;
- acl_t acl;
-
- switch(type) {
- case SMB_ACL_TYPE_ACCESS:
- acl_type = ACL_TYPE_ACCESS;
- break;
- case SMB_ACL_TYPE_DEFAULT:
- acl_type = ACL_TYPE_DEFAULT;
- break;
- default:
- errno = EINVAL;
- return NULL;
- }
-
- acl = acl_get_file(path_p, acl_type);
-
- if (acl == NULL) {
- return NULL;
- }
-
- result = smb_acl_to_internal(acl);
- acl_free(acl);
- return result;
-}
-
-SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp,
- int fd)
-{
- struct smb_acl_t *result;
- acl_t acl = acl_get_fd(fd);
-
- if (acl == NULL) {
- return NULL;
- }
-
- result = smb_acl_to_internal(acl);
- acl_free(acl);
- return result;
-}
-
static int smb_acl_set_mode(acl_entry_t entry, SMB_ACL_PERM_T perm)
{
int ret;
@@ -287,62 +358,6 @@
return NULL;
}
-int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
- connection_struct *conn,
- const char *name,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
-{
- int res;
- acl_type_t acl_type;
- acl_t acl;
-
- DEBUG(10, ("Calling acl_set_file: %s, %d\n", name, type));
-
- switch(type) {
- case SMB_ACL_TYPE_ACCESS:
- acl_type = ACL_TYPE_ACCESS;
- break;
- case SMB_ACL_TYPE_DEFAULT:
- acl_type = ACL_TYPE_DEFAULT;
- break;
- default:
- errno = EINVAL;
- return -1;
- }
-
- if ((acl = smb_acl_to_posix(theacl)) == NULL) {
- return -1;
- }
- res = acl_set_file(name, acl_type, acl);
- if (res != 0) {
- DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno)));
- }
- acl_free(acl);
- return res;
-}
-
-int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
- files_struct *fsp,
- int fd, SMB_ACL_T theacl)
-{
- int res;
- acl_t acl = smb_acl_to_posix(theacl);
- if (acl == NULL) {
- return -1;
- }
- res = acl_set_fd(fd, acl);
- acl_free(acl);
- return res;
-}
-
-int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
- connection_struct *conn,
- const char *path)
-{
- return acl_delete_def_file(path);
-}
-
/* VFS operations structure */
static vfs_op_tuple posixacl_op_tuples[] = {
More information about the samba-cvs
mailing list