aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-07-17 07:04:51 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:08 -0400
commit4796f45740bc6f2e3e6cc14e7ed481b38bd0bd39 (patch)
tree1f24645e86f87511350e149525245f2b215ba55a /fs
parentdcb488a3b7ac3987e21148f44f641c9b2e734232 (diff)
knfsd: nfsd4: secinfo handling without secinfo= option
We could return some sort of error in the case where someone asks for secinfo on an export without the secinfo= option set--that'd be no worse than what we've been doing. But it's not really correct. So, hack up an approximate secinfo response in that case--it may not be complete, but it'll tell the client at least one acceptable security flavor. 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>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c30
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) {