Commit 066a0e3d authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Bugfixes for the NFSv4 client name to uid mapper.

Fixes a memory-scribble problem.
parent 530eb115
......@@ -146,7 +146,8 @@ nfs_idmap_id(struct nfs_server *server, u_int8_t type, char *name,
struct idmap *idmap = server->idmap;
struct idmap_msg *im;
DECLARE_WAITQUEUE(wq, current);
int ret = -1, hashtype = IDMAP_HASH_TYPE_NAME, xnamelen = namelen;
int ret = -1, hashtype = IDMAP_HASH_TYPE_NAME;
u_int xnamelen = namelen;
if (idmap == NULL)
return (-1);
......@@ -169,15 +170,6 @@ nfs_idmap_id(struct nfs_server *server, u_int8_t type, char *name,
memset(im, 0, sizeof(*im));
memcpy(im->im_name, name, namelen);
/* Make sure the string is NULL terminated */
if (namelen != xnamelen) {
/* We cannot fit a NULL character */
if (namelen == IDMAP_NAMESZ) {
ret = -1;
goto out;
}
im->im_name[namelen] = '\0';
}
im->im_type = type;
im->im_conv = IDMAP_CONV_NAMETOID;
......
......@@ -241,8 +241,8 @@ encode_attrs(struct xdr_stream *xdr, struct iattr *iap,
{
char owner_name[256];
char owner_group[256];
int owner_namelen = 0;
int owner_grouplen = 0;
int owner_namelen = sizeof(owner_name);
int owner_grouplen = sizeof(owner_group);
uint32_t *p;
uint32_t *q;
int len;
......@@ -1476,7 +1476,7 @@ decode_getattr(struct xdr_stream *xdr, struct nfs4_getattr *getattr,
READ_BUF(dummy32);
len += (XDR_QUADLEN(dummy32) << 2);
if ((status = nfs_idmap_id(server, IDMAP_TYPE_USER,
(char *)p, len, &nfp->uid)) == -1) {
(char *)p, dummy32, &nfp->uid)) == -1) {
dprintk("read_attrs: gss_get_num failed!\n");
/* goto out; */
nfp->uid = -2;
......@@ -1494,7 +1494,7 @@ decode_getattr(struct xdr_stream *xdr, struct nfs4_getattr *getattr,
READ_BUF(dummy32);
len += (XDR_QUADLEN(dummy32) << 2);
if ((status = nfs_idmap_id(server, IDMAP_TYPE_GROUP,
(char *)p, len, &nfp->gid)) == -1) {
(char *)p, dummy32, &nfp->gid)) == -1) {
dprintk("read_attrs: gss_get_num failed!\n");
nfp->gid = -2;
/* goto out; */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment