aix51-pag-header-20090320
[openafs.git] / src / pam / afs_util.c
index e98618e..a5ffdd2 100644 (file)
 #include <afs/param.h>
 #include <sys/wait.h>
 #include <limits.h>
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
+#include <stdlib.h>
+#ifdef AFS_AIX51_ENV
+#include <sys/cred.h>
+#ifdef HAVE_SYS_PAG_H
+#include <sys/pag.h>
 #endif
 #endif
-#include <stdlib.h>
 
 RCSID
     ("$Header$");
@@ -180,6 +180,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;
@@ -203,6 +209,7 @@ curpag(void)
            return -1;
     }
     return -1;
+#endif
 }
 
 /* Returns the AFS pag number, if any, otherwise return -1 */