diff options
Diffstat (limited to 'fs/nfsd/auth.c')
-rw-r--r-- | fs/nfsd/auth.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c index 6e92b0fe5323..cf61dc8ae942 100644 --- a/fs/nfsd/auth.c +++ b/fs/nfsd/auth.c | |||
@@ -12,17 +12,31 @@ | |||
12 | 12 | ||
13 | #define CAP_NFSD_MASK (CAP_FS_MASK|CAP_TO_MASK(CAP_SYS_RESOURCE)) | 13 | #define CAP_NFSD_MASK (CAP_FS_MASK|CAP_TO_MASK(CAP_SYS_RESOURCE)) |
14 | 14 | ||
15 | static int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp) | ||
16 | { | ||
17 | struct exp_flavor_info *f; | ||
18 | struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; | ||
19 | |||
20 | for (f = exp->ex_flavors; f < end; f++) { | ||
21 | if (f->pseudoflavor == rqstp->rq_flavor) | ||
22 | return f->flags; | ||
23 | } | ||
24 | return exp->ex_flags; | ||
25 | |||
26 | } | ||
27 | |||
15 | int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) | 28 | int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) |
16 | { | 29 | { |
17 | struct svc_cred cred = rqstp->rq_cred; | 30 | struct svc_cred cred = rqstp->rq_cred; |
18 | int i; | 31 | int i; |
32 | int flags = nfsexp_flags(rqstp, exp); | ||
19 | int ret; | 33 | int ret; |
20 | 34 | ||
21 | if (exp->ex_flags & NFSEXP_ALLSQUASH) { | 35 | if (flags & NFSEXP_ALLSQUASH) { |
22 | cred.cr_uid = exp->ex_anon_uid; | 36 | cred.cr_uid = exp->ex_anon_uid; |
23 | cred.cr_gid = exp->ex_anon_gid; | 37 | cred.cr_gid = exp->ex_anon_gid; |
24 | cred.cr_group_info = groups_alloc(0); | 38 | cred.cr_group_info = groups_alloc(0); |
25 | } else if (exp->ex_flags & NFSEXP_ROOTSQUASH) { | 39 | } else if (flags & NFSEXP_ROOTSQUASH) { |
26 | struct group_info *gi; | 40 | struct group_info *gi; |
27 | if (!cred.cr_uid) | 41 | if (!cred.cr_uid) |
28 | cred.cr_uid = exp->ex_anon_uid; | 42 | cred.cr_uid = exp->ex_anon_uid; |