diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-01 18:55:38 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2013-02-13 09:15:15 -0500 |
commit | bf37f794372d5b8fda66702e1f3e70d4f07b6533 (patch) | |
tree | d6e5478c2b9d3dad865071f8ab7f617dac5d876f /net | |
parent | ddca4e1730cf1b72044ae76ddf17b29d790b4dbc (diff) |
sunrpc: Use userns friendly constants.
Instead of (uid_t)0 use GLOBAL_ROOT_UID.
Instead of (gid_t)0 use GLOBAL_ROOT_GID.
Instead of (uid_t)-1 use INVALID_UID
Instead of (gid_t)-1 use INVALID_GID.
Instead of NOGROUP use INVALID_GID.
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_generic.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_unix.c | 6 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index b5c067bccc45..4cd0ecfe9837 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -519,8 +519,8 @@ rpcauth_bind_root_cred(struct rpc_task *task, int lookupflags) | |||
519 | { | 519 | { |
520 | struct rpc_auth *auth = task->tk_client->cl_auth; | 520 | struct rpc_auth *auth = task->tk_client->cl_auth; |
521 | struct auth_cred acred = { | 521 | struct auth_cred acred = { |
522 | .uid = 0, | 522 | .uid = GLOBAL_ROOT_UID, |
523 | .gid = 0, | 523 | .gid = GLOBAL_ROOT_GID, |
524 | }; | 524 | }; |
525 | 525 | ||
526 | dprintk("RPC: %5u looking up %s cred\n", | 526 | dprintk("RPC: %5u looking up %s cred\n", |
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index 6ed6f201b022..9d2e0b045596 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
@@ -18,8 +18,8 @@ | |||
18 | # define RPCDBG_FACILITY RPCDBG_AUTH | 18 | # define RPCDBG_FACILITY RPCDBG_AUTH |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #define RPC_MACHINE_CRED_USERID ((uid_t)0) | 21 | #define RPC_MACHINE_CRED_USERID GLOBAL_ROOT_UID |
22 | #define RPC_MACHINE_CRED_GROUPID ((gid_t)0) | 22 | #define RPC_MACHINE_CRED_GROUPID GLOBAL_ROOT_GID |
23 | 23 | ||
24 | struct generic_cred { | 24 | struct generic_cred { |
25 | struct rpc_cred gc_base; | 25 | struct rpc_cred gc_base; |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 52c5abdee211..2f8627082fa7 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -85,7 +85,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
85 | cred->uc_gids[i] = gid; | 85 | cred->uc_gids[i] = gid; |
86 | } | 86 | } |
87 | if (i < NFS_NGROUPS) | 87 | if (i < NFS_NGROUPS) |
88 | cred->uc_gids[i] = NOGROUP; | 88 | cred->uc_gids[i] = INVALID_GID; |
89 | 89 | ||
90 | return &cred->uc_base; | 90 | return &cred->uc_base; |
91 | } | 91 | } |
@@ -137,7 +137,7 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags) | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | if (groups < NFS_NGROUPS && | 139 | if (groups < NFS_NGROUPS && |
140 | cred->uc_gids[groups] != NOGROUP) | 140 | cred->uc_gids[groups] != INVALID_GID) |
141 | return 0; | 141 | return 0; |
142 | return 1; | 142 | return 1; |
143 | } | 143 | } |
@@ -166,7 +166,7 @@ unx_marshal(struct rpc_task *task, __be32 *p) | |||
166 | *p++ = htonl((u32) cred->uc_uid); | 166 | *p++ = htonl((u32) cred->uc_uid); |
167 | *p++ = htonl((u32) cred->uc_gid); | 167 | *p++ = htonl((u32) cred->uc_gid); |
168 | hold = p++; | 168 | hold = p++; |
169 | for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++) | 169 | for (i = 0; i < 16 && cred->uc_gids[i] != INVALID_GID; i++) |
170 | *p++ = htonl((u32) cred->uc_gids[i]); | 170 | *p++ = htonl((u32) cred->uc_gids[i]); |
171 | *hold = htonl(p - hold - 1); /* gid array length */ | 171 | *hold = htonl(p - hold - 1); /* gid array length */ |
172 | *base = htonl((p - base - 1) << 2); /* cred length */ | 172 | *base = htonl((p - base - 1) << 2); /* cred length */ |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 4d0129203733..c8cb5dc8d871 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -750,8 +750,8 @@ svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp) | |||
750 | } | 750 | } |
751 | 751 | ||
752 | /* Signal that mapping to nobody uid/gid is required */ | 752 | /* Signal that mapping to nobody uid/gid is required */ |
753 | cred->cr_uid = (uid_t) -1; | 753 | cred->cr_uid = INVALID_UID; |
754 | cred->cr_gid = (gid_t) -1; | 754 | cred->cr_gid = INVALID_GID; |
755 | cred->cr_group_info = groups_alloc(0); | 755 | cred->cr_group_info = groups_alloc(0); |
756 | if (cred->cr_group_info == NULL) | 756 | if (cred->cr_group_info == NULL) |
757 | return SVC_CLOSE; /* kmalloc failure - client must retry */ | 757 | return SVC_CLOSE; /* kmalloc failure - client must retry */ |