Linux CIFS filesystem development
 help / color / mirror / Atom feed
* setfacl fix
@ 2013-11-16  2:53 Steve French
       [not found] ` <CAH2r5msswZg_NvY9qMNknh2FWht1jMgwW1s2umtaBj3mHreDAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Steve French @ 2013-11-16  2:53 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	samba-technical

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

From: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Fri, 15 Nov 2013 20:41:32 -0600
Subject: [PATCH] [CIFS] setfacl removes part of ACL when setting POSIX ACLs to
 Samba

setfacl over cifs mounts can remove the default ACL when setting the
(non-default part of) the ACL and vice versa (we were leaving at 0
rather than setting to -1 the count field for the unaffected
half of the ACL.  For example notice the setfacl removed
the default ACL in this sequence:

steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir ; setfacl
-m default:user:test:rwx,user:test:rwx /mnt/test-dir
getfacl: Removing leading '/' from absolute path names
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:test:rwx
default:group::r-x
default:mask::rwx
default:other::r-x

steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir
getfacl: Removing leading '/' from absolute path names
user::rwx
user:test:rwx
group::r-x
mask::rwx
other::r-x

CC: Stable <stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Jeremy Allison <jra-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
---
 fs/cifs/cifssmb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 93b2947..124aa02 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3369,11 +3369,13 @@ static __u16 ACL_to_cifs_posix(char
*parm_data, const char *pACL,
         return 0;
     }
     cifs_acl->version = cpu_to_le16(1);
-    if (acl_type == ACL_TYPE_ACCESS)
+    if (acl_type == ACL_TYPE_ACCESS) {
         cifs_acl->access_entry_count = cpu_to_le16(count);
-    else if (acl_type == ACL_TYPE_DEFAULT)
+        cifs_acl->default_entry_count = __constant_cpu_to_le16(0xFFFF);
+    } else if (acl_type == ACL_TYPE_DEFAULT) {
         cifs_acl->default_entry_count = cpu_to_le16(count);
-    else {
+        cifs_acl->access_entry_count = __constant_cpu_to_le16(0xFFFF);
+    } else {
         cifs_dbg(FYI, "unknown ACL type %d\n", acl_type);
         return 0;
     }
-- 
1.8.3.1


-- 
Thanks,

Steve

[-- Attachment #2: 0001-CIFS-setfacl-removes-part-of-ACL-when-setting-POSIX-.patch --]
[-- Type: text/x-patch, Size: 1988 bytes --]

From 5e8b4b2934093b1e8ec6e8ef30f110cd57e0dbdf Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
Date: Fri, 15 Nov 2013 20:41:32 -0600
Subject: [PATCH] [CIFS] setfacl removes part of ACL when setting POSIX ACLs to
 Samba

setfacl over cifs mounts can remove the default ACL when setting the
(non-default part of) the ACL and vice versa (we were leaving at 0
rather than setting to -1 the count field for the unaffected
half of the ACL.  For example notice the setfacl removed
the default ACL in this sequence:

steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir ; setfacl
-m default:user:test:rwx,user:test:rwx /mnt/test-dir
getfacl: Removing leading '/' from absolute path names
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:test:rwx
default:group::r-x
default:mask::rwx
default:other::r-x

steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir
getfacl: Removing leading '/' from absolute path names
user::rwx
user:test:rwx
group::r-x
mask::rwx
other::r-x

CC: Stable <stable@kernel.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Acked-by: Jeremy Allison <jra@samba.org>
---
 fs/cifs/cifssmb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 93b2947..124aa02 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3369,11 +3369,13 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
 		return 0;
 	}
 	cifs_acl->version = cpu_to_le16(1);
-	if (acl_type == ACL_TYPE_ACCESS)
+	if (acl_type == ACL_TYPE_ACCESS) {
 		cifs_acl->access_entry_count = cpu_to_le16(count);
-	else if (acl_type == ACL_TYPE_DEFAULT)
+		cifs_acl->default_entry_count = __constant_cpu_to_le16(0xFFFF);
+	} else if (acl_type == ACL_TYPE_DEFAULT) {
 		cifs_acl->default_entry_count = cpu_to_le16(count);
-	else {
+		cifs_acl->access_entry_count = __constant_cpu_to_le16(0xFFFF);
+	} else {
 		cifs_dbg(FYI, "unknown ACL type %d\n", acl_type);
 		return 0;
 	}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-11-20  5:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-16  2:53 setfacl fix Steve French
     [not found] ` <CAH2r5msswZg_NvY9qMNknh2FWht1jMgwW1s2umtaBj3mHreDAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-16  4:55   ` Jeremy Allison
2013-11-16 14:55   ` Christoph Hellwig
2013-11-16 15:15     ` steve
     [not found]       ` <1384614925.3216.6.camel-HkULYb+WTT7YCGPCin2YbQ@public.gmane.org>
2013-11-16 21:55         ` Steve French
     [not found]           ` <CAH2r5mvHzVXs4zuWZvL8ppBzaXSQHOykwu2Gdky3=ZQ9ZbPZcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-18  8:05             ` AW: " Parzer, Peter
     [not found]     ` <20131116145507.GA22395-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-11-16 21:38       ` Steve French
     [not found]         ` <CAH2r5mtXjnAOpKzZzta_yWDGyEPzR7h1wb0UW2pnoicm9Qsgxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-18 15:27           ` Christoph Hellwig
     [not found]             ` <20131118152723.GA19649-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-11-18 22:44               ` Dave Chinner
2013-11-20  5:19             ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox