Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357824
b: refs/heads/master
c: 65e10f6
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman committed Feb 13, 2013
1 parent 90570d1 commit 2aed003
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b5663898ec3fa7f1a58a9def9592be345bb173c2
refs/heads/master: 65e10f6d0ab09ba95c2eb07cac43208692cf670e
8 changes: 4 additions & 4 deletions trunk/fs/nfsd/idmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ static inline void nfsd_idmap_shutdown(struct net *net)
}
#endif

__be32 nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *);
__be32 nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *);
int nfsd_map_uid_to_name(struct svc_rqst *, __u32, char *);
int nfsd_map_gid_to_name(struct svc_rqst *, __u32, char *);
__be32 nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, kuid_t *);
__be32 nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, kgid_t *);
int nfsd_map_uid_to_name(struct svc_rqst *, kuid_t, char *);
int nfsd_map_gid_to_name(struct svc_rqst *, kgid_t, char *);

#endif /* LINUX_NFSD_IDMAP_H */
26 changes: 20 additions & 6 deletions trunk/fs/nfsd/nfs4idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,26 +625,40 @@ do_id_to_name(struct svc_rqst *rqstp, int type, u32 id, char *name)

__be32
nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
__u32 *id)
kuid_t *uid)
{
return do_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id);
__be32 status;
u32 id = -1;
status = do_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, &id);
*uid = make_kuid(&init_user_ns, id);
if (!uid_valid(*uid))
status = nfserr_badowner;
return status;
}

__be32
nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
__u32 *id)
kgid_t *gid)
{
return do_name_to_id(rqstp, IDMAP_TYPE_GROUP, name, namelen, id);
__be32 status;
u32 id = -1;
status = do_name_to_id(rqstp, IDMAP_TYPE_GROUP, name, namelen, &id);
*gid = make_kgid(&init_user_ns, id);
if (!gid_valid(*gid))
status = nfserr_badowner;
return status;
}

int
nfsd_map_uid_to_name(struct svc_rqst *rqstp, __u32 id, char *name)
nfsd_map_uid_to_name(struct svc_rqst *rqstp, kuid_t uid, char *name)
{
u32 id = from_kuid(&init_user_ns, uid);
return do_id_to_name(rqstp, IDMAP_TYPE_USER, id, name);
}

int
nfsd_map_gid_to_name(struct svc_rqst *rqstp, __u32 id, char *name)
nfsd_map_gid_to_name(struct svc_rqst *rqstp, kgid_t gid, char *name)
{
u32 id = from_kgid(&init_user_ns, gid);
return do_id_to_name(rqstp, IDMAP_TYPE_GROUP, id, name);
}

0 comments on commit 2aed003

Please sign in to comment.