From 056bea3706799ff795f03df976f95c5b473de497 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Tue, 17 Jul 2007 04:04:52 -0700 Subject: [PATCH] --- yaml --- r: 60847 b: refs/heads/master c: 1269bc69b6649282091bb7007372acf4ab8357fd h: refs/heads/master i: 60845: 4c5bc9af12bc2a0e1272644dcc639396d6220603 60843: aab27ad1e15a8867e73032a2029f53df257073a8 60839: 920fb6a80a226c9c1b877618f0f1a13127fb0e8c 60831: bbc3bbd475bfeeea443f63077fb2961e578cd19c v: v3 --- [refs] | 2 +- trunk/fs/nfsd/auth.c | 18 ++++++++++++++++-- trunk/include/linux/nfsd/export.h | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 0d2292e21f4b..1307abbc082b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9091224f3cff4721f295df29e8a99705a63bc4c7 +refs/heads/master: 1269bc69b6649282091bb7007372acf4ab8357fd diff --git a/trunk/fs/nfsd/auth.c b/trunk/fs/nfsd/auth.c index 6e92b0fe5323..cf61dc8ae942 100644 --- a/trunk/fs/nfsd/auth.c +++ b/trunk/fs/nfsd/auth.c @@ -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; diff --git a/trunk/include/linux/nfsd/export.h b/trunk/include/linux/nfsd/export.h index a01f775cb944..78feb7beff75 100644 --- a/trunk/include/linux/nfsd/export.h +++ b/trunk/include/linux/nfsd/export.h @@ -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__