Lines Matching refs:ngroups

76         for (i = 0; i < uc->ngroups; i++) {  in nxt_credential_get()
78 i+1 < uc->ngroups ? ',' : '\0'); in nxt_credential_get()
98 int ngroups; in nxt_credential_groups_get() local
101 ngroups = NXT_NGROUPS; in nxt_credential_groups_get()
103 if (getgrouplist(uc->user, uc->base_gid, groups, &ngroups) < 0) { in nxt_credential_groups_get()
104 if (nxt_slow_path(ngroups <= NXT_NGROUPS)) { in nxt_credential_groups_get()
112 if (ngroups > NXT_NGROUPS) { in nxt_credential_groups_get()
113 if (ngroups > NGROUPS_MAX) { in nxt_credential_groups_get()
114 ngroups = NGROUPS_MAX; in nxt_credential_groups_get()
117 uc->ngroups = ngroups; in nxt_credential_groups_get()
119 uc->gids = nxt_mp_alloc(mp, ngroups * sizeof(gid_t)); in nxt_credential_groups_get()
125 &ngroups) < 0)) { in nxt_credential_groups_get()
136 uc->ngroups = ngroups; in nxt_credential_groups_get()
138 uc->gids = nxt_mp_alloc(mp, ngroups * sizeof(gid_t)); in nxt_credential_groups_get()
143 nxt_memcpy(uc->gids, groups, ngroups * sizeof(gid_t)); in nxt_credential_groups_get()
182 int nsaved, ngroups; in nxt_credential_groups_get() local
199 uc->ngroups = 0; in nxt_credential_groups_get()
238 ngroups = getgroups(0, NULL); in nxt_credential_groups_get()
240 if (nxt_slow_path(ngroups == -1)) { in nxt_credential_groups_get()
245 nxt_debug(task, "getgroups(0, NULL): %d", ngroups); in nxt_credential_groups_get()
247 uc->gids = nxt_mp_alloc(mp, ngroups * sizeof(nxt_gid_t)); in nxt_credential_groups_get()
253 ngroups = getgroups(ngroups, uc->gids); in nxt_credential_groups_get()
255 if (nxt_slow_path(ngroups == -1)) { in nxt_credential_groups_get()
256 nxt_alert(task, "getgroups(%d) failed %E", ngroups, nxt_errno); in nxt_credential_groups_get()
260 uc->ngroups = ngroups; in nxt_credential_groups_get()
311 uc->base_gid, uc->ngroups); in nxt_credential_setgids()
333 if (nxt_slow_path(uc->ngroups > 0 in nxt_credential_setgids()
334 && setgroups(uc->ngroups, uc->gids) != 0)) { in nxt_credential_setgids()
345 nxt_alert(task, "setgroups(%i) failed %E", uc->ngroups, nxt_errno); in nxt_credential_setgids()