]> Pileus Git - ~andy/linux/blobdiff - net/sunrpc/auth_unix.c
sunrpc: Use gid_valid to test for gid != INVALID_GID
[~andy/linux] / net / sunrpc / auth_unix.c
index 9f3885745fb3ebd62d77844c7493192d3f570024..c434fde2079be9c9e2e8daa0cf0309a05fe0529b 100644 (file)
@@ -65,7 +65,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
        unsigned int i;
 
        dprintk("RPC:       allocating UNIX cred for uid %d gid %d\n",
-                       acred->uid, acred->gid);
+                       from_kuid(&init_user_ns, acred->uid),
+                       from_kgid(&init_user_ns, acred->gid));
 
        if (!(cred = kmalloc(sizeof(*cred), GFP_NOFS)))
                return ERR_PTR(-ENOMEM);
@@ -130,8 +131,7 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
        for (i = 0; i < groups ; i++)
                if (!gid_eq(cred->uc_gids[i], GROUP_AT(acred->group_info, i)))
                        return 0;
-       if (groups < NFS_NGROUPS &&
-           cred->uc_gids[groups] != INVALID_GID)
+       if (groups < NFS_NGROUPS && gid_valid(cred->uc_gids[groups]))
                return 0;
        return 1;
 }
@@ -160,7 +160,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] != INVALID_GID; i++)
+       for (i = 0; i < 16 && gid_valid(cred->uc_gids[i]); i++)
                *p++ = htonl((u32) cred->uc_gids[i]);
        *hold = htonl(p - hold - 1);            /* gid array length */
        *base = htonl((p - base - 1) << 2);     /* cred length */