2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * afs_xsetgroups (asserts FALSE)
12 * setpag (aliased to use_setpag in sysincludes.h)
14 #include <afsconfig.h>
15 #include "afs/param.h"
20 #include "afs/sysincludes.h"
21 #include "afsincludes.h"
22 #include "afs/afs_stats.h" /* statistics */
32 afs_getgroups(struct AFS_UCRED *cred, gid_t * gidset)
37 AFS_STATCNT(afs_getgroups);
39 gidset[0] = gidset[1] = 0;
40 savengrps = ngrps = cred->cr_ngroups;
50 afs_setgroups(struct AFS_UCRED **cred, int ngroups, gid_t * gidset,
57 AFS_STATCNT(afs_setgroups);
59 if (ngroups > NGROUPS_MAX)
62 *cred = (struct AFS_UCRED *)crcopy(*cred);
63 (*cred)->cr_ngroups = ngroups;
64 gp = (*cred)->cr_groups;
71 usr_setpag(struct usr_ucred **cred, afs_uint32 pagvalue, afs_uint32 * newpag,
80 gidset = (gid_t *) osi_AllocSmallSpace(AFS_SMALLOCSIZ);
81 ngroups = afs_getgroups(*cred, gidset);
83 if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
84 /* We will have to shift grouplist to make room for pag */
85 if ((sizeof gidset[0]) * (ngroups + 2) > AFS_SMALLOCSIZ) {
86 osi_FreeSmallSpace((char *)gidset);
89 for (j = ngroups - 1; j >= 0; j--) {
90 gidset[j + 2] = gidset[j];
94 *newpag = (pagvalue == -1 ? genpag() : pagvalue);
95 afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
96 if ((code = afs_setgroups(cred, ngroups, gidset, change_parent))) {
97 osi_FreeSmallSpace((char *)gidset);
100 osi_FreeSmallSpace((char *)gidset);