aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2013-03-16 15:56:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-03-29 15:44:58 -0400
commit9a744ba3983698307a7690541c00549ac7edf316 (patch)
tree2e2b24bba3dbb65d4292e25012673048517a4c83 /fs/nfs/nfs4proc.c
parent83ca7f5ab31f57506bb35482e4b0426be653196a (diff)
NFS: Use static list of security flavors during root FH lookup recovery
If the Linux NFS client receives an NFS4ERR_WRONGSEC error while trying to look up an NFS server's root file handle, it retries the lookup operation with various security flavors to see what flavor the NFS server will accept for pseudo-fs access. The list of flavors the client uses during retry consists only of flavors that are currently registered in the kernel RPC client. This list may not include any GSS pseudoflavors if auth_rpcgss.ko has not yet been loaded. Let's instead use a static list of security flavors that the NFS standard requires the server to implement (RFC 3530bis, section 3.2.1). The RPC client should now be able to load support for these dynamically; if not, they are skipped. Recovery behavior here is prescribed by RFC 3530bis, section 15.33.5: > For LOOKUPP, PUTROOTFH and PUTPUBFH, the client will be unable to > use the SECINFO operation since SECINFO requires a current > filehandle and none exist for these two [sic] operations. Therefore, > the client must iterate through the security triples available at > the client and reattempt the PUTROOTFH or PUTPUBFH operation. In > the unfortunate event none of the MANDATORY security triples are > supported by the client and server, the client SHOULD try using > others that support integrity. Failing that, the client can try > using AUTH_NONE, but because such forms lack integrity checks, > this puts the client at risk. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 510a7dd84c46..dd3a43792df0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2514,27 +2514,35 @@ out:
2514 return ret; 2514 return ret;
2515} 2515}
2516 2516
2517/*
2518 * Retry pseudoroot lookup with various security flavors. We do this when:
2519 *
2520 * NFSv4.0: the PUTROOTFH operation returns NFS4ERR_WRONGSEC
2521 * NFSv4.1: the server does not support the SECINFO_NO_NAME operation
2522 *
2523 * Returns zero on success, or a negative NFS4ERR value, or a
2524 * negative errno value.
2525 */
2517static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle, 2526static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
2518 struct nfs_fsinfo *info) 2527 struct nfs_fsinfo *info)
2519{ 2528{
2520 int i, len, status = 0; 2529 /* Per 3530bis 15.33.5 */
2521 rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS]; 2530 static const rpc_authflavor_t flav_array[] = {
2522 2531 RPC_AUTH_GSS_KRB5P,
2523 len = rpcauth_list_flavors(flav_array, ARRAY_SIZE(flav_array)); 2532 RPC_AUTH_GSS_KRB5I,
2524 if (len < 0) 2533 RPC_AUTH_GSS_KRB5,
2525 return len; 2534 RPC_AUTH_NULL,
2526 2535 };
2527 for (i = 0; i < len; i++) { 2536 int status = -EPERM;
2528 /* AUTH_UNIX is the default flavor if none was specified, 2537 size_t i;
2529 * thus has already been tried. */
2530 if (flav_array[i] == RPC_AUTH_UNIX)
2531 continue;
2532 2538
2539 for (i = 0; i < ARRAY_SIZE(flav_array); i++) {
2533 status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]); 2540 status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]);
2534 if (status == -NFS4ERR_WRONGSEC || status == -EACCES) 2541 if (status == -NFS4ERR_WRONGSEC || status == -EACCES)
2535 continue; 2542 continue;
2536 break; 2543 break;
2537 } 2544 }
2545
2538 /* 2546 /*
2539 * -EACCESS could mean that the user doesn't have correct permissions 2547 * -EACCESS could mean that the user doesn't have correct permissions
2540 * to access the mount. It could also mean that we tried to mount 2548 * to access the mount. It could also mean that we tried to mount