提交 03bc6d1c 编写于 作者: E Eric W. Biederman

nfsd: Modify nfsd4_cb_sec to use kuids and kgids

Change uid and gid in struct nfsd4_cb_sec to be of type kuid_t and
kgid_t.

In nfsd4_decode_cb_sec when reading uids and gids off the wire convert
them to kuids and kgids, and if they don't convert to valid kuids or
valid kuids ignore RPC_AUTH_UNIX and don't fill in any of the fields.

Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
上级 ab8e4aee
...@@ -464,9 +464,16 @@ static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_ ...@@ -464,9 +464,16 @@ static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_
READ32(dummy); READ32(dummy);
READ_BUF(dummy * 4); READ_BUF(dummy * 4);
if (cbs->flavor == (u32)(-1)) { if (cbs->flavor == (u32)(-1)) {
cbs->uid = uid; kuid_t kuid = make_kuid(&init_user_ns, uid);
cbs->gid = gid; kgid_t kgid = make_kgid(&init_user_ns, gid);
cbs->flavor = RPC_AUTH_UNIX; if (uid_valid(kuid) && gid_valid(kgid)) {
cbs->uid = kuid;
cbs->gid = kgid;
cbs->flavor = RPC_AUTH_UNIX;
} else {
dprintk("RPC_AUTH_UNIX with invalid"
"uid or gid ignoring!\n");
}
} }
break; break;
case RPC_AUTH_GSS: case RPC_AUTH_GSS:
......
...@@ -152,8 +152,8 @@ struct nfsd4_channel_attrs { ...@@ -152,8 +152,8 @@ struct nfsd4_channel_attrs {
struct nfsd4_cb_sec { struct nfsd4_cb_sec {
u32 flavor; /* (u32)(-1) used to mean "no valid flavor" */ u32 flavor; /* (u32)(-1) used to mean "no valid flavor" */
u32 uid; kuid_t uid;
u32 gid; kgid_t gid;
}; };
struct nfsd4_create_session { struct nfsd4_create_session {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册