Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/sys/sys Stub groupmember() has to test b...



details:   https://anonhg.NetBSD.org/src/rev/54413b84f09e
branches:  trunk
changeset: 955797:54413b84f09e
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Oct 12 08:21:21 2020 +0000

description:
Stub groupmember() has to test both group list and current group id.

Fixes kern/55675: ZFS mounts do not work with setuid programs

diffstat:

 external/cddl/osnet/sys/sys/cred.h |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (25 lines):

diff -r 1eaead33cb9f -r 54413b84f09e external/cddl/osnet/sys/sys/cred.h
--- a/external/cddl/osnet/sys/sys/cred.h        Sun Oct 11 22:46:24 2020 +0000
+++ b/external/cddl/osnet/sys/sys/cred.h        Mon Oct 12 08:21:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cred.h,v 1.7 2020/04/29 05:54:37 riastradh Exp $       */
+/*     $NetBSD: cred.h,v 1.8 2020/10/12 08:21:21 hannken Exp $ */
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd%FreeBSD.org@localhost>
@@ -70,10 +70,12 @@
 static __inline int
 groupmember(gid_t gid, cred_t *cr) 
 {
-       int result;
+       int result, error;
 
-       kauth_cred_ismember_gid(cr, gid, &result);
-       return result;
+       error = kauth_cred_ismember_gid(cr, gid, &result);
+       if (error)
+               return 0;
+       return (kauth_cred_getegid(cr) == gid || result);
 }
 
 #endif /* _KERNEL */



Home | Main Index | Thread Index | Old Index