summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-07-12 18:49:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:28:35 -0500
commit79a9f6dcb86703fd48d1321e50ff2b678ce39664 (patch)
treea651c9d1aa065d06cf7663d5417add998d887186 /source3
parent967b22827ff51d2f546931206cdb4a876f345820 (diff)
downloadsamba-79a9f6dcb86703fd48d1321e50ff2b678ce39664.tar.gz
samba-79a9f6dcb86703fd48d1321e50ff2b678ce39664.tar.bz2
samba-79a9f6dcb86703fd48d1321e50ff2b678ce39664.zip
r23856: Add Jiri.Sasek@Sun.COM;s fix from Axel Apitz for ZFS ACLs.
Jeremy. (This used to be commit 6ba12b6cb9f69297731c73071b627e8d7fbc6d73)
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_zfsacl.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 18904cd819..9217d4c8bc 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -4,6 +4,9 @@
* Copyright (C) Jiri Sasek, 2007
* based on the foobar.c module which is copyrighted by Volker Lendecke
*
+ * Many thanks to Axel Apitz for help to fix the special ace's handling
+ * issues.
+ *
* 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
* the Free Software Foundation; either version 3 of the License, or
@@ -71,7 +74,19 @@ static size_t zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info,
aceprop.aceFlags = (uint32) acebuf[i].a_flags;
aceprop.aceMask = (uint32) acebuf[i].a_access_mask;
aceprop.who.id = (uint32) acebuf[i].a_who;
- aceprop.flags = 0;
+
+ if(aceprop.aceFlags & ACE_OWNER) {
+ aceprop.flags = SMB_ACE4_ID_SPECIAL;
+ aceprop.who.special_id = SMB_ACE4_WHO_OWNER;
+ } else if(aceprop.aceFlags & ACE_GROUP) {
+ aceprop.flags = SMB_ACE4_ID_SPECIAL;
+ aceprop.who.special_id = SMB_ACE4_WHO_GROUP;
+ } else if(aceprop.aceFlags & ACE_EVERYONE) {
+ aceprop.flags = SMB_ACE4_ID_SPECIAL;
+ aceprop.who.special_id = SMB_ACE4_WHO_EVERYONE;
+ } else {
+ aceprop.flags = 0;
+ }
if(smb_add_ace4(pacl, &aceprop) == NULL) return 0;
}
@@ -103,6 +118,23 @@ static BOOL zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
acebuf[i].a_flags = aceprop->aceFlags;
acebuf[i].a_access_mask = aceprop->aceMask;
acebuf[i].a_who = aceprop->who.id;
+ if(aceprop->flags & SMB_ACE4_ID_SPECIAL) {
+ switch(aceprop->who.special_id) {
+ case SMB_ACE4_WHO_EVERYONE:
+ acebuf[i].a_flags |= ACE_EVERYONE;
+ break;
+ case SMB_ACE4_WHO_OWNER:
+ acebuf[i].a_flags |= ACE_OWNER;
+ break;
+ case SMB_ACE4_WHO_GROUP:
+ acebuf[i].a_flags |= ACE_GROUP;
+ break;
+ default:
+ DEBUG(8, ("unsupported special_id %d\n", \
+ aceprop->who.special_id));
+ continue; /* don't add it !!! */
+ }
+ }
}
SMB_ASSERT(i == naces);
@@ -178,8 +210,23 @@ static vfs_op_tuple zfsacl_ops[] = {
{SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
};
+/* != 0 if this module will be compiled as static */
+
+#define STATIC 0
+
+#if STATIC
NTSTATUS vfs_zfsacl_init(void);
-NTSTATUS vfs_zfsacl_init(void)
+#else
+NTSTATUS init_module(void);
+#endif
+
+NTSTATUS
+#if STATIC
+ vfs_zfsacl_init
+#else
+ init_module
+#endif
+ (void)
{
return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "zfsacl",
zfsacl_ops);