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 "../afs/param.h"
15 #include "../afs/sysincludes.h"
16 #include "../afs/afsincludes.h"
17 #include "../afs/afs_stats.h" /* statistics */
27 struct AFS_UCRED *cred,
33 AFS_STATCNT(afs_getgroups);
35 gidset[0] = gidset[1] = 0;
36 savengrps = ngrps = cred->cr_ngroups;
47 struct AFS_UCRED **cred,
56 AFS_STATCNT(afs_setgroups);
58 if (ngroups > NGROUPS_MAX)
61 *cred = (struct AFS_UCRED *)crcopy(*cred);
62 (*cred)->cr_ngroups = ngroups;
63 gp = (*cred)->cr_groups;
70 struct usr_ucred **cred,
81 gidset = (gid_t *) osi_AllocSmallSpace(AFS_SMALLOCSIZ);
82 ngroups = afs_getgroups(*cred, gidset);
84 if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
85 /* We will have to shift grouplist to make room for pag */
86 if ((sizeof gidset[0])*(ngroups + 2) > AFS_SMALLOCSIZ) {
87 osi_FreeSmallSpace((char *)gidset);
90 for (j = ngroups -1; j >= 0; j--) {
91 gidset[j+2] = gidset[j];
95 *newpag = (pagvalue == -1 ? genpag(): pagvalue);
96 afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
97 if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
98 osi_FreeSmallSpace((char *)gidset);
101 osi_FreeSmallSpace((char *)gidset);