diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 30 |
1 files changed, 27 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) { |