|
@@ -37,6 +37,7 @@
|
|
|
#include <linux/sched.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include "idmap.h"
|
|
|
+#include "nfsd.h"
|
|
|
|
|
|
/*
|
|
|
* Cache entry
|
|
@@ -514,7 +515,7 @@ rqst_authname(struct svc_rqst *rqstp)
|
|
|
return clp->name;
|
|
|
}
|
|
|
|
|
|
-static int
|
|
|
+static __be32
|
|
|
idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen,
|
|
|
uid_t *id)
|
|
|
{
|
|
@@ -524,15 +525,15 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
|
|
|
int ret;
|
|
|
|
|
|
if (namelen + 1 > sizeof(key.name))
|
|
|
- return -ESRCH; /* nfserr_badowner */
|
|
|
+ return 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_badowner */
|
|
|
+ return nfserr_badowner;
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ return nfserrno(ret);
|
|
|
*id = item->id;
|
|
|
cache_put(&item->h, &nametoid_cache);
|
|
|
return 0;
|
|
@@ -560,14 +561,14 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int
|
|
|
+__be32
|
|
|
nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
|
|
|
__u32 *id)
|
|
|
{
|
|
|
return idmap_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id);
|
|
|
}
|
|
|
|
|
|
-int
|
|
|
+__be32
|
|
|
nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
|
|
|
__u32 *id)
|
|
|
{
|