diff options
Diffstat (limited to 'fs/nfsd/nfs4idmap.c')
-rw-r--r-- | fs/nfsd/nfs4idmap.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index 45aa21ce6784..2cf9a9a2d89c 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -587,6 +587,15 @@ idmap_lookup(struct svc_rqst *rqstp, | |||
587 | return ret; | 587 | return ret; |
588 | } | 588 | } |
589 | 589 | ||
590 | static char * | ||
591 | rqst_authname(struct svc_rqst *rqstp) | ||
592 | { | ||
593 | struct auth_domain *clp; | ||
594 | |||
595 | clp = rqstp->rq_gssclient ? rqstp->rq_gssclient : rqstp->rq_client; | ||
596 | return clp->name; | ||
597 | } | ||
598 | |||
590 | static int | 599 | static int |
591 | idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, | 600 | idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, |
592 | uid_t *id) | 601 | uid_t *id) |
@@ -600,7 +609,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen | |||
600 | return -EINVAL; | 609 | return -EINVAL; |
601 | memcpy(key.name, name, namelen); | 610 | memcpy(key.name, name, namelen); |
602 | key.name[namelen] = '\0'; | 611 | key.name[namelen] = '\0'; |
603 | strlcpy(key.authname, rqstp->rq_client->name, sizeof(key.authname)); | 612 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); |
604 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); | 613 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); |
605 | if (ret == -ENOENT) | 614 | if (ret == -ENOENT) |
606 | ret = -ESRCH; /* nfserr_badname */ | 615 | ret = -ESRCH; /* nfserr_badname */ |
@@ -620,7 +629,7 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name) | |||
620 | }; | 629 | }; |
621 | int ret; | 630 | int ret; |
622 | 631 | ||
623 | strlcpy(key.authname, rqstp->rq_client->name, sizeof(key.authname)); | 632 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); |
624 | ret = idmap_lookup(rqstp, idtoname_lookup, &key, &idtoname_cache, &item); | 633 | ret = idmap_lookup(rqstp, idtoname_lookup, &key, &idtoname_cache, &item); |
625 | if (ret == -ENOENT) | 634 | if (ret == -ENOENT) |
626 | return sprintf(name, "%u", id); | 635 | return sprintf(name, "%u", id); |