]> Pileus Git - ~andy/linux/commitdiff
sunrpc: Use userns friendly constants.
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 1 Feb 2013 23:55:38 +0000 (15:55 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 13 Feb 2013 14:15:15 +0000 (06:15 -0800)
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>
net/sunrpc/auth.c
net/sunrpc/auth_generic.c
net/sunrpc/auth_unix.c
net/sunrpc/svcauth_unix.c

index b5c067bccc4595204f21bff24bbf16631e54cad4..4cd0ecfe9837c228acff5c4a722879eafe2b1405 100644 (file)
@@ -519,8 +519,8 @@ rpcauth_bind_root_cred(struct rpc_task *task, int lookupflags)
 {
        struct rpc_auth *auth = task->tk_client->cl_auth;
        struct auth_cred acred = {
-               .uid = 0,
-               .gid = 0,
+               .uid = GLOBAL_ROOT_UID,
+               .gid = GLOBAL_ROOT_GID,
        };
 
        dprintk("RPC: %5u looking up %s cred\n",
index 6ed6f201b022aae4c2b01b97b21dd9bdeddbed2f..9d2e0b045596c48854dc83141a11a3f9beaba15f 100644 (file)
@@ -18,8 +18,8 @@
 # define RPCDBG_FACILITY       RPCDBG_AUTH
 #endif
 
-#define RPC_MACHINE_CRED_USERID                ((uid_t)0)
-#define RPC_MACHINE_CRED_GROUPID       ((gid_t)0)
+#define RPC_MACHINE_CRED_USERID                GLOBAL_ROOT_UID
+#define RPC_MACHINE_CRED_GROUPID       GLOBAL_ROOT_GID
 
 struct generic_cred {
        struct rpc_cred gc_base;
index 52c5abdee211cde762075809a09ca2d849ddeca3..2f8627082fa759c0d75e5daa8b2c4c2139ed30ad 100644 (file)
@@ -85,7 +85,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
                cred->uc_gids[i] = gid;
        }
        if (i < NFS_NGROUPS)
-               cred->uc_gids[i] = NOGROUP;
+               cred->uc_gids[i] = INVALID_GID;
 
        return &cred->uc_base;
 }
@@ -137,7 +137,7 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
                        return 0;
        }
        if (groups < NFS_NGROUPS &&
-           cred->uc_gids[groups] != NOGROUP)
+           cred->uc_gids[groups] != INVALID_GID)
                return 0;
        return 1;
 }
@@ -166,7 +166,7 @@ unx_marshal(struct rpc_task *task, __be32 *p)
        *p++ = htonl((u32) cred->uc_uid);
        *p++ = htonl((u32) cred->uc_gid);
        hold = p++;
-       for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
+       for (i = 0; i < 16 && cred->uc_gids[i] != INVALID_GID; i++)
                *p++ = htonl((u32) cred->uc_gids[i]);
        *hold = htonl(p - hold - 1);            /* gid array length */
        *base = htonl((p - base - 1) << 2);     /* cred length */
index 4d012920373345ccb7b76957e792900c143505e9..c8cb5dc8d8711e06259b397c5891e327f2038a65 100644 (file)
@@ -750,8 +750,8 @@ svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp)
        }
 
        /* Signal that mapping to nobody uid/gid is required */
-       cred->cr_uid = (uid_t) -1;
-       cred->cr_gid = (gid_t) -1;
+       cred->cr_uid = INVALID_UID;
+       cred->cr_gid = INVALID_GID;
        cred->cr_group_info = groups_alloc(0);
        if (cred->cr_group_info == NULL)
                return SVC_CLOSE; /* kmalloc failure - client must retry */