提交 95932655 编写于 作者: S Steve French

CIFS: Add new mount option to set owner uid and gid from special sids in acl

Add "idsfromsid" mount option to indicate to cifs.ko that it should
try to retrieve the uid and gid owner fields from special sids in the
ACL if present.  This first patch just adds the parsing for the mount
option.
Signed-off-by: NSteve French <steve.french@primarydata.com>
Reviewed-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
上级 de740250
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#define CIFS_MOUNT_USE_PREFIX_PATH 0x1000000 /* make subpath with unaccessible #define CIFS_MOUNT_USE_PREFIX_PATH 0x1000000 /* make subpath with unaccessible
* root mountable * root mountable
*/ */
#define CIFS_MOUNT_UID_FROM_ACL 0x2000000 /* try to get UID via special SID */
struct cifs_sb_info { struct cifs_sb_info {
struct rb_root tlink_tree; struct rb_root tlink_tree;
......
...@@ -469,6 +469,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -469,6 +469,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
seq_puts(s, ",posixpaths"); seq_puts(s, ",posixpaths");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)
seq_puts(s, ",setuids"); seq_puts(s, ",setuids");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UID_FROM_ACL)
seq_puts(s, ",idsfromsid");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
seq_puts(s, ",serverino"); seq_puts(s, ",serverino");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
......
...@@ -478,6 +478,7 @@ struct smb_vol { ...@@ -478,6 +478,7 @@ struct smb_vol {
bool retry:1; bool retry:1;
bool intr:1; bool intr:1;
bool setuids:1; bool setuids:1;
bool setuidfromacl:1;
bool override_uid:1; bool override_uid:1;
bool override_gid:1; bool override_gid:1;
bool dynperm:1; bool dynperm:1;
......
...@@ -75,7 +75,7 @@ enum { ...@@ -75,7 +75,7 @@ enum {
Opt_noposixpaths, Opt_nounix, Opt_noposixpaths, Opt_nounix,
Opt_nocase, Opt_nocase,
Opt_brl, Opt_nobrl, Opt_brl, Opt_nobrl,
Opt_forcemandatorylock, Opt_setuids, Opt_forcemandatorylock, Opt_setuidfromacl, Opt_setuids,
Opt_nosetuids, Opt_dynperm, Opt_nodynperm, Opt_nosetuids, Opt_dynperm, Opt_nodynperm,
Opt_nohard, Opt_nosoft, Opt_nohard, Opt_nosoft,
Opt_nointr, Opt_intr, Opt_nointr, Opt_intr,
...@@ -147,6 +147,7 @@ static const match_table_t cifs_mount_option_tokens = { ...@@ -147,6 +147,7 @@ static const match_table_t cifs_mount_option_tokens = {
{ Opt_forcemandatorylock, "forcemand" }, { Opt_forcemandatorylock, "forcemand" },
{ Opt_setuids, "setuids" }, { Opt_setuids, "setuids" },
{ Opt_nosetuids, "nosetuids" }, { Opt_nosetuids, "nosetuids" },
{ Opt_setuidfromacl, "idsfromsid" },
{ Opt_dynperm, "dynperm" }, { Opt_dynperm, "dynperm" },
{ Opt_nodynperm, "nodynperm" }, { Opt_nodynperm, "nodynperm" },
{ Opt_nohard, "nohard" }, { Opt_nohard, "nohard" },
...@@ -1376,6 +1377,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1376,6 +1377,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
case Opt_nosetuids: case Opt_nosetuids:
vol->setuids = 0; vol->setuids = 0;
break; break;
case Opt_setuidfromacl:
vol->setuidfromacl = 1;
break;
case Opt_dynperm: case Opt_dynperm:
vol->dynperm = true; vol->dynperm = true;
break; break;
...@@ -3279,6 +3283,8 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, ...@@ -3279,6 +3283,8 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM;
if (pvolume_info->setuids) if (pvolume_info->setuids)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID;
if (pvolume_info->setuidfromacl)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UID_FROM_ACL;
if (pvolume_info->server_ino) if (pvolume_info->server_ino)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SERVER_INUM; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SERVER_INUM;
if (pvolume_info->remap) if (pvolume_info->remap)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册