Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
5cf36cfd
Commit
5cf36cfd
authored
Feb 22, 2011
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSv4: If the server sends us a numeric uid/gid then accept it
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
75247aff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
fs/nfs/idmap.c
fs/nfs/idmap.c
+26
-2
No files found.
fs/nfs/idmap.c
View file @
5cf36cfd
...
...
@@ -33,6 +33,24 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
static
int
nfs_map_string_to_numeric
(
const
char
*
name
,
size_t
namelen
,
__u32
*
res
)
{
unsigned
long
val
;
char
buf
[
16
];
if
(
memchr
(
name
,
'@'
,
namelen
)
!=
NULL
||
namelen
>=
sizeof
(
buf
))
return
0
;
memcpy
(
buf
,
name
,
namelen
);
buf
[
namelen
]
=
'\0'
;
if
(
strict_strtoul
(
buf
,
0
,
&
val
)
!=
0
)
return
0
;
*
res
=
val
;
return
1
;
}
#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
...
...
@@ -42,7 +60,6 @@
#include <linux/keyctl.h>
#include <linux/key-type.h>
#include <linux/rcupdate.h>
#include <linux/kernel.h>
#include <linux/err.h>
#include <keys/user-type.h>
...
...
@@ -221,11 +238,15 @@ static int nfs_idmap_lookup_id(const char *name, size_t namelen,
int
nfs_map_name_to_uid
(
struct
nfs_client
*
clp
,
const
char
*
name
,
size_t
namelen
,
__u32
*
uid
)
{
if
(
nfs_map_string_to_numeric
(
name
,
namelen
,
uid
))
return
0
;
return
nfs_idmap_lookup_id
(
name
,
namelen
,
"uid"
,
uid
);
}
int
nfs_map_group_to_gid
(
struct
nfs_client
*
clp
,
const
char
*
name
,
size_t
namelen
,
__u32
*
gid
)
{
if
(
nfs_map_string_to_numeric
(
name
,
namelen
,
gid
))
return
0
;
return
nfs_idmap_lookup_id
(
name
,
namelen
,
"gid"
,
gid
);
}
...
...
@@ -243,7 +264,6 @@ int nfs_map_gid_to_group(struct nfs_client *clp, __u32 gid, char *buf, size_t bu
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/in.h>
...
...
@@ -699,6 +719,8 @@ int nfs_map_name_to_uid(struct nfs_client *clp, const char *name, size_t namelen
{
struct
idmap
*
idmap
=
clp
->
cl_idmap
;
if
(
nfs_map_string_to_numeric
(
name
,
namelen
,
uid
))
return
0
;
return
nfs_idmap_id
(
idmap
,
&
idmap
->
idmap_user_hash
,
name
,
namelen
,
uid
);
}
...
...
@@ -706,6 +728,8 @@ int nfs_map_group_to_gid(struct nfs_client *clp, const char *name, size_t namele
{
struct
idmap
*
idmap
=
clp
->
cl_idmap
;
if
(
nfs_map_string_to_numeric
(
name
,
namelen
,
uid
))
return
0
;
return
nfs_idmap_id
(
idmap
,
&
idmap
->
idmap_group_hash
,
name
,
namelen
,
uid
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment