Steve French
2013-11-21 05:04:57 UTC
Jeremy,
As you noted we need to add support to cifs kernel client to remove POSIX ACLs.
This patch is close (it seems to work, but wireshark did not like the
buffer lengths when I did a setfacl -k although setacl -b looked fine.
It works basically by passing the minimum size in for the ACL (0
entries) - sending a zero in the number of ACEs removes the entry.
Comments/feedback?
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 09afda4..c301651 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -69,6 +69,33 @@ int cifs_removexattr(struct dentry *direntry, const
char *ea_name)
}
if (ea_name == NULL) {
cifs_dbg(FYI, "Null xattr names not supported\n");
+
+#ifdef CONFIG_CIFS_POSIX
+ } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
+ strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
+ if (sb->s_flags & MS_POSIXACL) {
+ posix_acl_xattr_header acl;
+ acl.a_version = cpu_to_le32(2);
+ rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
+ (const char *)&acl,
+ 4 /* min struct posix_acl_xattr_header */,
+ ACL_TYPE_ACCESS, cifs_sb->local_nls,
+ cifs_sb->mnt_cifs_flags &
+ CIFS_MOUNT_MAP_SPECIAL_CHR);
+ cifs_dbg(VFS, "set POSIX ACL rc %d\n", rc); /* BB FIXME BB */
+ }
+ } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
+ strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
+ if (sb->s_flags & MS_POSIXACL) {
+ posix_acl_xattr_header acl;
+ acl.a_version = cpu_to_le32(2);
+ rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
+ (const char *)&acl, 4, ACL_TYPE_DEFAULT,
+ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
+ CIFS_MOUNT_MAP_SPECIAL_CHR);
+ cifs_dbg(VFS, "set POSIX default ACL rc %d\n", rc); /* BB FIXME BB */
+ }
+#endif /* CONFIG_CIFS_POSIX */
} else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
&& (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))) {
cifs_dbg(FYI,
As you noted we need to add support to cifs kernel client to remove POSIX ACLs.
This patch is close (it seems to work, but wireshark did not like the
buffer lengths when I did a setfacl -k although setacl -b looked fine.
It works basically by passing the minimum size in for the ACL (0
entries) - sending a zero in the number of ACEs removes the entry.
Comments/feedback?
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 09afda4..c301651 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -69,6 +69,33 @@ int cifs_removexattr(struct dentry *direntry, const
char *ea_name)
}
if (ea_name == NULL) {
cifs_dbg(FYI, "Null xattr names not supported\n");
+
+#ifdef CONFIG_CIFS_POSIX
+ } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS,
+ strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
+ if (sb->s_flags & MS_POSIXACL) {
+ posix_acl_xattr_header acl;
+ acl.a_version = cpu_to_le32(2);
+ rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
+ (const char *)&acl,
+ 4 /* min struct posix_acl_xattr_header */,
+ ACL_TYPE_ACCESS, cifs_sb->local_nls,
+ cifs_sb->mnt_cifs_flags &
+ CIFS_MOUNT_MAP_SPECIAL_CHR);
+ cifs_dbg(VFS, "set POSIX ACL rc %d\n", rc); /* BB FIXME BB */
+ }
+ } else if (strncmp(ea_name, POSIX_ACL_XATTR_DEFAULT,
+ strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
+ if (sb->s_flags & MS_POSIXACL) {
+ posix_acl_xattr_header acl;
+ acl.a_version = cpu_to_le32(2);
+ rc = CIFSSMBSetPosixACL(xid, pTcon, full_path,
+ (const char *)&acl, 4, ACL_TYPE_DEFAULT,
+ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
+ CIFS_MOUNT_MAP_SPECIAL_CHR);
+ cifs_dbg(VFS, "set POSIX default ACL rc %d\n", rc); /* BB FIXME BB */
+ }
+#endif /* CONFIG_CIFS_POSIX */
} else if (strncmp(ea_name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)
&& (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))) {
cifs_dbg(FYI,
--
Thanks,
Steve
Thanks,
Steve