From 06dea103807ed57621d5711edafc4da2f2d9bbc6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 10 Jul 2009 10:58:06 -0700 Subject: [PATCH] Add basic groupmember() function, not sup groups. --- include/sys/cred.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/sys/cred.h b/include/sys/cred.h index 1e7d3b7..47eeda2 100644 --- a/include/sys/cred.h +++ b/include/sys/cred.h @@ -61,6 +61,18 @@ crgetgroups(cred_t *cr) return NULL; } +static __inline__ int +groupmember(gid_t gid, const cred_t *cr) +{ + /* Primary group check */ + if ((cr) && (gid == cr->cr_gid)) + return 1; + + /* Supplemental group check (unsupported) */ + return 0; +} + + #ifdef __cplusplus } #endif -- 2.40.0