nfsd4: name->id mapping should fail with BADOWNER not BADNAME
According to rfc 3530 BADNAME is for strings that represent paths; BADOWNER is for user/group names that don't map. And the too-long name should probably be BADOWNER as well; it's effectively the same as if we couldn't map it. Cc: stable@kernel.org Reported-by: Trond Myklebust <Trond.Myklebust@netapp.com> Reported-by: Simon Kirby <sim@hostway.ca> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
@@ -524,13 +524,13 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
|
||||
int ret;
|
||||
|
||||
if (namelen + 1 > sizeof(key.name))
|
||||
return -EINVAL;
|
||||
return -ESRCH; /* nfserr_badowner */
|
||||
memcpy(key.name, name, namelen);
|
||||
key.name[namelen] = '\0';
|
||||
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
|
||||
ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item);
|
||||
if (ret == -ENOENT)
|
||||
ret = -ESRCH; /* nfserr_badname */
|
||||
ret = -ESRCH; /* nfserr_badowner */
|
||||
if (ret)
|
||||
return ret;
|
||||
*id = item->id;
|
||||
|
Reference in New Issue
Block a user