Lines Matching defs:ngrp

99 groups_check_positive_len(int ngrp)
101 MPASS2(ngrp >= 0, "negative number of groups");
102 MPASS2(ngrp != 0, "at least one group expected (effective GID)");
105 groups_check_max_len(int ngrp)
107 MPASS2(ngrp <= ngroups_max + 1, "too many groups");
110 static void groups_normalize(int *ngrp, gid_t *groups);
111 static void crsetgroups_internal(struct ucred *cr, int ngrp,
324 int ngrp, error;
327 ngrp = cred->cr_ngroups;
333 if (uap->gidsetsize < ngrp)
336 error = copyout(cred->cr_groups, uap->gidset, ngrp * sizeof(gid_t));
338 td->td_retval[0] = ngrp;
729 int ngrp = wcred->sc_supp_groups_nb;
735 AUDIT_ARG_GROUPSET(groups + 1, ngrp);
736 ++ngrp;
737 groups_normalize(&ngrp, groups);
738 wcred->sc_supp_groups_nb = ngrp - 1;
1235 int ngrp, error;
1237 ngrp = *ngrpp;
1239 if (ngrp < 0 || ngrp > ngroups_max + 1)
1242 AUDIT_ARG_GROUPSET(groups, ngrp);
1243 if (ngrp != 0) {
1246 ngrp = *ngrpp;
1249 if (ngrp != 0)
1250 crextend(newcred, ngrp);
1255 error = ngrp == 0 ?
1256 /* If 'ngrp' is 0, we'll keep just the current effective GID. */
1258 mac_cred_check_setgroups(oldcred, ngrp, groups);
1267 if (ngrp == 0) {
1276 crsetgroups_internal(newcred, ngrp, groups);
1689 groups_check_normalized(int ngrp, const gid_t *groups)
1693 groups_check_positive_len(ngrp);
1694 groups_check_max_len(ngrp);
1696 if (ngrp == 1)
1700 for (int i = 2; i < ngrp; ++i) {
2806 groups_normalize(int *ngrp, gid_t *groups)
2811 groups_check_positive_len(*ngrp);
2812 groups_check_max_len(*ngrp);
2814 if (*ngrp == 1)
2817 qsort(groups + 1, *ngrp - 1, sizeof(*groups), gidp_cmp);
2822 for (int i = 2; i < *ngrp; ++i) {
2832 *ngrp = ins_idx;
2834 groups_check_normalized(*ngrp, groups);
2840 * 'ngrp' must be strictly positive. Either the passed 'groups' array must have
2850 crsetgroups_internal(struct ucred *cr, int ngrp, const gid_t *groups)
2854 MPASS2(cr->cr_agroups >= ngrp, "'cr_agroups' too small");
2855 groups_check_positive_len(ngrp);
2857 bcopy(groups, cr->cr_groups, ngrp * sizeof(gid_t));
2858 cr->cr_ngroups = ngrp;
2865 * before with 'ngrp' or greater). Truncates the list to (ngroups_max + 1) if
2866 * it is too large. Array 'groups' doesn't need to be sorted. 'ngrp' must be
2870 crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups)
2873 if (ngrp > ngroups_max + 1)
2874 ngrp = ngroups_max + 1;
2882 crextend(cr, ngrp);
2883 crsetgroups_internal(cr, ngrp, groups);
2895 crsetgroups_fallback(struct ucred *cr, int ngrp, const gid_t *groups,
2898 if (ngrp == 0)
2902 crsetgroups(cr, ngrp, groups);