aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2018-08-10 19:46:58 -0400
committerSteve French <stfrench@microsoft.com>2018-08-10 19:46:58 -0400
commitc4f7173ac3b7e22934e51f0121833642a581d723 (patch)
tree7fc9e232e33e45e24192277ae12d01ee5a17e3c3
parentcdeaf9d04a5a0f51220d2f025385c553220bfb5c (diff)
smb3: create smb3 equivalent alias for cifs pseudo-xattrs
We really, really don't want to be encouraging people to use cifs (the dialect) since it is insecure, so to avoid confusion we want to move them to names which include 'smb3' instead of 'cifs' - so this simply creates an alias for the pseudo-xattrs e.g. can now do: getfattr -n user.smb3.creationtime /mnt1/file and getfattr -n user.smb3.dosattrib /mnt1/file and getfattr -n system.smb3_acl /mnt1/file instead of forcing you to use the string 'cifs' in these (e.g. getfattr -n system.cifs_acl /mnt1/file) Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/cifs/xattr.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 316af84674f1..50ddb795aaeb 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -35,6 +35,14 @@
35#define CIFS_XATTR_CIFS_ACL "system.cifs_acl" 35#define CIFS_XATTR_CIFS_ACL "system.cifs_acl"
36#define CIFS_XATTR_ATTRIB "cifs.dosattrib" /* full name: user.cifs.dosattrib */ 36#define CIFS_XATTR_ATTRIB "cifs.dosattrib" /* full name: user.cifs.dosattrib */
37#define CIFS_XATTR_CREATETIME "cifs.creationtime" /* user.cifs.creationtime */ 37#define CIFS_XATTR_CREATETIME "cifs.creationtime" /* user.cifs.creationtime */
38/*
39 * Although these three are just aliases for the above, need to move away from
40 * confusing users and using the 20+ year old term 'cifs' when it is no longer
41 * secure, replaced by SMB2 (then even more highly secure SMB3) many years ago
42 */
43#define SMB3_XATTR_CIFS_ACL "system.smb3_acl"
44#define SMB3_XATTR_ATTRIB "smb3.dosattrib" /* full name: user.smb3.dosattrib */
45#define SMB3_XATTR_CREATETIME "smb3.creationtime" /* user.smb3.creationtime */
38/* BB need to add server (Samba e.g) support for security and trusted prefix */ 46/* BB need to add server (Samba e.g) support for security and trusted prefix */
39 47
40enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT }; 48enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT };
@@ -220,10 +228,12 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
220 switch (handler->flags) { 228 switch (handler->flags) {
221 case XATTR_USER: 229 case XATTR_USER:
222 cifs_dbg(FYI, "%s:querying user xattr %s\n", __func__, name); 230 cifs_dbg(FYI, "%s:querying user xattr %s\n", __func__, name);
223 if (strcmp(name, CIFS_XATTR_ATTRIB) == 0) { 231 if ((strcmp(name, CIFS_XATTR_ATTRIB) == 0) ||
232 (strcmp(name, SMB3_XATTR_ATTRIB) == 0)) {
224 rc = cifs_attrib_get(dentry, inode, value, size); 233 rc = cifs_attrib_get(dentry, inode, value, size);
225 break; 234 break;
226 } else if (strcmp(name, CIFS_XATTR_CREATETIME) == 0) { 235 } else if ((strcmp(name, CIFS_XATTR_CREATETIME) == 0) ||
236 (strcmp(name, SMB3_XATTR_CREATETIME) == 0)) {
227 rc = cifs_creation_time_get(dentry, inode, value, size); 237 rc = cifs_creation_time_get(dentry, inode, value, size);
228 break; 238 break;
229 } 239 }
@@ -363,6 +373,19 @@ static const struct xattr_handler cifs_cifs_acl_xattr_handler = {
363 .set = cifs_xattr_set, 373 .set = cifs_xattr_set,
364}; 374};
365 375
376/*
377 * Although this is just an alias for the above, need to move away from
378 * confusing users and using the 20 year old term 'cifs' when it is no
379 * longer secure and was replaced by SMB2/SMB3 a long time ago, and
380 * SMB3 and later are highly secure.
381 */
382static const struct xattr_handler smb3_acl_xattr_handler = {
383 .name = SMB3_XATTR_CIFS_ACL,
384 .flags = XATTR_CIFS_ACL,
385 .get = cifs_xattr_get,
386 .set = cifs_xattr_set,
387};
388
366static const struct xattr_handler cifs_posix_acl_access_xattr_handler = { 389static const struct xattr_handler cifs_posix_acl_access_xattr_handler = {
367 .name = XATTR_NAME_POSIX_ACL_ACCESS, 390 .name = XATTR_NAME_POSIX_ACL_ACCESS,
368 .flags = XATTR_ACL_ACCESS, 391 .flags = XATTR_ACL_ACCESS,
@@ -381,6 +404,7 @@ const struct xattr_handler *cifs_xattr_handlers[] = {
381 &cifs_user_xattr_handler, 404 &cifs_user_xattr_handler,
382 &cifs_os2_xattr_handler, 405 &cifs_os2_xattr_handler,
383 &cifs_cifs_acl_xattr_handler, 406 &cifs_cifs_acl_xattr_handler,
407 &smb3_acl_xattr_handler, /* alias for above since avoiding "cifs" */
384 &cifs_posix_acl_access_xattr_handler, 408 &cifs_posix_acl_access_xattr_handler,
385 &cifs_posix_acl_default_xattr_handler, 409 &cifs_posix_acl_default_xattr_handler,
386 NULL 410 NULL