* posix remove acl support
@ 2013-11-21 5:04 Steve French
[not found] ` <CAH2r5mvcidQk7C47ZSFLPZ0yaU2yzzAabWDK2f19VMxBi3NzTg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2013-11-21 5:04 UTC (permalink / raw)
To: Jeremy Allison
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
samba-technical
[-- Attachment #1: Type: text/plain, Size: 1833 bytes --]
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,
--
Thanks,
Steve
[-- Attachment #2: posix-acl-remove-support.patch --]
[-- Type: text/x-patch, Size: 1488 bytes --]
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,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: posix remove acl support
[not found] ` <CAH2r5mvcidQk7C47ZSFLPZ0yaU2yzzAabWDK2f19VMxBi3NzTg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-11-21 5:16 ` Jeremy Allison
2013-11-21 5:35 ` Steve French
0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Allison @ 2013-11-21 5:16 UTC (permalink / raw)
To: Steve French
Cc: Jeremy Allison,
linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
samba-technical
On Wed, Nov 20, 2013 at 11:04:57PM -0600, Steve French wrote:
> 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?
Yep, sending a zero size for the number of ACE entries
will delete the ACL on the Samba server side.
I don't have the capability to test your patch right now
though, but you should be able to test it against any
modern Samba server installation.
Jeremy.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: posix remove acl support
2013-11-21 5:16 ` Jeremy Allison
@ 2013-11-21 5:35 ` Steve French
0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2013-11-21 5:35 UTC (permalink / raw)
To: Jeremy Allison
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
samba-technical
On Wed, Nov 20, 2013 at 11:16 PM, Jeremy Allison <jra-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org> wrote:
> On Wed, Nov 20, 2013 at 11:04:57PM -0600, Steve French wrote:
>> 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?
>
> Yep, sending a zero size for the number of ACE entries
> will delete the ACL on the Samba server side.
>
> I don't have the capability to test your patch right now
> though, but you should be able to test it against any
> modern Samba server installation.
Looks fine so far (with the exception of the on the wire formatting
problem in one case above - which samba seems ok with or wireshark has
a bug - need to check tomorrow)
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-21 5:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 5:04 posix remove acl support Steve French
[not found] ` <CAH2r5mvcidQk7C47ZSFLPZ0yaU2yzzAabWDK2f19VMxBi3NzTg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-21 5:16 ` Jeremy Allison
2013-11-21 5:35 ` Steve French
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.