From af3a4e78523596427235b45fc1892725a29bd1d6 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 13 Dec 2007 21:21:56 +0000 Subject: [PATCH] aix-curpag-redux-20071213 LICENSE IPL10 add curpag() support for aix, based on work by tom keiser --- src/auth/ktc.c | 10 +++++----- src/pam/afs_util.c | 8 ++++++++ src/sys/pagsh.c | 11 ++++++----- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 0c43582b05..b2d1831ef4 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -56,6 +56,7 @@ RCSID #include #ifdef AFS_AIX51_ENV #include +#include #endif #endif #ifdef HAVE_UNISTD_H @@ -1614,11 +1615,10 @@ static afs_uint32 curpag(void) { #if defined(AFS_AIX51_ENV) - afs_int32 pag; - - if (get_pag(PAG_AFS, &pag) < 0 || pag == 0) - pag = NOPAG; - return pag; + int code = getpagvalue("afs"); + if (code < 0 && errno == EINVAL) + code = 0; + return code; #else gid_t groups[NGROUPS_MAX]; afs_uint32 g0, g1; diff --git a/src/pam/afs_util.c b/src/pam/afs_util.c index ec43656c4e..6a28cf309a 100644 --- a/src/pam/afs_util.c +++ b/src/pam/afs_util.c @@ -21,6 +21,7 @@ #include #ifdef AFS_AIX51_ENV #include +#include #endif RCSID @@ -177,6 +178,12 @@ do_klog(const char *user, const char *password, const char *lifetime, static afs_int32 curpag(void) { +#if defined(AFS_AIX51_ENV) + int code = getpagvalue("afs"); + if (code < 0 && errno == EINVAL) + code = 0; + return code; +#else gid_t groups[NGROUPS_MAX]; afs_uint32 g0, g1; afs_uint32 h, l, ret; @@ -200,6 +207,7 @@ curpag(void) return -1; } return -1; +#endif } /* Returns the AFS pag number, if any, otherwise return -1 */ diff --git a/src/sys/pagsh.c b/src/sys/pagsh.c index 1fe881127b..4ab8636237 100644 --- a/src/sys/pagsh.c +++ b/src/sys/pagsh.c @@ -17,6 +17,8 @@ RCSID #include #ifdef AFS_AIX51_ENV #include +#include +#include #endif #endif #include @@ -88,11 +90,10 @@ static afs_uint32 curpag(void) { #if defined(AFS_AIX51_ENV) - afs_int32 pag; - - if (get_pag(PAG_AFS, &pag) < 0 || pag == 0) - pag = -1; - return pag; + int code = getpagvalue("afs"); + if (code < 0 && errno == EINVAL) + code = 0; + return code; #else afs_uint32 groups[NGROUPS_MAX]; afs_uint32 g0, g1;