diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-23 19:55:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:35 -0400 |
commit | 5fe4755e2526a2aa82b7ed8daeb3aed74a236925 (patch) | |
tree | aceb993080fc6aac5861f04d8a8494becb4046eb /net/sunrpc/auth_unix.c | |
parent | f1c0a8615090359d57e096157feb9f900cbb233c (diff) |
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.c | 10 |
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 { | |||
20 | gid_t uc_gids[NFS_NGROUPS]; | 20 | gid_t uc_gids[NFS_NGROUPS]; |
21 | }; | 21 | }; |
22 | #define uc_uid uc_base.cr_uid | 22 | #define uc_uid uc_base.cr_uid |
23 | #define uc_count uc_base.cr_count | ||
24 | #define uc_flags uc_base.cr_flags | ||
25 | #define uc_expire uc_base.cr_expire | ||
26 | 23 | ||
27 | #define UNX_CRED_EXPIRE (60 * HZ) | 24 | #define UNX_CRED_EXPIRE (60 * HZ) |
28 | 25 | ||
@@ -74,8 +71,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
74 | if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL))) | 71 | if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL))) |
75 | return ERR_PTR(-ENOMEM); | 72 | return ERR_PTR(-ENOMEM); |
76 | 73 | ||
77 | atomic_set(&cred->uc_count, 1); | 74 | rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops); |
78 | cred->uc_flags = RPCAUTH_CRED_UPTODATE; | 75 | cred->uc_base.cr_flags = RPCAUTH_CRED_UPTODATE; |
79 | if (flags & RPCAUTH_LOOKUP_ROOTCREDS) { | 76 | if (flags & RPCAUTH_LOOKUP_ROOTCREDS) { |
80 | cred->uc_uid = 0; | 77 | cred->uc_uid = 0; |
81 | cred->uc_gid = 0; | 78 | cred->uc_gid = 0; |
@@ -85,15 +82,12 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
85 | if (groups > NFS_NGROUPS) | 82 | if (groups > NFS_NGROUPS) |
86 | groups = NFS_NGROUPS; | 83 | groups = NFS_NGROUPS; |
87 | 84 | ||
88 | cred->uc_uid = acred->uid; | ||
89 | cred->uc_gid = acred->gid; | 85 | cred->uc_gid = acred->gid; |
90 | for (i = 0; i < groups; i++) | 86 | for (i = 0; i < groups; i++) |
91 | cred->uc_gids[i] = GROUP_AT(acred->group_info, i); | 87 | cred->uc_gids[i] = GROUP_AT(acred->group_info, i); |
92 | if (i < NFS_NGROUPS) | 88 | if (i < NFS_NGROUPS) |
93 | cred->uc_gids[i] = NOGROUP; | 89 | cred->uc_gids[i] = NOGROUP; |
94 | } | 90 | } |
95 | cred->uc_base.cr_auth = &unix_auth; | ||
96 | cred->uc_base.cr_ops = &unix_credops; | ||
97 | 91 | ||
98 | return (struct rpc_cred *) cred; | 92 | return (struct rpc_cred *) cred; |
99 | } | 93 | } |