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 <afsconfig.h>
19 #include "../afs/sysincludes.h"
20 #include "../afs/afsincludes.h"
21 #include "../afs/afs_stats.h" /* statistics */
31 struct AFS_UCRED *cred,
37 AFS_STATCNT(afs_getgroups);
39 gidset[0] = gidset[1] = 0;
40 savengrps = ngrps = cred->cr_ngroups;
51 struct AFS_UCRED **cred,
60 AFS_STATCNT(afs_setgroups);
62 if (ngroups > NGROUPS_MAX)
65 *cred = (struct AFS_UCRED *)crcopy(*cred);
66 (*cred)->cr_ngroups = ngroups;
67 gp = (*cred)->cr_groups;
74 struct usr_ucred **cred,
85 gidset = (gid_t *) osi_AllocSmallSpace(AFS_SMALLOCSIZ);
86 ngroups = afs_getgroups(*cred, gidset);
88 if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
89 /* We will have to shift grouplist to make room for pag */
90 if ((sizeof gidset[0])*(ngroups + 2) > AFS_SMALLOCSIZ) {
91 osi_FreeSmallSpace((char *)gidset);
94 for (j = ngroups -1; j >= 0; j--) {
95 gidset[j+2] = gidset[j];
99 *newpag = (pagvalue == -1 ? genpag(): pagvalue);
100 afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
101 if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
102 osi_FreeSmallSpace((char *)gidset);
105 osi_FreeSmallSpace((char *)gidset);