]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-aix-curpag-redux-20071213
authorDerrick Brashear <shadow@dementia.org>
Thu, 13 Dec 2007 21:23:42 +0000 (21:23 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 13 Dec 2007 21:23:42 +0000 (21:23 +0000)
LICENSE IPL10

add curpag() support for aix, based on work by tom keiser

(cherry picked from commit af3a4e78523596427235b45fc1892725a29bd1d6)

src/auth/ktc.c
src/pam/afs_util.c
src/sys/pagsh.c

index 44427613277ec58c06067fcaae8cb489b8119c0e..b2d1831ef477e585a6240677200c860c390402bd 100644 (file)
@@ -54,6 +54,10 @@ RCSID
 #include <afs/vice.h>
 #ifdef AFS_AIX_ENV
 #include <sys/lockf.h>
+#ifdef AFS_AIX51_ENV
+#include <sys/cred.h>
+#include <sys/pag.h>
+#endif
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -412,12 +416,11 @@ OldSetToken(struct ktc_principal *aserver, struct ktc_token *atoken,
     return 0;
 }
 
-
-ktc_SetToken(aserver, atoken, aclient, flags)
-     struct ktc_principal *aserver;
-     struct ktc_principal *aclient;
-     struct ktc_token *atoken;
-     afs_int32 flags;
+int
+ktc_SetToken(struct ktc_principal *aserver,
+    struct ktc_token *atoken,
+    struct ktc_principal *aclient,
+    afs_int32 flags)
 {
     int ncode, ocode;
 
@@ -688,9 +691,10 @@ ktc_ForgetToken(struct ktc_principal *aserver)
  * next rock in (*aindex).  (*aserver) is set to the relevant ticket on
  * success.  */
 
-ktc_ListTokens(aprevIndex, aindex, aserver)
-     int aprevIndex, *aindex;
-     struct ktc_principal *aserver;
+int
+ktc_ListTokens(int aprevIndex,
+    int *aindex,
+    struct ktc_principal *aserver)
 {
     struct ViceIoctl iob;
     char tbuffer[MAXPIOCTLTOKENLEN];
@@ -840,7 +844,7 @@ ktc_ListTokens(aprevIndex, aindex, aserver)
 /* discard all tokens from this user's cache */
 
 static int
-NewForgetAll()
+NewForgetAll(void)
 {
 #ifndef NO_AFS_CLIENT
     TRY_KERNEL(KTC_FORGETALLTOKENS_OP, 0, 0, 0, 0);
@@ -849,7 +853,7 @@ NewForgetAll()
 }
 
 static int
-OldForgetAll()
+OldForgetAll(void)
 {
     struct ViceIoctl iob;
     register afs_int32 code;
@@ -871,7 +875,7 @@ OldForgetAll()
 }
 
 int
-ktc_ForgetAllTokens()
+ktc_ForgetAllTokens(void)
 {
     int ncode, ocode;
 
@@ -1610,6 +1614,12 @@ afs_tf_dest_tkt(void)
 static afs_uint32
 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;
@@ -1633,6 +1643,7 @@ curpag(void)
            return -1;
     }
     return -1;
+#endif
 }
 
 int
index cf8ae25fe6562ea5ae4e7254361a3f3dcc102740..6a28cf309ae83a19bcb0d5ae9d722944cdc2f062 100644 (file)
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
+#ifdef AFS_AIX51_ENV
+#include <sys/cred.h>
+#include <sys/pag.h>
+#endif
 
 RCSID
     ("$Header$");
@@ -174,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;
@@ -197,6 +207,7 @@ curpag(void)
            return -1;
     }
     return -1;
+#endif
 }
 
 /* Returns the AFS pag number, if any, otherwise return -1 */
index d014c56b195fa4d99dace29cbe5db02c3a7ae81d..4ab86362370208b238bb27b48dd1d5d460e05261 100644 (file)
@@ -15,6 +15,11 @@ RCSID
 
 #ifdef AFS_AIX32_ENV
 #include <signal.h>
+#ifdef AFS_AIX51_ENV
+#include <sys/cred.h>
+#include <sys/pag.h>
+#include <errno.h>
+#endif
 #endif
 #include <stdio.h>
 #include <stdlib.h>
@@ -84,6 +89,12 @@ main(int argc, char *argv[])
 static afs_uint32
 curpag(void)
 {
+#if defined(AFS_AIX51_ENV)
+    int code = getpagvalue("afs");
+    if (code < 0 && errno == EINVAL)
+       code = 0;
+    return code;
+#else
     afs_uint32 groups[NGROUPS_MAX];
     afs_uint32 g0, g1;
     afs_uint32 h, l, ret;
@@ -107,6 +118,7 @@ curpag(void)
            return -1;
     }
     return -1;
+#endif
 }
 
 int