]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/sunrpc/auth.c
NFSv4: Don't use cred->cr_ops->cr_name in nfs4_proc_setclientid()
[mv-sheeva.git] / net / sunrpc / auth.c
index b0f2b2ee7cc089f7d62c9d55ca0d5ba72e653dc1..0632cd0a1ad7f926a7ef6032845d0e9dc48afdf7 100644 (file)
@@ -356,7 +356,6 @@ rpcauth_lookupcred(struct rpc_auth *auth, int flags)
        put_group_info(acred.group_info);
        return ret;
 }
-EXPORT_SYMBOL_GPL(rpcauth_lookupcred);
 
 void
 rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
@@ -376,6 +375,15 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
 EXPORT_SYMBOL_GPL(rpcauth_init_cred);
 
 void
+rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred)
+{
+       task->tk_msg.rpc_cred = get_rpccred(cred);
+       dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid,
+                       cred->cr_auth->au_ops->au_name, cred);
+}
+EXPORT_SYMBOL_GPL(rpcauth_generic_bind_cred);
+
+static void
 rpcauth_bind_root_cred(struct rpc_task *task)
 {
        struct rpc_auth *auth = task->tk_client->cl_auth;
@@ -394,8 +402,8 @@ rpcauth_bind_root_cred(struct rpc_task *task)
                task->tk_status = PTR_ERR(ret);
 }
 
-void
-rpcauth_bindcred(struct rpc_task *task)
+static void
+rpcauth_bind_new_cred(struct rpc_task *task)
 {
        struct rpc_auth *auth = task->tk_client->cl_auth;
        struct rpc_cred *ret;
@@ -410,14 +418,14 @@ rpcauth_bindcred(struct rpc_task *task)
 }
 
 void
-rpcauth_holdcred(struct rpc_task *task)
+rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags)
 {
-       struct rpc_cred *cred = task->tk_msg.rpc_cred;
-       if (cred != NULL) {
-               get_rpccred(cred);
-               dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid,
-                               cred->cr_auth->au_ops->au_name, cred);
-       }
+       if (cred != NULL)
+               cred->cr_ops->crbind(task, cred);
+       else if (flags & RPC_TASK_ROOTCREDS)
+               rpcauth_bind_root_cred(task);
+       else
+               rpcauth_bind_new_cred(task);
 }
 
 void
@@ -558,6 +566,7 @@ static struct shrinker rpc_cred_shrinker = {
 void __init rpcauth_init_module(void)
 {
        rpc_init_authunix();
+       rpc_init_generic_auth();
        register_shrinker(&rpc_cred_shrinker);
 }