Skip to contentSkip to conversation

Secure user authentication for NFS using RPCSEC_GSS [5/6]

PATCH New Trond Myklebust 1 participant 1 message Jan 13, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Secure user authentication for NFS using RPCSEC_GSS [5/6]

This patches the RPCSEC_GSS client to make use of the upcall mechanism that was provided by patch [3/6].

If an RPC task presents a non-uptodate credential to call_refresh(), a user daemon is contacted by means of a dedicated rpc_pipefs pipe. The daemon is then fed the uid for which it must establish a new RPCSEC security context.

While the daemon goes about its business, the RPC task is put to sleep on a wait queue in order to allow the 'rpciod' process to service other requests. If another task wants to use the same credential, it too will be put to sleep once it reaches call_refresh(). A timeout mechanism ensures that requests are retried (or that 'soft' mounts fail) if the daemon crashes / is killed.

Once the daemon has established the RPCSEC context, it writes the result back to the pipe, causing the credential to be updated. Those RPC tasks that were sleeping on the context are automatically woken up, and their execution can proceed.

include/linux/sunrpc/auth_gss.h +1 -0
diff -u --recursive --new-file linux-2.5.56-05-rpc_gss/include/linux/sunrpc/auth_gss.h linux-2.5.56-06-auth_upcall2/include/linux/sunrpc/auth_gss.h
@@ -71,6 +71,7 @@
  * the wire when communicating with a server. */
 
 struct gss_cl_ctx {
+	atomic_t		count;
 	u32			gc_proc;
 	u32			gc_seq;
 	spinlock_t		gc_seq_lock;
include/linux/sunrpc/auth.h +1 -0
diff -u --recursive --new-file linux-2.5.56-05-rpc_gss/include/linux/sunrpc/auth.h linux-2.5.56-06-auth_upcall2/include/linux/sunrpc/auth.h
@@ -115,6 +115,7 @@
 int			rpcauth_unregister(struct rpc_authops *);
 struct rpc_auth *	rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
 void			rpcauth_destroy(struct rpc_auth *);
+struct rpc_cred *	rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
 struct rpc_cred *	rpcauth_lookupcred(struct rpc_auth *, int);
 struct rpc_cred *	rpcauth_bindcred(struct rpc_task *);
 void			rpcauth_holdcred(struct rpc_task *);
net/sunrpc/auth.c +3 -6
diff -u --recursive --new-file linux-2.5.56-05-rpc_gss/net/sunrpc/auth.c linux-2.5.56-06-auth_upcall2/net/sunrpc/auth.c
@@ -181,7 +181,7 @@
 /*
  * Look up a process' credentials in the authentication cache
  */
-static struct rpc_cred *
+struct rpc_cred *
 rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
 		int taskflags)
 {
@@ -360,10 +360,7 @@
 int
 rpcauth_uptodatecred(struct rpc_task *task)
 {
-	int retval;
-	spin_lock(&rpc_credcache_lock);
-	retval = !(task->tk_msg.rpc_cred) ||
+	return !(task->tk_msg.rpc_cred) ||
 		(task->tk_msg.rpc_cred->cr_flags & RPCAUTH_CRED_UPTODATE);
-	spin_unlock(&rpc_credcache_lock);
-	return retval;
 }
+
net/sunrpc/auth_gss/auth_gss.c +371 -13

477 lines not on this page · raw message

net/sunrpc/sunrpc_syms.c +1 -0
diff -u --recursive --new-file linux-2.5.56-05-rpc_gss/net/sunrpc/sunrpc_syms.c linux-2.5.56-06-auth_upcall2/net/sunrpc/sunrpc_syms.c
@@ -68,6 +68,7 @@
 EXPORT_SYMBOL(rpcauth_register);
 EXPORT_SYMBOL(rpcauth_unregister);
 EXPORT_SYMBOL(rpcauth_lookupcred);
+EXPORT_SYMBOL(rpcauth_lookup_credcache);
 EXPORT_SYMBOL(rpcauth_free_credcache);
 EXPORT_SYMBOL(rpcauth_init_credcache);
 EXPORT_SYMBOL(put_rpccred);