svn commit: samba r14382 - in branches/tmp/vl-posixacls/source: lib
modules smbd
vlendec at samba.org
vlendec at samba.org
Tue Mar 14 15:29:38 GMT 2006
Author: vlendec
Date: 2006-03-14 15:29:37 +0000 (Tue, 14 Mar 2006)
New Revision: 14382
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14382
Log:
By default redirect sys_acl_get_fd and friends to a fixed compile-time
module. This so far is only posixacl, but re-adding the other ones should now
be quite easy. (I hope...)
acl_valid was used only once, defer that to acl_set_fd and acl_set_file.
For the background: I want to enable Samba to cope with two different posix
apis at the same time. I do this by defining a common SMB_ACL_T structure that
is the same for all API variations, and it's the task of acl_get_file,
acl_get_fd, acl_set_file and acl_set_fd to cope with converting to the native
representation.
Jeremy, if you have time you might want to take a look.
This one is a lot less intrusive than the former attempt, although today
passing all the pure in-memory acl handling through the VFS layer is a bit
overkill I think. It is less intrusive because I've preserved the API towards
posix_acls.c based on the Solaris implementation.
Volker
Modified:
branches/tmp/vl-posixacls/source/lib/sysacls.c
branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c
branches/tmp/vl-posixacls/source/smbd/posix_acls.c
branches/tmp/vl-posixacls/source/smbd/vfs-wrap.c
Changeset:
Modified: branches/tmp/vl-posixacls/source/lib/sysacls.c
===================================================================
--- branches/tmp/vl-posixacls/source/lib/sysacls.c 2006-03-14 15:22:36 UTC (rev 14381)
+++ branches/tmp/vl-posixacls/source/lib/sysacls.c 2006-03-14 15:29:37 UTC (rev 14382)
@@ -347,34 +347,39 @@
return -1;
}
-SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
+/*
+ * acl_get_file, acl_get_fd, acl_set_file, acl_set_fd and
+ * sys_acl_delete_def_file are to be redirected to the default
+ * statically-bound acl vfs module, but they are replacable.
+ */
+
+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;
+ return posixacl_sys_acl_get_file(handle, conn, path_p, type);
}
-SMB_ACL_T sys_acl_get_fd(int fd)
+SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
{
- errno = ENOTSUP;
- return NULL;
+ return posixacl_sys_acl_get_fd(handle, fsp, fd);
}
-int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+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)
{
- errno = ENOTSUP;
- return -1;
+ return posixacl_sys_acl_set_file(handle, conn, name, type, acl_d);
}
-int sys_acl_set_fd(int fd, SMB_ACL_T acl_d)
+int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+ int fd, SMB_ACL_T acl_d)
{
- errno = ENOTSUP;
- return -1;
+ return posixacl_sys_acl_set_fd(handle, fsp, fd, acl_d);
}
-int sys_acl_delete_def_file(const char *path)
+int sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn,
+ const char *path)
{
- errno = ENOTSUP;
- return -1;
+ return posixacl_sys_acl_delete_def_file(handle, conn, path);
}
/************************************************************************
Modified: branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c
===================================================================
--- branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c 2006-03-14 15:22:36 UTC (rev 14381)
+++ branches/tmp/vl-posixacls/source/modules/vfs_posixacl.c 2006-03-14 15:29:37 UTC (rev 14382)
@@ -122,10 +122,10 @@
return result;
}
-static SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle,
- connection_struct *conn,
- const char *path_p,
- SMB_ACL_TYPE_T type)
+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;
@@ -154,9 +154,9 @@
return result;
}
-static SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
- files_struct *fsp,
- int fd)
+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);
@@ -287,19 +287,12 @@
return NULL;
}
-static int posixacl_sys_acl_valid(vfs_handle_struct *handle,
- connection_struct *conn,
- SMB_ACL_T theacl )
+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)
{
- return 0;
-}
-
-static 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;
@@ -329,9 +322,9 @@
return res;
}
-static int posixacl_sys_acl_set_fd(vfs_handle_struct *handle,
- files_struct *fsp,
- int fd, SMB_ACL_T theacl)
+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);
@@ -343,9 +336,9 @@
return res;
}
-static int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
- connection_struct *conn,
- const char *path)
+int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
+ connection_struct *conn,
+ const char *path)
{
return acl_delete_def_file(path);
}
@@ -370,10 +363,6 @@
SMB_VFS_OP_SYS_ACL_SET_FD,
SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(posixacl_sys_acl_valid),
- SMB_VFS_OP_SYS_ACL_VALID,
- SMB_VFS_LAYER_TRANSPARENT},
-
{SMB_VFS_OP(posixacl_sys_acl_delete_def_file),
SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
SMB_VFS_LAYER_TRANSPARENT},
Modified: branches/tmp/vl-posixacls/source/smbd/posix_acls.c
===================================================================
--- branches/tmp/vl-posixacls/source/smbd/posix_acls.c 2006-03-14 15:22:36 UTC (rev 14381)
+++ branches/tmp/vl-posixacls/source/smbd/posix_acls.c 2006-03-14 15:29:37 UTC (rev 14382)
@@ -2435,17 +2435,6 @@
}
/*
- * Check if the ACL is valid.
- */
-
- if (SMB_VFS_SYS_ACL_VALID(conn, the_acl) == -1) {
- DEBUG(0,("set_canon_ace_list: ACL type (%s) is invalid for set (%s).\n",
- the_acl_type == SMB_ACL_TYPE_DEFAULT ? "directory default" : "file",
- strerror(errno) ));
- goto fail;
- }
-
- /*
* Finally apply it to the file or directory.
*/
Modified: branches/tmp/vl-posixacls/source/smbd/vfs-wrap.c
===================================================================
--- branches/tmp/vl-posixacls/source/smbd/vfs-wrap.c 2006-03-14 15:22:36 UTC (rev 14381)
+++ branches/tmp/vl-posixacls/source/smbd/vfs-wrap.c 2006-03-14 15:29:37 UTC (rev 14382)
@@ -906,12 +906,12 @@
SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle, connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type)
{
- return sys_acl_get_file(path_p, type);
+ return sys_acl_get_file(handle, conn, path_p, type);
}
SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd)
{
- return sys_acl_get_fd(fd);
+ return sys_acl_get_fd(handle, fsp, fd);
}
int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset)
@@ -961,17 +961,17 @@
int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
{
- return sys_acl_set_file(name, acltype, theacl);
+ return sys_acl_set_file(handle, conn, name, acltype, theacl);
}
int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
{
- return sys_acl_set_fd(fd, theacl);
+ return sys_acl_set_fd(handle, fsp, fd, theacl);
}
int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, connection_struct *conn, const char *path)
{
- return sys_acl_delete_def_file(path);
+ return sys_acl_delete_def_file(handle, conn, path);
}
int vfswrap_sys_acl_get_perm(vfs_handle_struct *handle, connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
More information about the samba-cvs
mailing list