diff options
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 30 | ||||
-rw-r--r-- | include/linux/sunrpc/svcauth_gss.h | 1 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 9 |
3 files changed, 37 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 864498f8f2d9..b3d55c6747fd 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <linux/nfs4.h> | 57 | #include <linux/nfs4.h> |
58 | #include <linux/nfs4_acl.h> | 58 | #include <linux/nfs4_acl.h> |
59 | #include <linux/sunrpc/gss_api.h> | 59 | #include <linux/sunrpc/gss_api.h> |
60 | #include <linux/sunrpc/svcauth_gss.h> | ||
60 | 61 | ||
61 | #define NFSDDBG_FACILITY NFSDDBG_XDR | 62 | #define NFSDDBG_FACILITY NFSDDBG_XDR |
62 | 63 | ||
@@ -2454,15 +2455,38 @@ nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, int nfserr, | |||
2454 | { | 2455 | { |
2455 | int i = 0; | 2456 | int i = 0; |
2456 | struct svc_export *exp = secinfo->si_exp; | 2457 | struct svc_export *exp = secinfo->si_exp; |
2458 | u32 nflavs; | ||
2459 | struct exp_flavor_info *flavs; | ||
2460 | struct exp_flavor_info def_flavs[2]; | ||
2457 | ENCODE_HEAD; | 2461 | ENCODE_HEAD; |
2458 | 2462 | ||
2459 | if (nfserr) | 2463 | if (nfserr) |
2460 | goto out; | 2464 | goto out; |
2465 | if (exp->ex_nflavors) { | ||
2466 | flavs = exp->ex_flavors; | ||
2467 | nflavs = exp->ex_nflavors; | ||
2468 | } else { /* Handling of some defaults in absence of real secinfo: */ | ||
2469 | flavs = def_flavs; | ||
2470 | if (exp->ex_client->flavour->flavour == RPC_AUTH_UNIX) { | ||
2471 | nflavs = 2; | ||
2472 | flavs[0].pseudoflavor = RPC_AUTH_UNIX; | ||
2473 | flavs[1].pseudoflavor = RPC_AUTH_NULL; | ||
2474 | } else if (exp->ex_client->flavour->flavour == RPC_AUTH_GSS) { | ||
2475 | nflavs = 1; | ||
2476 | flavs[0].pseudoflavor | ||
2477 | = svcauth_gss_flavor(exp->ex_client); | ||
2478 | } else { | ||
2479 | nflavs = 1; | ||
2480 | flavs[0].pseudoflavor | ||
2481 | = exp->ex_client->flavour->flavour; | ||
2482 | } | ||
2483 | } | ||
2484 | |||
2461 | RESERVE_SPACE(4); | 2485 | RESERVE_SPACE(4); |
2462 | WRITE32(exp->ex_nflavors); | 2486 | WRITE32(nflavs); |
2463 | ADJUST_ARGS(); | 2487 | ADJUST_ARGS(); |
2464 | for (i = 0; i < exp->ex_nflavors; i++) { | 2488 | for (i = 0; i < nflavs; i++) { |
2465 | u32 flav = exp->ex_flavors[i].pseudoflavor; | 2489 | u32 flav = flavs[i].pseudoflavor; |
2466 | struct gss_api_mech *gm = gss_mech_get_by_pseudoflavor(flav); | 2490 | struct gss_api_mech *gm = gss_mech_get_by_pseudoflavor(flav); |
2467 | 2491 | ||
2468 | if (gm) { | 2492 | if (gm) { |
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index 5a5db16ab660..417a1def56db 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h | |||
@@ -22,6 +22,7 @@ | |||
22 | int gss_svc_init(void); | 22 | int gss_svc_init(void); |
23 | void gss_svc_shutdown(void); | 23 | void gss_svc_shutdown(void); |
24 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); | 24 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); |
25 | u32 svcauth_gss_flavor(struct auth_domain *dom); | ||
25 | 26 | ||
26 | #endif /* __KERNEL__ */ | 27 | #endif /* __KERNEL__ */ |
27 | #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ | 28 | #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index e4b3de08b040..490697542fc2 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -743,6 +743,15 @@ find_gss_auth_domain(struct gss_ctx *ctx, u32 svc) | |||
743 | 743 | ||
744 | static struct auth_ops svcauthops_gss; | 744 | static struct auth_ops svcauthops_gss; |
745 | 745 | ||
746 | u32 svcauth_gss_flavor(struct auth_domain *dom) | ||
747 | { | ||
748 | struct gss_domain *gd = container_of(dom, struct gss_domain, h); | ||
749 | |||
750 | return gd->pseudoflavor; | ||
751 | } | ||
752 | |||
753 | EXPORT_SYMBOL(svcauth_gss_flavor); | ||
754 | |||
746 | int | 755 | int |
747 | svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) | 756 | svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) |
748 | { | 757 | { |