Commit bf37f794372d5b8fda66702e1f3e70d4f07b6533

Authored by Eric W. Biederman
1 parent ddca4e1730

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>

Showing 4 changed files with 9 additions and 9 deletions Side-by-side Diff

... ... @@ -519,8 +519,8 @@
519 519 {
520 520 struct rpc_auth *auth = task->tk_client->cl_auth;
521 521 struct auth_cred acred = {
522   - .uid = 0,
523   - .gid = 0,
  522 + .uid = GLOBAL_ROOT_UID,
  523 + .gid = GLOBAL_ROOT_GID,
524 524 };
525 525  
526 526 dprintk("RPC: %5u looking up %s cred\n",
net/sunrpc/auth_generic.c
... ... @@ -18,8 +18,8 @@
18 18 # define RPCDBG_FACILITY RPCDBG_AUTH
19 19 #endif
20 20  
21   -#define RPC_MACHINE_CRED_USERID ((uid_t)0)
22   -#define RPC_MACHINE_CRED_GROUPID ((gid_t)0)
  21 +#define RPC_MACHINE_CRED_USERID GLOBAL_ROOT_UID
  22 +#define RPC_MACHINE_CRED_GROUPID GLOBAL_ROOT_GID
23 23  
24 24 struct generic_cred {
25 25 struct rpc_cred gc_base;
net/sunrpc/auth_unix.c
... ... @@ -85,7 +85,7 @@
85 85 cred->uc_gids[i] = gid;
86 86 }
87 87 if (i < NFS_NGROUPS)
88   - cred->uc_gids[i] = NOGROUP;
  88 + cred->uc_gids[i] = INVALID_GID;
89 89  
90 90 return &cred->uc_base;
91 91 }
... ... @@ -137,7 +137,7 @@
137 137 return 0;
138 138 }
139 139 if (groups < NFS_NGROUPS &&
140   - cred->uc_gids[groups] != NOGROUP)
  140 + cred->uc_gids[groups] != INVALID_GID)
141 141 return 0;
142 142 return 1;
143 143 }
... ... @@ -166,7 +166,7 @@
166 166 *p++ = htonl((u32) cred->uc_uid);
167 167 *p++ = htonl((u32) cred->uc_gid);
168 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 170 *p++ = htonl((u32) cred->uc_gids[i]);
171 171 *hold = htonl(p - hold - 1); /* gid array length */
172 172 *base = htonl((p - base - 1) << 2); /* cred length */
net/sunrpc/svcauth_unix.c
... ... @@ -750,8 +750,8 @@
750 750 }
751 751  
752 752 /* Signal that mapping to nobody uid/gid is required */
753   - cred->cr_uid = (uid_t) -1;
754   - cred->cr_gid = (gid_t) -1;
  753 + cred->cr_uid = INVALID_UID;
  754 + cred->cr_gid = INVALID_GID;
755 755 cred->cr_group_info = groups_alloc(0);
756 756 if (cred->cr_group_info == NULL)
757 757 return SVC_CLOSE; /* kmalloc failure - client must retry */