2013-09-03 19:18:54

by Weston Andros Adamson

[permalink] [raw]
Subject: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity

Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression
that causes SECINFO to fail without actualy sending an RPC if:

1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
2) the current user doesn't have valid kerberos credentials

This situation is quite common - as of now a sec=sys mount would use
krb5i for the nfs_client's rpc_client and a user would hardly be faulted
for not having run kinit.

The solution is to use the machine cred when trying to use an integrity
protected auth flavor for SECINFO.

Older servers may not support using the machine cred or an integrity
protected auth flavor for SECINFO in every circumstance, so we fall back
to using the user's cred and the filesystem's auth flavor in this case.

We run into another problem when running against linux nfs servers -
they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
mount is also that flavor) even though that is not a valid error for
SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO
by falling back to using the user cred and the filesystem's auth flavor.

Signed-off-by: Weston Andros Adamson <[email protected]>
---

Posting my proposed client-side fixes to follow the Security Considerations
sections of the v4 and v4.1 specs wrt SECINFO.

The question remains - if servers aren't supposed to return NFS4ERR_WRONGSEC,
but only RECOMMENDED to use krb5i/p for SECINFO, how does a server tell the
client that it doesn't support that auth flavor?

Once we figure this out, I'll update the patch to retry in that case too.

There will also be similar patches to SECINFO_NONAME and LAYOUTGET (which has
a similiar regression, but doesn't have the no NFS4ERR_WRONGSEC limitation).


fs/nfs/nfs4proc.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 47 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f7c8106..e54b992 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -435,6 +435,20 @@ wait_on_recovery:
return ret;
}

+/*
+ * Return 'true' if 'clp' is using an rpc_client that is integrity protected
+ * or 'false' otherwise.
+ */
+static bool _nfs4_is_integrity_protected(struct nfs_client *clp)
+{
+ rpc_authflavor_t flavor = clp->cl_rpcclient->cl_auth->au_flavor;
+
+ if (flavor == RPC_AUTH_GSS_KRB5I ||
+ flavor == RPC_AUTH_GSS_KRB5P)
+ return true;
+
+ return false;
+}

static void do_renew_lease(struct nfs_client *clp, unsigned long timestamp)
{
@@ -5840,10 +5854,13 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
}

/**
- * Use the state managment nfs_client cl_rpcclient, which uses krb5i (if
- * possible) as per RFC3530bis and RFC5661 Security Considerations sections
+ * If 'use_integrity' is true and the state managment nfs_client
+ * cl_rpcclient is using krb5i/p, use the integrity protected cl_rpcclient
+ * and the machine credential as per RFC3530bis and RFC5661 Security
+ * Considerations sections. Otherwise, just use the user cred with the
+ * filesystem's rpc_client.
*/
-static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors)
+static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors, bool use_integrity)
{
int status;
struct nfs4_secinfo_arg args = {
@@ -5858,11 +5875,21 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct
.rpc_argp = &args,
.rpc_resp = &res,
};
- struct rpc_clnt *clnt = NFS_SERVER(dir)->nfs_client->cl_rpcclient;
+ struct rpc_clnt *clnt = NFS_SERVER(dir)->client;
+
+ if (use_integrity) {
+ clnt = NFS_SERVER(dir)->nfs_client->cl_rpcclient;
+ msg.rpc_cred = nfs4_get_clid_cred(NFS_SERVER(dir)->nfs_client);
+ }

dprintk("NFS call secinfo %s\n", name->name);
- status = nfs4_call_sync(clnt, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
+ status = nfs4_call_sync(clnt, NFS_SERVER(dir), &msg, &args.seq_args,
+ &res.seq_res, 0);
dprintk("NFS reply secinfo: %d\n", status);
+
+ if (msg.rpc_cred)
+ put_rpccred(msg.rpc_cred);
+
return status;
}

@@ -5872,7 +5899,21 @@ int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name,
struct nfs4_exception exception = { };
int err;
do {
- err = _nfs4_proc_secinfo(dir, name, flavors);
+ err = -NFS4ERR_WRONGSEC;
+
+ /* try to use integrity protection with machine cred */
+ if (_nfs4_is_integrity_protected(NFS_SERVER(dir)->nfs_client))
+ err = _nfs4_proc_secinfo(dir, name, flavors, true);
+
+ /*
+ * if unable to use integrity protection, or SECINFO with
+ * integrity protection returns NFS4ERR_WRONGSEC (which is
+ * disallowed by spec, but exists in deployed servers) use
+ * the current filesystem's rpc_client and the user cred.
+ */
+ if (err == -NFS4ERR_WRONGSEC)
+ err = _nfs4_proc_secinfo(dir, name, flavors, false);
+
trace_nfs4_secinfo(dir, name, err);
err = nfs4_handle_exception(NFS_SERVER(dir), err,
&exception);
--
1.7.12.4 (Apple Git-37)



2013-09-03 19:40:59

by Chuck Lever

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity


On Sep 3, 2013, at 3:39 PM, "Myklebust, Trond" <[email protected]> wrote:

> On Tue, 2013-09-03 at 19:30 +0000, Adamson, Dros wrote:
>> On Sep 3, 2013, at 3:25 PM, "Myklebust, Trond" <[email protected]>
>> wrote:
>>
>>> On Tue, 2013-09-03 at 15:18 -0400, Weston Andros Adamson wrote:
>>>> Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression
>>>> that causes SECINFO to fail without actualy sending an RPC if:
>>>>
>>>> 1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
>>>> 2) the current user doesn't have valid kerberos credentials
>>>>
>>>> This situation is quite common - as of now a sec=sys mount would use
>>>> krb5i for the nfs_client's rpc_client and a user would hardly be faulted
>>>> for not having run kinit.
>>>>
>>>> The solution is to use the machine cred when trying to use an integrity
>>>> protected auth flavor for SECINFO.
>>>>
>>>> Older servers may not support using the machine cred or an integrity
>>>> protected auth flavor for SECINFO in every circumstance, so we fall back
>>>> to using the user's cred and the filesystem's auth flavor in this case.
>>>>
>>>> We run into another problem when running against linux nfs servers -
>>>> they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
>>>> mount is also that flavor) even though that is not a valid error for
>>>> SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO
>>>> by falling back to using the user cred and the filesystem's auth flavor.
>>>>
>>>> Signed-off-by: Weston Andros Adamson <[email protected]>
>>>> ---
>>>
>>> Thanks! Applied?
>>
>> Oh, sorry, I was hoping to foster more discussion around Chuck's comments to the nfsd side of this effort before adding this, although it's better than the state the client was in since 5ec16a8500d339b0e7a0cc76b785d18daad354d4. Should I post the similar patches for SECINFO_NONAME and LAYOUTGET?
>>
>> Specifically, Chuck's (very valid) point is what error should a server return to SECINFO using krb5i if it doesn't support that auth flavor?
>> NFS4ERR_ACCESS looks like the best available option to me -- should I take this to the IETF list?
>
> If the server doesn't support krb5i, then it won't even be able to
> receive our RPC call, so it can at best reply with an AUTH_BADCRED rpc
> level error, which rpc_verify_header() will translate as EACCES.

What if the server supports RPCSEC_GSS, but the export options specify only sec=sys?

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





2013-09-03 19:32:22

by Adamson, Dros

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity


On Sep 3, 2013, at 3:30 PM, "Adamson, Dros" <[email protected]>
wrote:

>
> On Sep 3, 2013, at 3:25 PM, "Myklebust, Trond" <[email protected]>
> wrote:
>
>> On Tue, 2013-09-03 at 15:18 -0400, Weston Andros Adamson wrote:
>>> Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression
>>> that causes SECINFO to fail without actualy sending an RPC if:
>>>
>>> 1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
>>> 2) the current user doesn't have valid kerberos credentials
>>>
>>> This situation is quite common - as of now a sec=sys mount would use
>>> krb5i for the nfs_client's rpc_client and a user would hardly be faulted
>>> for not having run kinit.
>>>
>>> The solution is to use the machine cred when trying to use an integrity
>>> protected auth flavor for SECINFO.
>>>
>>> Older servers may not support using the machine cred or an integrity
>>> protected auth flavor for SECINFO in every circumstance, so we fall back
>>> to using the user's cred and the filesystem's auth flavor in this case.
>>>
>>> We run into another problem when running against linux nfs servers -
>>> they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
>>> mount is also that flavor) even though that is not a valid error for
>>> SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO
>>> by falling back to using the user cred and the filesystem's auth flavor.
>>>
>>> Signed-off-by: Weston Andros Adamson <[email protected]>
>>> ---
>>
>> Thanks! Applied?
>
> Oh, sorry, I was hoping to foster more discussion around Chuck's comments to the nfsd side of this effort before adding this, although it's better than the state the client was in since 5ec16a8500d339b0e7a0cc76b785d18daad354d4. Should I post the similar patches for SECINFO_NONAME and LAYOUTGET?
>
> Specifically, Chuck's (very valid) point is what error should a server return to SECINFO using krb5i if it doesn't support that auth flavor?
> NFS4ERR_ACCESS looks like the best available option to me -- should I take this to the IETF list?

? or does it seem reasonable to also retry with the user cred (and filesystem's auth flavor) when the krb5i SECINFO results in NFS4ERR_ACCESS as well as the (out of spec) WRONGSEC?

Thanks,
-dros

>
> -dros
>
>>
>> --
>> Trond Myklebust
>> Linux NFS client maintainer
>>
>> NetApp
>> [email protected]
>> http://www.netapp.com
>


2013-09-03 19:25:35

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity

T24gVHVlLCAyMDEzLTA5LTAzIGF0IDE1OjE4IC0wNDAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IENvbW1pdCA1ZWMxNmE4NTAwZDMzOWIwZTdhMGNjNzZiNzg1ZDE4ZGFhZDM1NGQ0
IGludHJvZHVjZWQgYSByZWdyZXNzaW9uDQo+IHRoYXQgY2F1c2VzIFNFQ0lORk8gdG8gZmFpbCB3
aXRob3V0IGFjdHVhbHkgc2VuZGluZyBhbiBSUEMgaWY6DQo+IA0KPiAgMSkgdGhlIG5mc19jbGll
bnQncyBycGNfY2xpZW50IHdhcy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BzaW1pbGFyIHBhdGNoZXMgZm9yIFNFQ0lORk9fTk9OQU1FIGFuZCBMQVlPVVRH
RVQ/DQo+IA0KPiBTcGVjaWZpY2FsbHksIENodWNrJ3MgKHZlcnkgdmFsaWQpIHBvaW50IGlzIHdo
YXQgZXJyb3Igc2hvdWxkIGEgc2VydmVyIHJldHVybiB0byBTRUNJTkZPIHVzaW5nIGtyYjVpIGlm
IGl0IGRvZXNuJ3Qgc3VwcG9ydCB0aGF0IGF1dGggZmxhdm9yPyAgIA0KPiBORlM0RVJSX0FDQ0VT
UyBsb29rcyBsaWtlIHRoZSBiZXN0IGF2YWlsYWJsZSBvcHRpb24gdG8gbWUgLS0gc2hvdWxkIEkg
dGFrZSB0aGlzIHRvIHRoZSBJRVRGIGxpc3Q/DQoNCklmIHRoZSBzZXJ2ZXIgZG9lc24ndCBzdXBw
b3J0IGtyYjVpLCB0aGVuIGl0IHdvbid0IGV2ZW4gYmUgYWJsZSB0bw0KcmVjZWl2ZSBvdXIgUlBD
IGNhbGwsIHNvIGl0IGNhbiBhdCBiZXN0IHJlcGx5IHdpdGggYW4gQVVUSF9CQURDUkVEIHJwYw0K
bGV2ZWwgZXJyb3IsIHdoaWNoIHJwY192ZXJpZnlfaGVhZGVyKCkgd2lsbCB0cmFuc2xhdGUgYXMg
RUFDQ0VTLg0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWludGFp
bmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAuY29t
DQo=

2013-09-03 19:45:17

by Adamson, Dros

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity


On Sep 3, 2013, at 3:39 PM, "Myklebust, Trond" <[email protected]> wrote:

> On Tue, 2013-09-03 at 19:30 +0000, Adamson, Dros wrote:
>> On Sep 3, 2013, at 3:25 PM, "Myklebust, Trond" <[email protected]>
>> wrote:
>>
>>> On Tue, 2013-09-03 at 15:18 -0400, Weston Andros Adamson wrote:
>>>> Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression
>>>> that causes SECINFO to fail without actualy sending an RPC if:
>>>>
>>>> 1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
>>>> 2) the current user doesn't have valid kerberos credentials
>>>>
>>>> This situation is quite common - as of now a sec=sys mount would use
>>>> krb5i for the nfs_client's rpc_client and a user would hardly be faulted
>>>> for not having run kinit.
>>>>
>>>> The solution is to use the machine cred when trying to use an integrity
>>>> protected auth flavor for SECINFO.
>>>>
>>>> Older servers may not support using the machine cred or an integrity
>>>> protected auth flavor for SECINFO in every circumstance, so we fall back
>>>> to using the user's cred and the filesystem's auth flavor in this case.
>>>>
>>>> We run into another problem when running against linux nfs servers -
>>>> they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
>>>> mount is also that flavor) even though that is not a valid error for
>>>> SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO
>>>> by falling back to using the user cred and the filesystem's auth flavor.
>>>>
>>>> Signed-off-by: Weston Andros Adamson <[email protected]>
>>>> ---
>>>
>>> Thanks! Applied?
>>
>> Oh, sorry, I was hoping to foster more discussion around Chuck's comments to the nfsd side of this effort before adding this, although it's better than the state the client was in since 5ec16a8500d339b0e7a0cc76b785d18daad354d4. Should I post the similar patches for SECINFO_NONAME and LAYOUTGET?
>>
>> Specifically, Chuck's (very valid) point is what error should a server return to SECINFO using krb5i if it doesn't support that auth flavor?
>> NFS4ERR_ACCESS looks like the best available option to me -- should I take this to the IETF list?
>
> If the server doesn't support krb5i, then it won't even be able to
> receive our RPC call, so it can at best reply with an AUTH_BADCRED rpc
> level error, which rpc_verify_header() will translate as EACCES.

I'm sorry, I mean if the server supports krb5i, but not for SECINFO. If the server doesn't support krb5i or there is a misconfiguration / time skew /etc, the client won't be using krb5i for the nfs_client's rpc_client and we'll never attempt to use it for SECINFO.

-dros

>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com


2013-09-03 19:55:49

by Adamson, Dros

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity


On Sep 3, 2013, at 3:52 PM, "Myklebust, Trond" <[email protected]> wrote:

> On Tue, 2013-09-03 at 15:40 -0400, Chuck Lever wrote:
>> On Sep 3, 2013, at 3:39 PM, "Myklebust, Trond" <[email protected]> wrote:
>>
>>> On Tue, 2013-09-03 at 19:30 +0000, Adamson, Dros wrote:
>>>> On Sep 3, 2013, at 3:25 PM, "Myklebust, Trond" <[email protected]>
>>>> wrote:
>>>>
>>>>> On Tue, 2013-09-03 at 15:18 -0400, Weston Andros Adamson wrote:
>>>>>> Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression
>>>>>> that causes SECINFO to fail without actualy sending an RPC if:
>>>>>>
>>>>>> 1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
>>>>>> 2) the current user doesn't have valid kerberos credentials
>>>>>>
>>>>>> This situation is quite common - as of now a sec=sys mount would use
>>>>>> krb5i for the nfs_client's rpc_client and a user would hardly be faulted
>>>>>> for not having run kinit.
>>>>>>
>>>>>> The solution is to use the machine cred when trying to use an integrity
>>>>>> protected auth flavor for SECINFO.
>>>>>>
>>>>>> Older servers may not support using the machine cred or an integrity
>>>>>> protected auth flavor for SECINFO in every circumstance, so we fall back
>>>>>> to using the user's cred and the filesystem's auth flavor in this case.
>>>>>>
>>>>>> We run into another problem when running against linux nfs servers -
>>>>>> they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
>>>>>> mount is also that flavor) even though that is not a valid error for
>>>>>> SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO
>>>>>> by falling back to using the user cred and the filesystem's auth flavor.
>>>>>>
>>>>>> Signed-off-by: Weston Andros Adamson <[email protected]>
>>>>>> ---
>>>>>
>>>>> Thanks! Applied?
>>>>
>>>> Oh, sorry, I was hoping to foster more discussion around Chuck's comments to the nfsd side of this effort before adding this, although it's better than the state the client was in since 5ec16a8500d339b0e7a0cc76b785d18daad354d4. Should I post the similar patches for SECINFO_NONAME and LAYOUTGET?
>>>>
>>>> Specifically, Chuck's (very valid) point is what error should a server return to SECINFO using krb5i if it doesn't support that auth flavor?
>>>> NFS4ERR_ACCESS looks like the best available option to me -- should I take this to the IETF list?
>>>
>>> If the server doesn't support krb5i, then it won't even be able to
>>> receive our RPC call, so it can at best reply with an AUTH_BADCRED rpc
>>> level error, which rpc_verify_header() will translate as EACCES.
>>
>> What if the server supports RPCSEC_GSS, but the export options specify only sec=sys?
>
> RFC5661 specifically states that it should accept the SECINFO call with
> RPCSEC_GSS in that case.
>
> RFC3530bis does too, but there may be a legacy RFC3530 issue there.

I guess as far as this patch (and forthcoming SECINFO_NONAME) goes, do we want to retry (falling back to user cred) on NFS4ERR_ACCESS too?

-dros

>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com


2013-09-03 19:59:17

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity

T24gVHVlLCAyMDEzLTA5LTAzIGF0IDE5OjU1ICswMDAwLCBBZGFtc29uLCBEcm9zIHdyb3RlOg0K
PiBPbiBTZXAgMywgMjAxMywgYXQgMzo1MiBQTSwgIk15a2xlYnVzdCwgVHJvbmQiIDxUcm9uZC5N
eWtsZWJ1c3RAbmV0YXBwLmNvbT4gd3JvdGU6DQo+IA0KPiA+IE9uIFR1ZSwgMjAxMy0wOS0wMyBh
dCAxNTo0MCAtMDQwMCwgQ2h1Y2sgTGV2ZXIgd3JvdGU6DQo+ID4+IE9uIFNlcCAzLCAyMDEzLCBh
dCAzOjM5IFBNLCAiTXlrbGVidXN0LCBUcm9uZCIgPFRyb25kLk15a2xlYnVzdEBuZXRhcHAuY29t
PiB3cm90ZToNCj4gPj4gDQo+ID4+PiBPbiBUdWUsIDIwMTMtMDktMDMgYXQgMTk6MzAgKzAwMDAs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yB0b28sIGJ1dCB0aGVyZSBtYXkgYmUgYSBsZWdhY3kgUkZDMzUzMCBpc3N1ZSB0aGVy
ZS4NCg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0K
DQpOZXRBcHANClRyb25kLk15a2xlYnVzdEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0K

2013-09-03 19:30:15

by Adamson, Dros

[permalink] [raw]
Subject: Re: [PATCH] NFSv4: use the mach cred for SECINFO w/ integrity


On Sep 3, 2013, at 3:25 PM, "Myklebust, Trond" <[email protected]>
wrote:

> On Tue, 2013-09-03 at 15:18 -0400, Weston Andros Adamson wrote:
>> Commit 5ec16a8500d339b0e7a0cc76b785d18daad354d4 introduced a regression
>> that causes SECINFO to fail without actualy sending an RPC if:
>>
>> 1) the nfs_client's rpc_client was using KRB5i/p (now tried by default)
>> 2) the current user doesn't have valid kerberos credentials
>>
>> This situation is quite common - as of now a sec=sys mount would use
>> krb5i for the nfs_client's rpc_client and a user would hardly be faulted
>> for not having run kinit.
>>
>> The solution is to use the machine cred when trying to use an integrity
>> protected auth flavor for SECINFO.
>>
>> Older servers may not support using the machine cred or an integrity
>> protected auth flavor for SECINFO in every circumstance, so we fall back
>> to using the user's cred and the filesystem's auth flavor in this case.
>>
>> We run into another problem when running against linux nfs servers -
>> they return NFS4ERR_WRONGSEC when using integrity auth flavor (unless the
>> mount is also that flavor) even though that is not a valid error for
>> SECINFO*. Even though it's against spec, handle WRONGSEC errors on SECINFO
>> by falling back to using the user cred and the filesystem's auth flavor.
>>
>> Signed-off-by: Weston Andros Adamson <[email protected]>
>> ---
>
> Thanks! Applied?

Oh, sorry, I was hoping to foster more discussion around Chuck's comments to the nfsd side of this effort before adding this, although it's better than the state the client was in since 5ec16a8500d339b0e7a0cc76b785d18daad354d4. Should I post the similar patches for SECINFO_NONAME and LAYOUTGET?

Specifically, Chuck's (very valid) point is what error should a server return to SECINFO using krb5i if it doesn't support that auth flavor?
NFS4ERR_ACCESS looks like the best available option to me -- should I take this to the IETF list?

-dros

>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com