MCPcopy Create free account
hub / github.com/F-Stack/f-stack / groupmember

Function groupmember

freebsd/kern/kern_prot.c:1272–1300  ·  view source on GitHub ↗

* Check if gid is a member of the group set. */

Source from the content-addressed store, hash-verified

1270 * Check if gid is a member of the group set.
1271 */
1272int
1273groupmember(gid_t gid, struct ucred *cred)
1274{
1275 int l;
1276 int h;
1277 int m;
1278
1279 if (cred->cr_groups[0] == gid)
1280 return(1);
1281
1282 /*
1283 * If gid was not our primary group, perform a binary search
1284 * of the supplemental groups. This is possible because we
1285 * sort the groups in crsetgroups().
1286 */
1287 l = 1;
1288 h = cred->cr_ngroups;
1289 while (l < h) {
1290 m = l + ((h - l) / 2);
1291 if (cred->cr_groups[m] < gid)
1292 l = m + 1;
1293 else
1294 h = m;
1295 }
1296 if ((l < cred->cr_ngroups) && (cred->cr_groups[l] == gid))
1297 return (1);
1298
1299 return (0);
1300}
1301
1302/*
1303 * Test the active securelevel against a given level. securelevel_gt()

Callers 15

_acl_deniesFunction · 0.70
mqfs_setattrFunction · 0.70
mqf_chownFunction · 0.70
ksem_chownFunction · 0.70
cr_canseeothergidsFunction · 0.70
p_candebugFunction · 0.70
vaccess_acl_posix1eFunction · 0.70
vaccess_vexec_smrFunction · 0.70
vaccessFunction · 0.70
shm_chownFunction · 0.70
can_hardlinkFunction · 0.70
ipcpermFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected