aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-13 18:39:18 -0500
committerJames Morris <jmorris@namei.org>2008-11-13 18:39:18 -0500
commit86a264abe542cfececb4df129bc45a0338d8cdb9 (patch)
tree30152f04ba847f311028d5ca697f864c16c7ebb3 /net
parentf1752eec6145c97163dbce62d17cf5d928e28a27 (diff)
CRED: Wrap current->cred and a few other accessors
Wrap current->cred and a few other accessors to hide their actual implementation. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/scm.c2
-rw-r--r--net/sunrpc/auth.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/net/core/scm.c b/net/core/scm.c
index c28ca32a7d9..f73c44b17dd 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -44,7 +44,7 @@
44 44
45static __inline__ int scm_check_creds(struct ucred *creds) 45static __inline__ int scm_check_creds(struct ucred *creds)
46{ 46{
47 struct cred *cred = current->cred; 47 const struct cred *cred = current_cred();
48 48
49 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && 49 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) &&
50 ((creds->uid == cred->uid || creds->uid == cred->euid || 50 ((creds->uid == cred->uid || creds->uid == cred->euid ||
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index c7954321260..0443f834945 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -350,16 +350,18 @@ EXPORT_SYMBOL_GPL(rpcauth_lookup_credcache);
350struct rpc_cred * 350struct rpc_cred *
351rpcauth_lookupcred(struct rpc_auth *auth, int flags) 351rpcauth_lookupcred(struct rpc_auth *auth, int flags)
352{ 352{
353 struct auth_cred acred = { 353 struct auth_cred acred;
354 .uid = current_fsuid(),
355 .gid = current_fsgid(),
356 .group_info = current->cred->group_info,
357 };
358 struct rpc_cred *ret; 354 struct rpc_cred *ret;
355 const struct cred *cred = current_cred();
359 356
360 dprintk("RPC: looking up %s cred\n", 357 dprintk("RPC: looking up %s cred\n",
361 auth->au_ops->au_name); 358 auth->au_ops->au_name);
362 get_group_info(acred.group_info); 359
360 memset(&acred, 0, sizeof(acred));
361 acred.uid = cred->fsuid;
362 acred.gid = cred->fsgid;
363 acred.group_info = get_group_info(((struct cred *)cred)->group_info);
364
363 ret = auth->au_ops->lookup_cred(auth, &acred, flags); 365 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
364 put_group_info(acred.group_info); 366 put_group_info(acred.group_info);
365 return ret; 367 return ret;