Platform: SunOS afs1 5.8 Generic_108528-08 sun4u sparc SUNW,Ultra-5_10
and     : AIX afs0 3 4 000BD91D4C00

I am trying to diagnose a problem using aklog and DCE...
(but the following problems are using niether ... just
vanilla openafs-1.1.0).

I wrote a more verbose version of 'tokens' to see what was
going on with the token cache. The verbose version (I call
'vtokens'), prints out the ticket in hex (plus lots more).

I was wondering if someone could explain the results...
Each time I run it, the ticket changes. However it seems to
change back and forth between two specific values.
Furthermore it seems that the ticket length is being set
incorrectly or something, because part of the ticket is
this:
 00 00 00 18 00 00 00 01 <sessionKey> ...
which looks a lot like the sizeof(struct ClearToken)
folowed by the ClearToken... but the last 4 bytes of the
ClearToken are missing.

This happens on AIX 4.3.3 and Solaris 8.
The attached 'vtokens.c' can be complied with:

cc -o vtokens -I/usr/afsws/include vtokens.c \
        /usr/afsws/lib/afs/libauth.a \
        /usr/afsws/lib/afs/libsys.a \
        /usr/afsws/lib/librx.a \
        /usr/afsws/lib/liblwp.a

-James
#include <stdio.h>
#include <afs/param.h>
#include <afs/afs.h>
#include <afs/auth.h>

int main(argc, argv)
                int argc;
                char **argv;
{
        int status;
        int tokenNum;
        int cellNum;
        int i;
        struct ktc_principal service, client;
        struct ktc_token token;

        if (argc>1) {
                printf("Usage: vtokens\n");
                fflush(stdout);
                exit(0);
        }

        printf("\nTokens held by the Cache Manager:\n\n");
        cellNum = 0;
        tokenNum = 0;
        while (1) {
                status = ktc_ListTokens(cellNum, &cellNum, &service);
                if (status) {
                        break;
                } else {
                        /* get the ticket info itself */
                        status = ktc_GetToken(&service, &token, sizeof(token), 
&client);
                        if (status) {
                                printf("vtokens: failed to get token info for service 
%s.%s.%s (code %d)\n",
                                                 service.name, service.instance, 
service.cell, status);
                                continue;
                        }
                        printf("--- Token #%d ---\n", ++tokenNum);
                        printf("service => %s/%s@%s, client => %s/%s@%s,\n",
                                        service.name, service.instance, service.cell,
                                        client.name, client.instance, client.cell);
                        printf("stime => %d, etime => %d, kvno => %d, ticketLen => 
%d,\n",
                                        token.startTime, token.endTime, token.kvno, 
token.ticketLen);
                        printf("sessionKey => %02x %02x %02x %02x %02x %02x %02x 
%02x,\n",
                                        (unsigned char)token.sessionKey.data[0], 
(unsigned char)token.sessionKey.data[1],
                                        (unsigned char)token.sessionKey.data[2], 
(unsigned char)token.sessionKey.data[3],
                                        (unsigned char)token.sessionKey.data[4], 
(unsigned char)token.sessionKey.data[5],
                                        (unsigned char)token.sessionKey.data[6], 
(unsigned char)token.sessionKey.data[7]);
                        printf("ticket =>");
                        for(i=0; i<token.ticketLen; i++) {
                                if (i && i % 16 == 0) {
                                        printf("\n         ");
                                } else if (i && i % 8 == 0) {
                                        printf(" -");
                                }
                                printf(" %02x", (unsigned char)token.ticket[i]);
                        }
                        printf("\n");
                }
        }
        exit (0);
}

Reply via email to