MCPcopy Create free account
hub / github.com/apache/httpd / initgroups

Function initgroups

server/mpm_common.c:267–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265
266#ifndef HAVE_INITGROUPS
267int initgroups(const char *name, gid_t basegid)
268{
269#if defined(_OSD_POSIX) || defined(OS2) || defined(WIN32) || defined(NETWARE)
270 return 0;
271#else
272 gid_t groups[NGROUPS_MAX];
273 struct group *g;
274 int index = 0;
275
276 setgrent();
277
278 groups[index++] = basegid;
279
280 while (index < NGROUPS_MAX && ((g = getgrent()) != NULL)) {
281 if (g->gr_gid != basegid) {
282 char **names;
283
284 for (names = g->gr_mem; *names != NULL; ++names) {
285 if (!strcmp(*names, name))
286 groups[index++] = g->gr_gid;
287 }
288 }
289 }
290
291 endgrent();
292
293 return setgroups(index, groups);
294#endif
295}
296#endif /* def HAVE_INITGROUPS */
297
298/* standard mpm configuration handling */

Callers 2

set_group_privsFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected