Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 60847
b: refs/heads/master
c: 1269bc6
h: refs/heads/master
i:
  60845: 4c5bc9a
  60843: aab27ad
  60839: 920fb6a
  60831: bbc3bbd
v: v3
  • Loading branch information
J. Bruce Fields authored and Linus Torvalds committed Jul 17, 2007
1 parent 37868b9 commit 056bea3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 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: 9091224f3cff4721f295df29e8a99705a63bc4c7
refs/heads/master: 1269bc69b6649282091bb7007372acf4ab8357fd
18 changes: 16 additions & 2 deletions trunk/fs/nfsd/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,31 @@

#define CAP_NFSD_MASK (CAP_FS_MASK|CAP_TO_MASK(CAP_SYS_RESOURCE))

static int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
{
struct exp_flavor_info *f;
struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;

for (f = exp->ex_flavors; f < end; f++) {
if (f->pseudoflavor == rqstp->rq_flavor)
return f->flags;
}
return exp->ex_flags;

}

int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
{
struct svc_cred cred = rqstp->rq_cred;
int i;
int flags = nfsexp_flags(rqstp, exp);
int ret;

if (exp->ex_flags & NFSEXP_ALLSQUASH) {
if (flags & NFSEXP_ALLSQUASH) {
cred.cr_uid = exp->ex_anon_uid;
cred.cr_gid = exp->ex_anon_gid;
cred.cr_group_info = groups_alloc(0);
} else if (exp->ex_flags & NFSEXP_ROOTSQUASH) {
} else if (flags & NFSEXP_ROOTSQUASH) {
struct group_info *gi;
if (!cred.cr_uid)
cred.cr_uid = exp->ex_anon_uid;
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/nfsd/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
#define NFSEXP_ALLFLAGS 0xFE3F

/* The flags that may vary depending on security flavor: */
#define NFSEXP_SECINFO_FLAGS 0
#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
| NFSEXP_ALLSQUASH)

#ifdef __KERNEL__

Expand Down

0 comments on commit 056bea3

Please sign in to comment.