summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-01-05 17:19:37 +0000
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-01-07 15:40:44 -0500
commitf05ef8db1abe68e3f6fc272efee51bc54ce528c5 (patch)
tree8e74dfecce221e51ec3631c66c0e4f8ce589b566
parent0dba7c2a9ed3d4a1e58f5d94fffa9f44dbe012e6 (diff)
downloadop-kernel-dev-f05ef8db1abe68e3f6fc272efee51bc54ce528c5.zip
op-kernel-dev-f05ef8db1abe68e3f6fc272efee51bc54ce528c5.tar.gz
CRED: Fix NFSD regression
Fix a regression in NFSD's permission checking introduced by the credentials patches. There are two parts to the problem, both in nfsd_setuser(): (1) The return value of set_groups() is -ve if in error, not 0, and should be checked appropriately. 0 indicates success. (2) The UID to use for fs accesses is in new->fsuid, not new->uid (which is 0). This causes CAP_DAC_OVERRIDE to always be set, rather than being cleared if the UID is anything other than 0 after squashing. Reported-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/auth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index 0184fe9..c903e04 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -76,10 +76,10 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
ret = set_groups(new, gi);
put_group_info(gi);
- if (!ret)
+ if (ret < 0)
goto error;
- if (new->uid)
+ if (new->fsuid)
new->cap_effective = cap_drop_nfsd_set(new->cap_effective);
else
new->cap_effective = cap_raise_nfsd_set(new->cap_effective,
OpenPOWER on IntegriCloud