summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-10-01 00:08:42 +0000
committerguenther <guenther@openbsd.org>2012-10-01 00:08:42 +0000
commitf145108b27a098862181f4ddbee13b521a66e1dc (patch)
tree61d8c3dd50bc22b63bb9f849a0882500e15da9b3
parentCorrect the addition of the 39320LPE controller. The actual product name (diff)
downloadwireguard-openbsd-f145108b27a098862181f4ddbee13b521a66e1dc.tar.xz
wireguard-openbsd-f145108b27a098862181f4ddbee13b521a66e1dc.zip
Make groupmember() check the effective gid too, so that the checks are
consistent when the effective gid isn't also a supplementary group. ok beck@
-rw-r--r--sys/kern/kern_prot.c4
-rw-r--r--sys/kern/vfs_subr.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 982dfae4bb4..0cff5251972 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_prot.c,v 1.54 2012/04/12 10:11:41 mikeb Exp $ */
+/* $OpenBSD: kern_prot.c,v 1.55 2012/10/01 00:08:42 guenther Exp $ */
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
/*
@@ -745,6 +745,8 @@ groupmember(gid_t gid, struct ucred *cred)
gid_t *gp;
gid_t *egp;
+ if (cred->cr_gid == gid)
+ return (1);
egp = &(cred->cr_groups[cred->cr_ngroups]);
for (gp = cred->cr_groups; gp < egp; gp++)
if (*gp == gid)
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 6ed94c45ab0..9e1a850b931 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.198 2012/09/19 00:53:13 guenther Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.199 2012/10/01 00:08:43 guenther Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1578,7 +1578,7 @@ vaccess(enum vtype type, mode_t file_mode, uid_t uid, gid_t gid,
}
/* Otherwise, check the groups. */
- if (cred->cr_gid == gid || groupmember(gid, cred)) {
+ if (groupmember(gid, cred)) {
if (acc_mode & VEXEC)
mask |= S_IXGRP;
if (acc_mode & VREAD)