]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Make ktc_curpag also detect ONEGROUP PAG gids
authorAndrew Deason <adeason@sinenomine.net>
Wed, 11 Nov 2009 17:23:49 +0000 (11:23 -0600)
committerRuss Allbery <rra@debian.org>
Mon, 30 Nov 2009 22:50:40 +0000 (14:50 -0800)
ktc_curpag falls back to looking at the group list if the VIOC_GETPAG
pioctl fails. If we're in AFS_LINUX26_ONEGROUP_ENV in the kernel,
though, ktc_curpag still looks for two groups, instead of the one
combined group. Add a check for the big one group in the fallback if
we're on LINUX26.

Reviewed-on: http://gerrit.openafs.org/815
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit c53abbb3e8d14643f3f82999cbe24fb12d358ce0)

Change-Id: I771d90546b1aec9f3e84a56a5b6a465e18b1241a
Reviewed-on: http://gerrit.openafs.org/853
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/auth/ktc.c

index bcb8402e4b4d3501a3f83c79b9c4d0b126543fdc..f1c236a1839dbfcee727815532b263db05692395 100644 (file)
@@ -946,8 +946,21 @@ ktc_curpag(void)
        gid_t groups[NGROUPS_MAX];
        afs_uint32 g0, g1;
        afs_uint32 h, l, ret;
+       int ngroups;
+       int i;
+
+       ngroups = getgroups(sizeof groups / sizeof groups[0], groups);
+
+#ifdef AFS_LINUX26_ENV
+       /* check for AFS_LINUX26_ONEGROUP_ENV PAGs */
+       for (i = 0; i < ngroups; i++) {
+           if (((groups[i] >> 24) & 0xff) == 'A') {
+               return groups[i];
+           }
+       }
+#endif
 
-       if (getgroups(sizeof groups / sizeof groups[0], groups) < 2)
+       if (ngroups < 2)
            return 0;
 
        g0 = groups[0] & 0xffff;