knfsd: nfsd4: store pseudoflavor in request
authorAndy Adamson <andros@citi.umich.edu>
Tue, 17 Jul 2007 11:04:42 +0000 (04:04 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 17:23:07 +0000 (10:23 -0700)
Add a new field to the svc_rqst structure to record the pseudoflavor that the
request was made with.  For now we record the pseudoflavor but don't use it
for anything.

Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/sunrpc/gss_api.h
include/linux/sunrpc/svc.h
net/sunrpc/auth_gss/gss_mech_switch.c
net/sunrpc/auth_gss/svcauth_gss.c
net/sunrpc/svcauth_unix.c

index bbac101ac37278a518011a3962cb41a89222bdd3..459c5fc11d5182c3c313e0b573e41817baa1652e 100644 (file)
@@ -58,6 +58,7 @@ u32 gss_unwrap(
 u32 gss_delete_sec_context(
                struct gss_ctx          **ctx_id);
 
+u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service);
 u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
 char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
 
index 129d50f2225c02b8bb94505de60dc579b9a87427..705a90aa345efde08df2ee899513fc6df0bb6d5c 100644 (file)
@@ -212,6 +212,7 @@ struct svc_rqst {
        struct svc_pool *       rq_pool;        /* thread pool */
        struct svc_procedure *  rq_procinfo;    /* procedure info */
        struct auth_ops *       rq_authop;      /* authentication flavour */
+       u32                     rq_flavor;      /* pseudoflavor */
        struct svc_cred         rq_cred;        /* auth info */
        struct sk_buff *        rq_skbuff;      /* fast recv inet buffer */
        struct svc_deferred_req*rq_deferred;    /* deferred request we are replaying */
index 26872517ccf3c4efc861d190841bcb49d10eb99e..61801a069ff02c69d91313ea75df3d542ffff0e2 100644 (file)
@@ -193,6 +193,20 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
 
 EXPORT_SYMBOL(gss_mech_get_by_pseudoflavor);
 
+u32
+gss_svc_to_pseudoflavor(struct gss_api_mech *gm, u32 service)
+{
+       int i;
+
+       for (i = 0; i < gm->gm_pf_num; i++) {
+               if (gm->gm_pfs[i].service == service) {
+                       return gm->gm_pfs[i].pseudoflavor;
+               }
+       }
+       return RPC_AUTH_MAXFLAVOR; /* illegal value */
+}
+EXPORT_SYMBOL(gss_svc_to_pseudoflavor);
+
 u32
 gss_pseudoflavor_to_service(struct gss_api_mech *gm, u32 pseudoflavor)
 {
index c094583386fd2242cfc633e30235153e06d7cf35..7a3e1758bea15b681a6ef0a0ce0b2b5069dba5e7 100644 (file)
@@ -1131,6 +1131,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
                }
                svcdata->rsci = rsci;
                cache_get(&rsci->h);
+               rqstp->rq_flavor = gss_svc_to_pseudoflavor(
+                                       rsci->mechctx->mech_type, gc->gc_svc);
                ret = SVC_OK;
                goto out;
        }
index 07dcd20cbee4c366ee7ba8a0d19d7729b0b0b050..d9fdf2e4d24294a266e9b0476cd6b4e392c74828 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/sunrpc/xdr.h>
 #include <linux/sunrpc/svcsock.h>
 #include <linux/sunrpc/svcauth.h>
+#include <linux/sunrpc/gss_api.h>
 #include <linux/err.h>
 #include <linux/seq_file.h>
 #include <linux/hash.h>
@@ -707,6 +708,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp)
        svc_putnl(resv, RPC_AUTH_NULL);
        svc_putnl(resv, 0);
 
+       rqstp->rq_flavor = RPC_AUTH_NULL;
        return SVC_OK;
 }
 
@@ -784,6 +786,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
        svc_putnl(resv, RPC_AUTH_NULL);
        svc_putnl(resv, 0);
 
+       rqstp->rq_flavor = RPC_AUTH_UNIX;
        return SVC_OK;
 
 badcred: