2013-09-24 17:36:09

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH] NFSv4.1: try SECINFO_NO_NAME flavs until one works

Call nfs4_lookup_root_sec for each flavor returned by SECINFO_NO_NAME until
one works.

Signed-off-by: Weston Andros Adamson <[email protected]>
---
fs/nfs/nfs4proc.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 989bb9d..9043a02 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7566,6 +7566,8 @@ nfs41_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
struct page *page;
rpc_authflavor_t flavor;
struct nfs4_secinfo_flavors *flavors;
+ struct nfs4_secinfo4 *secinfo;
+ int i;

page = alloc_page(GFP_KERNEL);
if (!page) {
@@ -7587,9 +7589,26 @@ nfs41_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
if (err)
goto out_freepage;

- flavor = nfs_find_best_sec(flavors);
- if (err == 0)
- err = nfs4_lookup_root_sec(server, fhandle, info, flavor);
+ for (i = 0; i < flavors->num_flavors; i++) {
+ secinfo = &flavors->flavors[i];
+
+ switch (secinfo->flavor) {
+ case RPC_AUTH_NULL:
+ case RPC_AUTH_UNIX:
+ case RPC_AUTH_GSS:
+ flavor = rpcauth_get_pseudoflavor(secinfo->flavor,
+ &secinfo->flavor_info);
+ break;
+ }
+
+ if (flavor != RPC_AUTH_MAXFLAVOR) {
+ err = nfs4_lookup_root_sec(server, fhandle,
+ info, flavor);
+
+ if (!err)
+ break;
+ }
+ }

out_freepage:
put_page(page);
--
1.7.12.4 (Apple Git-37)



2013-09-24 17:37:01

by Adamson, Dros

[permalink] [raw]
Subject: Re: [PATCH] NFSv4.1: try SECINFO_NO_NAME flavs until one works

Bah, ignore this. Reposting?.

-dros

On Sep 24, 2013, at 1:36 PM, Weston Andros Adamson <[email protected]>
wrote:

> Call nfs4_lookup_root_sec for each flavor returned by SECINFO_NO_NAME until
> one works.
>
> Signed-off-by: Weston Andros Adamson <[email protected]>
> ---
> fs/nfs/nfs4proc.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 989bb9d..9043a02 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -7566,6 +7566,8 @@ nfs41_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
> struct page *page;
> rpc_authflavor_t flavor;
> struct nfs4_secinfo_flavors *flavors;
> + struct nfs4_secinfo4 *secinfo;
> + int i;
>
> page = alloc_page(GFP_KERNEL);
> if (!page) {
> @@ -7587,9 +7589,26 @@ nfs41_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
> if (err)
> goto out_freepage;
>
> - flavor = nfs_find_best_sec(flavors);
> - if (err == 0)
> - err = nfs4_lookup_root_sec(server, fhandle, info, flavor);
> + for (i = 0; i < flavors->num_flavors; i++) {
> + secinfo = &flavors->flavors[i];
> +
> + switch (secinfo->flavor) {
> + case RPC_AUTH_NULL:
> + case RPC_AUTH_UNIX:
> + case RPC_AUTH_GSS:
> + flavor = rpcauth_get_pseudoflavor(secinfo->flavor,
> + &secinfo->flavor_info);
> + break;
> + }
> +
> + if (flavor != RPC_AUTH_MAXFLAVOR) {
> + err = nfs4_lookup_root_sec(server, fhandle,
> + info, flavor);
> +
> + if (!err)
> + break;
> + }
> + }
>
> out_freepage:
> put_page(page);
> --
> 1.7.12.4 (Apple Git-37)
>