From: Andrew Deason Date: Wed, 11 Nov 2009 17:23:49 +0000 (-0600) Subject: Make ktc_curpag also detect ONEGROUP PAG gids X-Git-Tag: openafs-devel-1_5_67~55 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c53abbb3e8d14643f3f82999cbe24fb12d358ce0;p=packages%2Fo%2Fopenafs.git Make ktc_curpag also detect ONEGROUP PAG gids 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. Change-Id: I28e5eda5c62f13a6fb466c8a2b04d2628706498f Reviewed-on: http://gerrit.openafs.org/815 Tested-by: Andrew Deason Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear --- diff --git a/src/auth/ktc.c b/src/auth/ktc.c index c2a39e875..eabc95cf0 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -962,8 +962,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;