Skip to contentSkip to conversation

Make sure svc_process call the correct pg_authenticate for multi-service port

PATCH New NeilBrown 1 participant 1 message Oct 31, 2005 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20051031165939.8227.patches@notabene

NeilBrown

author
#1 lore raw

PATCH 1/1 Make sure svc_process call the correct pg_authenticate for multi-service port

Patch against 2.6.14-rc5-mm1. Should apply against most recent 2.6 kernels. Fixes potential bug, not an actual bug (at least, not in mainline..)

--

If an RPC socket is serving multiple programs, then the pg_authenticate of the first program in the list is called, instead of pg_authenticate for the program to be run.

This does not cause a problem with any programs in the current kernel, but could confuse future code.

Also set pg_authenticate for nfsd_acl_program incase it ever gets used.

### Diffstat output

 ./fs/nfsd/nfssvc.c |    1 +
 ./net/sunrpc/svc.c |   12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
fs/nfsd/nfssvc.c renamed from fs/nfsd/nfssvc.c~current~ +1 -0
diff ./fs/nfsd/nfssvc.c~current~ ./fs/nfsd/nfssvc.c
@@ -427,6 +427,7 @@ static struct svc_program	nfsd_acl_progr
 	.pg_name		= "nfsd",
 	.pg_class		= "nfsd",
 	.pg_stats		= &nfsd_acl_svcstats,
+	.pg_authenticate	= &svc_set_client,
 };
 
 static struct svc_stat	nfsd_acl_svcstats = {
net/sunrpc/svc.c renamed from net/sunrpc/svc.c~current~ +7 -5
diff ./net/sunrpc/svc.c~current~ ./net/sunrpc/svc.c
@@ -310,6 +310,11 @@ svc_process(struct svc_serv *serv, struc
 	rqstp->rq_proc = proc = ntohl(svc_getu32(argv));	/* procedure number */
 
 	progp = serv->sv_program;
+
+	for (progp = serv->sv_program; progp; progp = progp->pg_next)
+		if (prog == progp->pg_prog)
+			break;
+
 	/*
 	 * Decode auth data, and add verifier to reply buffer.
 	 * We do this before anything else in order to get a decent
@@ -317,7 +322,7 @@ svc_process(struct svc_serv *serv, struc
 	 */
 	auth_res = svc_authenticate(rqstp, &auth_stat);
 	/* Also give the program a chance to reject this call: */
-	if (auth_res == SVC_OK) {
+	if (auth_res == SVC_OK && progp) {
 		auth_stat = rpc_autherr_badcred;
 		auth_res = progp->pg_authenticate(rqstp);
 	}
@@ -337,10 +342,7 @@ svc_process(struct svc_serv *serv, struc
 	case SVC_COMPLETE:
 		goto sendit;
 	}
-		
-	for (progp = serv->sv_program; progp; progp = progp->pg_next)
-		if (prog == progp->pg_prog)
-			break;
+
 	if (progp == NULL)
 		goto err_bad_prog;
 

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs