SUNRPC: remove RPCAUTH_AUTH_NO_CRKEY_TIMEOUT
[linux-2.6-microblaze.git] / net / sunrpc / auth_unix.c
index 4c1c7e5..6ee43bf 100644 (file)
@@ -48,8 +48,8 @@ unx_destroy(struct rpc_auth *auth)
 static int
 unx_hash_cred(struct auth_cred *acred, unsigned int hashbits)
 {
-       return hash_64(from_kgid(&init_user_ns, acred->gid) |
-               ((u64)from_kuid(&init_user_ns, acred->uid) <<
+       return hash_64(from_kgid(&init_user_ns, acred->cred->fsgid) |
+               ((u64)from_kuid(&init_user_ns, acred->cred->fsuid) <<
                        (sizeof(gid_t) * 8)), hashbits);
 }
 
@@ -70,8 +70,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags, gfp_t
        unsigned int i;
 
        dprintk("RPC:       allocating UNIX cred for uid %d gid %d\n",
-                       from_kuid(&init_user_ns, acred->uid),
-                       from_kgid(&init_user_ns, acred->gid));
+                       from_kuid(&init_user_ns, acred->cred->fsuid),
+                       from_kgid(&init_user_ns, acred->cred->fsgid));
 
        if (!(cred = kmalloc(sizeof(*cred), gfp)))
                return ERR_PTR(-ENOMEM);
@@ -79,14 +79,14 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags, gfp_t
        rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops);
        cred->uc_base.cr_flags = 1UL << RPCAUTH_CRED_UPTODATE;
 
-       if (acred->group_info != NULL)
-               groups = acred->group_info->ngroups;
+       if (acred->cred && acred->cred->group_info != NULL)
+               groups = acred->cred->group_info->ngroups;
        if (groups > UNX_NGROUPS)
                groups = UNX_NGROUPS;
 
-       cred->uc_gid = acred->gid;
+       cred->uc_gid = acred->cred->fsgid;
        for (i = 0; i < groups; i++)
-               cred->uc_gids[i] = acred->group_info->gid[i];
+               cred->uc_gids[i] = acred->cred->group_info->gid[i];
        if (i < UNX_NGROUPS)
                cred->uc_gids[i] = INVALID_GID;
 
@@ -97,6 +97,7 @@ static void
 unx_free_cred(struct unx_cred *unx_cred)
 {
        dprintk("RPC:       unx_free_cred %p\n", unx_cred);
+       put_cred(unx_cred->uc_base.cr_cred);
        kfree(unx_cred);
 }
 
@@ -126,15 +127,15 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
        unsigned int i;
 
 
-       if (!uid_eq(cred->uc_uid, acred->uid) || !gid_eq(cred->uc_gid, acred->gid))
+       if (!uid_eq(cred->uc_uid, acred->cred->fsuid) || !gid_eq(cred->uc_gid, acred->cred->fsgid))
                return 0;
 
-       if (acred->group_info != NULL)
-               groups = acred->group_info->ngroups;
+       if (acred->cred && acred->cred->group_info != NULL)
+               groups = acred->cred->group_info->ngroups;
        if (groups > UNX_NGROUPS)
                groups = UNX_NGROUPS;
        for (i = 0; i < groups ; i++)
-               if (!gid_eq(cred->uc_gids[i], acred->group_info->gid[i]))
+               if (!gid_eq(cred->uc_gids[i], acred->cred->group_info->gid[i]))
                        return 0;
        if (groups < UNX_NGROUPS && gid_valid(cred->uc_gids[groups]))
                return 0;
@@ -236,7 +237,6 @@ static
 struct rpc_auth                unix_auth = {
        .au_cslack      = UNX_CALLSLACK,
        .au_rslack      = NUL_REPLYSLACK,
-       .au_flags       = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT,
        .au_ops         = &authunix_ops,
        .au_flavor      = RPC_AUTH_UNIX,
        .au_count       = REFCOUNT_INIT(1),