~ubuntu-branches/ubuntu/feisty/openafs/feisty

« back to all changes in this revision

Viewing changes to src/afs/LINUX/osi_groups.c

  • Committer: Package Import Robot
  • Author(s): Russ Allbery
  • Date: 2007-03-26 18:56:55 UTC
  • Revision ID: package-import@ubuntu.com-20070326185655-osce8n0y0dptgurh
* New upstream release.  (Closes: #415699)
  - Support newer Linux kernels.  (Closes: #409797, #410120)
  - Add aklog fallbacks for null realms to support the referral
    capability in MIT Kerberos 1.6 and later.  (Closes: #410314)
* Apply patch from Thomas Sesselmann to support setting options to pass
  to bosserver in /etc/default/openafs-fileserver.  (Closes: #409357)
* Remove the rx_Init calls in the PAM module.  The internal counters
  that had to be initialized that way have been removed.
* Now that we're running regen.sh as part of the build process, only
  patch the Autoconf source files and not the generated output to make
  the diff easier to audit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#endif
21
21
 
22
22
RCSID
23
 
    ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.7 2006/09/27 21:14:28 shadow Exp $");
 
23
    ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.8 2007/01/15 15:52:46 shadow Exp $");
24
24
 
25
25
#include "afs/sysincludes.h"
26
26
#include "afsincludes.h"
29
29
#include "h/smp_lock.h"
30
30
#endif
31
31
 
 
32
#ifdef AFS_LINUX26_ONEGROUP_ENV
 
33
#define NUMPAGGROUPS 1
 
34
#else
 
35
#define NUMPAGGROUPS 2
 
36
#endif
 
37
 
32
38
#if defined(AFS_LINUX26_ENV)
33
39
static int
34
40
afs_setgroups(cred_t **cr, struct group_info *group_info, int change_parent)
160
166
    gid_t g0, g1;
161
167
    struct group_info *tmp;
162
168
    int i;
 
169
#ifdef AFS_LINUX26_ONEGROUP_ENV
 
170
    int j;
 
171
#endif
163
172
    int need_space = 0;
164
173
 
165
174
    group_info = afs_getgroups(*cr);
166
 
    if (group_info->ngroups < 2
167
 
        ||  afs_get_pag_from_groups(GROUP_AT(group_info, 0),
168
 
                                    GROUP_AT(group_info, 1)) == NOPAG) 
 
175
    if (group_info->ngroups < NUMPAGGROUPS
 
176
        ||  afs_get_pag_from_groups(
 
177
#ifdef AFS_LINUX26_ONEGROUP_ENV
 
178
            group_info
 
179
#else
 
180
            GROUP_AT(group_info, 0) ,GROUP_AT(group_info, 1)
 
181
#endif
 
182
                                    ) == NOPAG) 
169
183
        /* We will have to make sure group_info is big enough for pag */
170
 
      need_space = 2;
 
184
        need_space = NUMPAGGROUPS;
171
185
 
172
186
    tmp = groups_alloc(group_info->ngroups + need_space);
173
187
    
 
188
    *newpag = (pagvalue == -1 ? genpag() : pagvalue);
 
189
#ifdef AFS_LINUX26_ONEGROUP_ENV
 
190
    for (i = 0, j = 0; i < group_info->ngroups; ++i) {
 
191
        int ths = GROUP_AT(group_info, i);
 
192
        int last = i > 0 ? GROUP_AT(group_info, i-1) : 0;
 
193
        if ((ths >> 24) == 'A')
 
194
            continue;
 
195
        if (last <= *newpag && ths > *newpag) {
 
196
           GROUP_AT(tmp, j) = *newpag;
 
197
           j++;
 
198
        }
 
199
        GROUP_AT(tmp, j) = ths;
 
200
        j++;
 
201
    }
 
202
    if (j != i + need_space)
 
203
        GROUP_AT(tmp, j) = *newpag;
 
204
#else
174
205
    for (i = 0; i < group_info->ngroups; ++i)
175
206
      GROUP_AT(tmp, i + need_space) = GROUP_AT(group_info, i);
 
207
#endif
176
208
    put_group_info(group_info);
177
209
    group_info = tmp;
178
210
 
179
 
    *newpag = (pagvalue == -1 ? genpag() : pagvalue);
 
211
#ifndef AFS_LINUX26_ONEGROUP_ENV
180
212
    afs_get_groups_from_pag(*newpag, &g0, &g1);
181
213
    GROUP_AT(group_info, 0) = g0;
182
214
    GROUP_AT(group_info, 1) = g1;
 
215
#endif
183
216
 
184
217
    afs_setgroups(cr, group_info, change_parent);
185
218
 
524
557
    if (datalen != sizeof(afs_uint32) || !data)
525
558
        goto error;
526
559
 
527
 
    if (current->group_info->ngroups < 2)
 
560
    if (current->group_info->ngroups < NUMPAGGROUPS)
528
561
        goto error;
529
562
 
530
563
    /* ensure key being set matches current pag */
531
 
 
 
564
#ifdef AFS_LINUX26_ONEGROUP_ENV
 
565
    pag = afs_get_pag_from_groups(current->group_info);
 
566
#else
532
567
    g0 = GROUP_AT(current->group_info, 0);
533
568
    g1 = GROUP_AT(current->group_info, 1);
534
569
 
535
570
    pag = afs_get_pag_from_groups(g0, g1);
 
571
#endif
536
572
    if (pag == NOPAG)
537
573
        goto error;
538
574