Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd4: move rq_flavor into svc_cred

Move the rq_flavor into struct svc_cred, and use it in setclientid and
exchange_id comparisons as well.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>

+13 -13
+1 -1
fs/nfsd/auth.c
··· 10 10 struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; 11 11 12 12 for (f = exp->ex_flavors; f < end; f++) { 13 - if (f->pseudoflavor == rqstp->rq_flavor) 13 + if (f->pseudoflavor == rqstp->rq_cred.cr_flavor) 14 14 return f->flags; 15 15 } 16 16 return exp->ex_flags;
+3 -3
fs/nfsd/export.c
··· 904 904 return 0; 905 905 /* ip-address based client; check sec= export option: */ 906 906 for (f = exp->ex_flavors; f < end; f++) { 907 - if (f->pseudoflavor == rqstp->rq_flavor) 907 + if (f->pseudoflavor == rqstp->rq_cred.cr_flavor) 908 908 return 0; 909 909 } 910 910 /* defaults in absence of sec= options: */ 911 911 if (exp->ex_nflavors == 0) { 912 - if (rqstp->rq_flavor == RPC_AUTH_NULL || 913 - rqstp->rq_flavor == RPC_AUTH_UNIX) 912 + if (rqstp->rq_cred.cr_flavor == RPC_AUTH_NULL || 913 + rqstp->rq_cred.cr_flavor == RPC_AUTH_UNIX) 914 914 return 0; 915 915 } 916 916 return nfserr_wrongsec;
+2 -2
fs/nfsd/nfs4idmap.c
··· 605 605 static __be32 606 606 do_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, uid_t *id) 607 607 { 608 - if (nfs4_disable_idmapping && rqstp->rq_flavor < RPC_AUTH_GSS) 608 + if (nfs4_disable_idmapping && rqstp->rq_cred.cr_flavor < RPC_AUTH_GSS) 609 609 if (numeric_name_to_id(rqstp, type, name, namelen, id)) 610 610 return 0; 611 611 /* ··· 618 618 static int 619 619 do_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name) 620 620 { 621 - if (nfs4_disable_idmapping && rqstp->rq_flavor < RPC_AUTH_GSS) 621 + if (nfs4_disable_idmapping && rqstp->rq_cred.cr_flavor < RPC_AUTH_GSS) 622 622 return sprintf(name, "%u", id); 623 623 return idmap_id_to_name(rqstp, type, id, name); 624 624 }
+3 -3
fs/nfsd/nfs4state.c
··· 1177 1177 return -ENOMEM; 1178 1178 } else 1179 1179 target->cr_principal = NULL; 1180 + target->cr_flavor = source->cr_flavor; 1180 1181 target->cr_uid = source->cr_uid; 1181 1182 target->cr_gid = source->cr_gid; 1182 1183 target->cr_group_info = source->cr_group_info; ··· 1214 1213 return true; 1215 1214 } 1216 1215 1217 - /* XXX what about NGROUP */ 1218 1216 static int 1219 1217 same_creds(struct svc_cred *cr1, struct svc_cred *cr2) 1220 1218 { 1221 - if ((cr1->cr_uid != cr2->cr_uid) 1219 + if ((cr1->cr_flavor != cr2->cr_flavor) 1220 + || (cr1->cr_uid != cr2->cr_uid) 1222 1221 || (cr1->cr_gid != cr2->cr_gid) 1223 1222 || !groups_equal(cr1->cr_group_info, cr2->cr_group_info)) 1224 1223 return false; ··· 1300 1299 rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); 1301 1300 copy_verf(clp, verf); 1302 1301 rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa); 1303 - clp->cl_flavor = rqstp->rq_flavor; 1304 1302 gen_confirm(clp); 1305 1303 clp->cl_cb_session = NULL; 1306 1304 return clp;
-1
include/linux/sunrpc/svc.h
··· 232 232 struct svc_pool * rq_pool; /* thread pool */ 233 233 struct svc_procedure * rq_procinfo; /* procedure info */ 234 234 struct auth_ops * rq_authop; /* authentication flavour */ 235 - u32 rq_flavor; /* pseudoflavor */ 236 235 struct svc_cred rq_cred; /* auth info */ 237 236 void * rq_xprt_ctxt; /* transport specific context ptr */ 238 237 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
+1
include/linux/sunrpc/svcauth.h
··· 21 21 uid_t cr_uid; 22 22 gid_t cr_gid; 23 23 struct group_info *cr_group_info; 24 + u32 cr_flavor; /* pseudoflavor */ 24 25 char *cr_principal; /* for gss */ 25 26 }; 26 27
+1 -1
net/sunrpc/auth_gss/svcauth_gss.c
··· 1202 1202 } 1203 1203 svcdata->rsci = rsci; 1204 1204 cache_get(&rsci->h); 1205 - rqstp->rq_flavor = gss_svc_to_pseudoflavor( 1205 + rqstp->rq_cred.cr_flavor = gss_svc_to_pseudoflavor( 1206 1206 rsci->mechctx->mech_type, gc->gc_svc); 1207 1207 ret = SVC_OK; 1208 1208 goto out;
+2 -2
net/sunrpc/svcauth_unix.c
··· 768 768 svc_putnl(resv, RPC_AUTH_NULL); 769 769 svc_putnl(resv, 0); 770 770 771 - rqstp->rq_flavor = RPC_AUTH_NULL; 771 + rqstp->rq_cred.cr_flavor = RPC_AUTH_NULL; 772 772 return SVC_OK; 773 773 } 774 774 ··· 839 839 svc_putnl(resv, RPC_AUTH_NULL); 840 840 svc_putnl(resv, 0); 841 841 842 - rqstp->rq_flavor = RPC_AUTH_UNIX; 842 + rqstp->rq_cred.cr_flavor = RPC_AUTH_UNIX; 843 843 return SVC_OK; 844 844 845 845 badcred: