summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_unix.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-24 01:55:31 +0200
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-11 05:40:35 +0200
commit5fe4755e2526a2aa82b7ed8daeb3aed74a236925 (patch)
treeaceb993080fc6aac5861f04d8a8494becb4046eb /net/sunrpc/auth_unix.c
parentSUNRPC: Mark auth and cred operation tables as constant. (diff)
downloadlinux-5fe4755e2526a2aa82b7ed8daeb3aed74a236925.tar.xz
linux-5fe4755e2526a2aa82b7ed8daeb3aed74a236925.zip
SUNRPC: Clean up rpc credential initialisation
Add a helper rpc_cred_init() Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_unix.c')
-rw-r--r--net/sunrpc/auth_unix.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 6600c7ad72a9..2f1bdb5c86b3 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -20,9 +20,6 @@ struct unx_cred {
gid_t uc_gids[NFS_NGROUPS];
};
#define uc_uid uc_base.cr_uid
-#define uc_count uc_base.cr_count
-#define uc_flags uc_base.cr_flags
-#define uc_expire uc_base.cr_expire
#define UNX_CRED_EXPIRE (60 * HZ)
@@ -74,8 +71,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL)))
return ERR_PTR(-ENOMEM);
- atomic_set(&cred->uc_count, 1);
- cred->uc_flags = RPCAUTH_CRED_UPTODATE;
+ rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops);
+ cred->uc_base.cr_flags = RPCAUTH_CRED_UPTODATE;
if (flags & RPCAUTH_LOOKUP_ROOTCREDS) {
cred->uc_uid = 0;
cred->uc_gid = 0;
@@ -85,15 +82,12 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
if (groups > NFS_NGROUPS)
groups = NFS_NGROUPS;
- cred->uc_uid = acred->uid;
cred->uc_gid = acred->gid;
for (i = 0; i < groups; i++)
cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
if (i < NFS_NGROUPS)
cred->uc_gids[i] = NOGROUP;
}
- cred->uc_base.cr_auth = &unix_auth;
- cred->uc_base.cr_ops = &unix_credops;
return (struct rpc_cred *) cred;
}