#define MAX_EA_VALUE_SIZE CIFSMaxBufSize #define CIFS_XATTR_CIFS_ACL "system.cifs_acl"/* DACL only */ #define CIFS_XATTR_CIFS_NTSD "system.cifs_ntsd"/* owner plus DACL */ #define CIFS_XATTR_CIFS_NTSD_FULL "system.cifs_ntsd_full"/* owner/DACL/SACL */ #define CIFS_XATTR_ATTRIB "cifs.dosattrib"/* full name: user.cifs.dosattrib */ #define CIFS_XATTR_CREATETIME "cifs.creationtime"/* user.cifs.creationtime */ /* * Although these three are just aliases for the above, need to move away from * confusing users and using the 20+ year old term 'cifs' when it is no longer * secure, replaced by SMB2 (then even more highly secure SMB3) many years ago
*/ #define SMB3_XATTR_CIFS_ACL "system.smb3_acl"/* DACL only */ #define SMB3_XATTR_CIFS_NTSD_SACL "system.smb3_ntsd_sacl"/* SACL only */ #define SMB3_XATTR_CIFS_NTSD_OWNER "system.smb3_ntsd_owner"/* owner only */ #define SMB3_XATTR_CIFS_NTSD "system.smb3_ntsd"/* owner plus DACL */ #define SMB3_XATTR_CIFS_NTSD_FULL "system.smb3_ntsd_full"/* owner/DACL/SACL */ #define SMB3_XATTR_ATTRIB "smb3.dosattrib"/* full name: user.smb3.dosattrib */ #define SMB3_XATTR_CREATETIME "smb3.creationtime"/* user.smb3.creationtime */ /* BB need to add server (Samba e.g) support for security and trusted prefix */
tlink = cifs_sb_tlink(cifs_sb); if (IS_ERR(tlink)) return PTR_ERR(tlink);
pTcon = tlink_tcon(tlink);
xid = get_xid();
page = alloc_dentry_path();
full_path = build_path_from_dentry(dentry, page); if (IS_ERR(full_path)) {
rc = PTR_ERR(full_path); goto out;
} /* return dos attributes as pseudo xattr */ /* return alt name if available as pseudo attr */
/* if proc/fs/cifs/streamstoxattr is set then search server for EAs or streams to
returns as xattrs */ if (size > MAX_EA_VALUE_SIZE) {
cifs_dbg(FYI, "size of EA value too large\n");
rc = -EOPNOTSUPP; goto out;
}
switch (handler->flags) { case XATTR_USER:
cifs_dbg(FYI, "%s:setting user xattr %s\n", __func__, name); if ((strcmp(name, CIFS_XATTR_ATTRIB) == 0) ||
(strcmp(name, SMB3_XATTR_ATTRIB) == 0)) {
rc = cifs_attrib_set(xid, pTcon, inode, full_path,
value, size); if (rc == 0) /* force revalidate of the inode */
CIFS_I(inode)->time = 0; break;
} elseif ((strcmp(name, CIFS_XATTR_CREATETIME) == 0) ||
(strcmp(name, SMB3_XATTR_CREATETIME) == 0)) {
rc = cifs_creation_time_set(xid, pTcon, inode,
full_path, value, size); if (rc == 0) /* force revalidate of the inode */
CIFS_I(inode)->time = 0; break;
}
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) goto out;
if (pTcon->ses->server->ops->set_EA) {
rc = pTcon->ses->server->ops->set_EA(xid, pTcon,
full_path, name, value, (__u16)size,
cifs_sb->local_nls, cifs_sb); if (rc == 0)
inode_set_ctime_current(inode);
} break;
case XATTR_CIFS_ACL: case XATTR_CIFS_NTSD_SACL: case XATTR_CIFS_NTSD_OWNER: case XATTR_CIFS_NTSD: case XATTR_CIFS_NTSD_FULL: { struct smb_ntsd *pacl;
if (!value) goto out;
pacl = kmalloc(size, GFP_KERNEL); if (!pacl) {
rc = -ENOMEM;
} else {
memcpy(pacl, value, size); if (pTcon->ses->server->ops->set_acl) { int aclflags = 0;
rc = 0;
switch (handler->flags) { case XATTR_CIFS_NTSD_FULL:
aclflags = (CIFS_ACL_OWNER |
CIFS_ACL_GROUP |
CIFS_ACL_DACL |
CIFS_ACL_SACL); break; case XATTR_CIFS_NTSD:
aclflags = (CIFS_ACL_OWNER |
CIFS_ACL_GROUP |
CIFS_ACL_DACL); break; case XATTR_CIFS_NTSD_OWNER:
aclflags = (CIFS_ACL_OWNER |
CIFS_ACL_GROUP); break; case XATTR_CIFS_NTSD_SACL:
aclflags = CIFS_ACL_SACL; break; case XATTR_CIFS_ACL: default:
aclflags = CIFS_ACL_DACL;
}
rc = pTcon->ses->server->ops->set_acl(pacl,
size, inode, full_path, aclflags);
} else {
rc = -EOPNOTSUPP;
} if (rc == 0) /* force revalidate of the inode */
CIFS_I(inode)->time = 0;
kfree(pacl);
} break;
}
}
case XATTR_CIFS_ACL: case XATTR_CIFS_NTSD_SACL: case XATTR_CIFS_NTSD_OWNER: case XATTR_CIFS_NTSD: case XATTR_CIFS_NTSD_FULL: { /* * fetch owner, DACL, and SACL if asked for full descriptor, * fetch owner and DACL otherwise
*/
u32 acllen, extra_info; struct smb_ntsd *pacl;
if (unlikely(cifs_forced_shutdown(cifs_sb))) return -EIO;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) return -EOPNOTSUPP;
tlink = cifs_sb_tlink(cifs_sb); if (IS_ERR(tlink)) return PTR_ERR(tlink);
pTcon = tlink_tcon(tlink);
xid = get_xid();
page = alloc_dentry_path();
full_path = build_path_from_dentry(direntry, page); if (IS_ERR(full_path)) {
rc = PTR_ERR(full_path); goto list_ea_exit;
} /* return dos attributes as pseudo xattr */ /* return alt name if available as pseudo attr */
/* if proc/fs/cifs/streamstoxattr is set then search server for EAs or streams to
returns as xattrs */
/* * Although this is just an alias for the above, need to move away from * confusing users and using the 20 year old term 'cifs' when it is no * longer secure and was replaced by SMB2/SMB3 a long time ago, and * SMB3 and later are highly secure.
*/ staticconststruct xattr_handler smb3_acl_xattr_handler = {
.name = SMB3_XATTR_CIFS_ACL,
.flags = XATTR_CIFS_ACL,
.get = cifs_xattr_get,
.set = cifs_xattr_set,
};
/* * Although this is just an alias for the above, need to move away from * confusing users and using the 20 year old term 'cifs' when it is no * longer secure and was replaced by SMB2/SMB3 a long time ago, and * SMB3 and later are highly secure.
*/ staticconststruct xattr_handler smb3_ntsd_xattr_handler = {
.name = SMB3_XATTR_CIFS_NTSD,
.flags = XATTR_CIFS_NTSD,
.get = cifs_xattr_get,
.set = cifs_xattr_set,
};
/* * Although this is just an alias for the above, need to move away from * confusing users and using the 20 year old term 'cifs' when it is no * longer secure and was replaced by SMB2/SMB3 a long time ago, and * SMB3 and later are highly secure.
*/ staticconststruct xattr_handler smb3_ntsd_full_xattr_handler = {
.name = SMB3_XATTR_CIFS_NTSD_FULL,
.flags = XATTR_CIFS_NTSD_FULL,
.get = cifs_xattr_get,
.set = cifs_xattr_set,
};
conststruct xattr_handler * const cifs_xattr_handlers[] = {
&cifs_user_xattr_handler,
&cifs_os2_xattr_handler,
&cifs_cifs_acl_xattr_handler,
&smb3_acl_xattr_handler, /* alias for above since avoiding "cifs" */
&smb3_ntsd_sacl_xattr_handler,
&smb3_ntsd_owner_xattr_handler,
&cifs_cifs_ntsd_xattr_handler,
&smb3_ntsd_xattr_handler, /* alias for above since avoiding "cifs" */
&cifs_cifs_ntsd_full_xattr_handler,
&smb3_ntsd_full_xattr_handler, /* alias for above since avoiding "cifs" */
NULL
};
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.