[OpenAFS-devel] "unable to authenticate to AFS" error- linux distribution, specific?

Christof Hanke hanke@rzg.mpg.de
Fri, 26 Nov 2004 14:22:05 +0100


Hmm,
in principle I agree.
I tried to implement stdarg (my gcc tells me not to use varargs 
anymore...) in this ubik stuff.
starting with ubikclient.c and ubik.p.h you would do sth like the patch 
at the bottom.
But that is not gonna work, because the xdr  (*aproc-functions in 
ubik_Call ) wants proper parameters, not an arg-vector to send it down 
the line.
I.e. the SAMPLE_ package needs real arguments, so the transition from 
arg-vector -> "real" arguments has to be done in ubik_Call, which
then calls the *aproc routine with a fixed amount of arguments, which is 
basically the same as what is happening now.
To make it really clean with an arg-vector, we need to change rxgen to 
generate the proper rx-routines.
Do we really want to go that route ?

Christof

--- openafs-1.3.74/src/ubik/ubikclient.c        2004-08-25 
09:09:43.000000000 +0200
+++ openafs-1.3.74-new/src/ubik/ubikclient.c    2004-11-26 
13:44:53.333869839 +0100
@@ -46,7 +46,6 @@
 #endif /* defined(UKERNEL) */


-afs_int32 ubik_CallIter();
 short ubik_initializationState;        /* initial state is zero */


@@ -363,36 +362,17 @@
  * in the future, we should also put in a protocol to find the sync site
  */
 afs_int32
-ubik_Call(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
-         p11, p12, p13, p14, p15, p16)
-     int (*aproc) ();
-     register struct ubik_client *aclient;
-     afs_int32 aflags;
-     long p1;
-     long p2;
-     long p3;
-     long p4;
-     long p5;
-     long p6;
-     long p7;
-     long p8;
-     long p9;
-     long p10;
-     long p11;
-     long p12;
-     long p13;
-     long p14;
-     long p15;
-     long p16;
+ubik_Call(int (*aproc)(), register struct ubik_client *aclient, 
afs_int32 aflags,...)
 {
     afs_int32 rcode, code, newHost, thisHost, i, count;
     int chaseCount, pass, needsync, inlist, j;
     struct rx_connection *tc;
     struct rx_peer *rxp;
     short origLevel;
-
+    va_list argp;
     if (!aclient)
        return UNOENT;
+    va_start(argp,aflags);
     LOCK_UBIK_CLIENT(aclient);

   restart:
@@ -474,8 +454,7 @@
            }

            rcode =
-               (*aproc) (tc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11,
-                         p12, p13, p14, p15, p16);
+               (*aproc) (tc,argp);
            if (aclient->initializationState != origLevel) {
                /* somebody did a ubik_ClientInit */
                if (rcode)
@@ -510,6 +489,7 @@
        }
     }
     UNLOCK_UBIK_CLIENT(aclient);
+    va_end(argp);
     return rcode;
 }

@@ -581,28 +561,12 @@
 #define NO_LOCK 0

 static afs_int32
-CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, p8, p9,
-        p10, p11, p12, p13, p14, p15, p16, needlock)
+CallIter(aproc, aclient, aflags, apos, needlock,argp)
      int (*aproc) ();
      register struct ubik_client *aclient;
      afs_int32 aflags;
      int *apos;
-     long p1;
-     long p2;
-     long p3;
-     long p4;
-     long p5;
-     long p6;
-     long p7;
-     long p8;
-     long p9;
-     long p10;
-     long p11;
-     long p12;
-     long p13;
-     long p14;
-     long p15;
-     long p16;
+     va_list argp;
      int needlock;
 {
     register afs_int32 code;
@@ -645,8 +609,7 @@
     }

     code =
-       (*aproc) (tc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, 
p13,
-                 p14, p15, p16);
+       (*aproc) (tc, argp);
     if (aclient->initializationState != origLevel) {
        if (needlock) {
            UNLOCK_UBIK_CLIENT(aclient);
@@ -674,27 +637,7 @@
  * in the future, we should also put in a protocol to find the sync site
  */
 afs_int32
-ubik_Call_New(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, 
p9, p10,
-             p11, p12, p13, p14, p15, p16)
-     int (*aproc) ();
-     register struct ubik_client *aclient;
-     afs_int32 aflags;
-     long p1;
-     long p2;
-     long p3;
-     long p4;
-     long p5;
-     long p6;
-     long p7;
-     long p8;
-     long p9;
-     long p10;
-     long p11;
-     long p12;
-     long p13;
-     long p14;
-     long p15;
-     long p16;
+ubik_Call_New(int (*aproc) (),register struct ubik_client 
*aclient,afs_int32 aflags,...)
 {
     afs_int32 code, rcode;
     afs_int32 count;
@@ -702,7 +645,9 @@
     int pass;
     int stepBack;
     short origLevel;
+    va_list argp;

+    va_start(argp,aflags);
     LOCK_UBIK_CLIENT(aclient);
   restart:
     rcode = UNOSERVERS;
@@ -715,9 +660,7 @@
        count = 0;
        while (1) {
            code =
-               CallIter(aproc, aclient, aflags, &count, p1, p2, p3, p4, p5,
-                        p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16,
-                        NO_LOCK);
+               CallIter(aproc, aclient, aflags, &count,NO_LOCK,argp);
            if (code && (aclient->initializationState != origLevel)) {
                goto restart;
            }
@@ -738,11 +681,13 @@
                }
            } else if ((code >= 0) && (code != UNOQUORUM)) {
                UNLOCK_UBIK_CLIENT(aclient);
+                va_end(argp);
                return code;    /* success or global error condition */
            }
        }
     }
     UNLOCK_UBIK_CLIENT(aclient);
+    va_end(argp);
     return rcode;
 }

@@ -750,29 +695,12 @@
  * This is part of an iterator.  It doesn't handle finding sync sites
  */
 afs_int32
-ubik_CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, p8,
-             p9, p10, p11, p12, p13, p14, p15, p16)
-     int (*aproc) ();
-     register struct ubik_client *aclient;
-     afs_int32 aflags;
-     int *apos;
-     long p1;
-     long p2;
-     long p3;
-     long p4;
-     long p5;
-     long p6;
-     long p7;
-     long p8;
-     long p9;
-     long p10;
-     long p11;
-     long p12;
-     long p13;
-     long p14;
-     long p15;
-     long p16;
+ubik_CallIter(int (*aproc) (),register struct ubik_client 
*aclient,afs_int32 aflags,int *apos,...)
 {
-    return CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, 
p6, p7,
-                   p8, p9, p10, p11, p12, p13, p14, p15, p16, NEED_LOCK);
+    afs_int32 code;
+    va_list argp;
+    va_start(argp,apos);
+    code = CallIter(aproc, aclient, aflags, apos, NEED_LOCK,argp);
+    va_end(argp);
+    return code;
 }
--- openafs-1.3.74/src/ubik/ubik.p.h    2004-11-09 18:09:41.000000000 +0100
+++ openafs-1.3.74-new/src/ubik/ubik.p.h        2004-11-26 
13:43:42.229846681 +0100
@@ -75,6 +75,9 @@
 #include <assert.h>
 #endif

+/* stdargs */
+#include <stdarg.h>
+
 /* per-client structure for ubik */
 struct ubik_client {
     short initializationState; /* ubik client init state */
@@ -354,6 +357,8 @@

 extern afs_int32 ubik_ClientDestroy(struct ubik_client *aclient);

+extern afs_int32 ubik_CallIter(int (*aproc) (),struct ubik_client 
*aclient,afs_int32 aflags,int *apos,...);
+
 /* ubik.c */
 extern int ubik_BeginTrans(register struct ubik_dbase *dbase,
                           afs_int32 transMode, struct ubik_trans 
**transPtr);

Jim Rees wrote:

>What a mess.  There seem to be quite a few functions that illegally use
>unpassed args.
>
>I would much rather fix this without changing all callers of
>ubik_CallIter().  If we do change them, I'd rather use an arg vector than a
>sequence of dummy args.  Aside from the ugliness, what if someone needs to
>use more than 16 args at some point in the future?
>_______________________________________________
>OpenAFS-devel mailing list
>OpenAFS-devel@openafs.org
>https://lists.openafs.org/mailman/listinfo/openafs-devel
>  
>