Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347677
b: refs/heads/master
c: a36b172
h: refs/heads/master
i:
  347675: 4a5d509
v: v3
  • Loading branch information
J. Bruce Fields committed Nov 27, 2012
1 parent ad35899 commit dd1c1e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 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: 063b0fb9fadadc0caaea6c8f31e3f6bc978a4904
refs/heads/master: a36b1725b342c8131a86a0238789d8e7bcb490dd
25 changes: 12 additions & 13 deletions trunk/fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@
#define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL

static __be32
check_filename(char *str, int len, __be32 err)
check_filename(char *str, int len)
{
int i;

if (len == 0)
return nfserr_inval;
if (isdotent(str, len))
return err;
return nfserr_badname;
for (i = 0; i < len; i++)
if (str[i] == '/')
return err;
return nfserr_badname;
return 0;
}

Expand Down Expand Up @@ -570,7 +570,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
READ32(create->cr_namelen);
READ_BUF(create->cr_namelen);
SAVEMEM(create->cr_name, create->cr_namelen);
if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval)))
if ((status = check_filename(create->cr_name, create->cr_namelen)))
return status;

status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr,
Expand Down Expand Up @@ -602,7 +602,7 @@ nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
READ32(link->li_namelen);
READ_BUF(link->li_namelen);
SAVEMEM(link->li_name, link->li_namelen);
if ((status = check_filename(link->li_name, link->li_namelen, nfserr_inval)))
if ((status = check_filename(link->li_name, link->li_namelen)))
return status;

DECODE_TAIL;
Expand Down Expand Up @@ -696,7 +696,7 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup
READ32(lookup->lo_len);
READ_BUF(lookup->lo_len);
SAVEMEM(lookup->lo_name, lookup->lo_len);
if ((status = check_filename(lookup->lo_name, lookup->lo_len, nfserr_noent)))
if ((status = check_filename(lookup->lo_name, lookup->lo_len)))
return status;

DECODE_TAIL;
Expand Down Expand Up @@ -860,7 +860,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
READ32(open->op_fname.len);
READ_BUF(open->op_fname.len);
SAVEMEM(open->op_fname.data, open->op_fname.len);
if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval)))
if ((status = check_filename(open->op_fname.data, open->op_fname.len)))
return status;
break;
case NFS4_OPEN_CLAIM_PREVIOUS:
Expand All @@ -875,7 +875,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
READ32(open->op_fname.len);
READ_BUF(open->op_fname.len);
SAVEMEM(open->op_fname.data, open->op_fname.len);
if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval)))
if ((status = check_filename(open->op_fname.data, open->op_fname.len)))
return status;
break;
case NFS4_OPEN_CLAIM_FH:
Expand Down Expand Up @@ -987,7 +987,7 @@ nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove
READ32(remove->rm_namelen);
READ_BUF(remove->rm_namelen);
SAVEMEM(remove->rm_name, remove->rm_namelen);
if ((status = check_filename(remove->rm_name, remove->rm_namelen, nfserr_noent)))
if ((status = check_filename(remove->rm_name, remove->rm_namelen)))
return status;

DECODE_TAIL;
Expand All @@ -1005,9 +1005,9 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename
READ32(rename->rn_tnamelen);
READ_BUF(rename->rn_tnamelen);
SAVEMEM(rename->rn_tname, rename->rn_tnamelen);
if ((status = check_filename(rename->rn_sname, rename->rn_snamelen, nfserr_noent)))
if ((status = check_filename(rename->rn_sname, rename->rn_snamelen)))
return status;
if ((status = check_filename(rename->rn_tname, rename->rn_tnamelen, nfserr_inval)))
if ((status = check_filename(rename->rn_tname, rename->rn_tnamelen)))
return status;

DECODE_TAIL;
Expand All @@ -1034,8 +1034,7 @@ nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
READ32(secinfo->si_namelen);
READ_BUF(secinfo->si_namelen);
SAVEMEM(secinfo->si_name, secinfo->si_namelen);
status = check_filename(secinfo->si_name, secinfo->si_namelen,
nfserr_noent);
status = check_filename(secinfo->si_name, secinfo->si_namelen);
if (status)
return status;
DECODE_TAIL;
Expand Down

0 comments on commit dd1c1e1

Please sign in to comment.