2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-14 00:04:00 +08:00

nfsd: fix krb5 handling of anonymous principals

krb5 mounts started failing as of
683428fae8 "sunrpc: Update svcgss xdr
handle to rpsec_contect cache".

The problem is that mounts are usually done with some host principal
which isn't normally mapped to any user, in which case svcgssd passes
down uid -1, which the kernel is then expected to map to the
export-specific anonymous uid or gid.

The new uid_valid/gid_valid checks were therefore causing that downcall
to fail.

(Note the regression may not have been seen with older userspace that
tended to map unknown principals to an anonymous id on their own rather
than leaving it to the kernel.)

Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
J. Bruce Fields 2013-03-04 08:44:01 -05:00
parent 6dbe51c251
commit 3c34ae11fa

View File

@ -447,17 +447,21 @@ static int rsc_parse(struct cache_detail *cd,
else {
int N, i;
/*
* NOTE: we skip uid_valid()/gid_valid() checks here:
* instead, * -1 id's are later mapped to the
* (export-specific) anonymous id by nfsd_setuser.
*
* (But supplementary gid's get no such special
* treatment so are checked for validity here.)
*/
/* uid */
rsci.cred.cr_uid = make_kuid(&init_user_ns, id);
if (!uid_valid(rsci.cred.cr_uid))
goto out;
/* gid */
if (get_int(&mesg, &id))
goto out;
rsci.cred.cr_gid = make_kgid(&init_user_ns, id);
if (!gid_valid(rsci.cred.cr_gid))
goto out;
/* number of additional gid's */
if (get_int(&mesg, &N))