2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
28 time_t tokenExpireTime;
31 struct ktc_principal serviceName, clientName;
32 struct ktc_token token;
35 WSAStartup(0x0101, &WSAjunk);
37 printf("%s [-help]\n", argv[0]);
41 printf("\nTokens held by the Cache Manager:\n\n");
43 current_time = time((void *) 0);
46 rc = ktc_ListTokens(cellNum, &cellNum, &serviceName);
47 if (rc == KTC_NOENT) {
49 printf(" --End of list --\n");
52 else if (rc == KTC_NOCM) {
53 printf("AFS device may not have started\n");
57 printf("Unexpected error, code %d\n", rc);
61 rc = ktc_GetToken(&serviceName, &token, sizeof(token),
64 printf("Unexpected error, service %s.%s.%s, code %d\n",
65 serviceName.name, serviceName.instance,
66 serviceName.cell, rc);
69 tokenExpireTime = token.endTime;
70 strcpy(userName, clientName.name);
71 if (clientName.instance[0] != 0) {
72 strcat(userName, ".");
73 strcat(userName, clientName.instance);
75 if (userName[0] == '\0')
77 else if (strncmp(userName, "AFS ID", 6) == 0)
78 printf("User's (%s) tokens", userName);
79 else if (strncmp(userName, "Unix UID", 8) == 0)
82 printf("User %s's tokens", userName);
83 printf(" for %s%s%s@%s ",
85 serviceName.instance[0] ? "." : "",
88 if (tokenExpireTime <= current_time)
89 printf("[>> Expired <<]\n");
91 time_t t = tokenExpireTime;
92 expireString = ctime(&t);
93 expireString += 4; /* Skip day of week */
94 expireString[12] = '\0'; /* Omit secs & year */
95 printf("[Expires %s]\n", expireString);