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 <afsconfig.h>
11 #include <afs/param.h>
32 time_t tokenExpireTime;
35 struct ktc_principal serviceName, clientName;
36 struct ktc_token token;
39 WSAStartup(0x0101, &WSAjunk);
41 printf("%s [-help]\n", argv[0]);
45 printf("\nTokens held by the Cache Manager:\n\n");
47 current_time = time((void *) 0);
50 rc = ktc_ListTokens(cellNum, &cellNum, &serviceName);
51 if (rc == KTC_NOENT) {
53 printf(" --End of list --\n");
56 else if (rc == KTC_NOCM) {
57 printf("AFS device may not have started\n");
61 printf("Unexpected error, code %d\n", rc);
65 rc = ktc_GetToken(&serviceName, &token, sizeof(token),
68 printf("Unexpected error, service %s.%s.%s, code %d\n",
69 serviceName.name, serviceName.instance,
70 serviceName.cell, rc);
73 tokenExpireTime = token.endTime;
74 strcpy(userName, clientName.name);
75 if (clientName.instance[0] != 0) {
76 strcat(userName, ".");
77 strcat(userName, clientName.instance);
79 if (userName[0] == '\0')
81 else if (strncmp(userName, "AFS ID", 6) == 0)
82 printf("User's (%s) tokens", userName);
83 else if (strncmp(userName, "Unix UID", 8) == 0)
86 printf("User %s's tokens", userName);
87 printf(" for %s%s%s@%s ",
89 serviceName.instance[0] ? "." : "",
92 if (tokenExpireTime <= current_time)
93 printf("[>> Expired <<]\n");
95 time_t t = tokenExpireTime;
96 expireString = ctime(&t);
97 expireString += 4; /* Skip day of week */
98 expireString[12] = '\0'; /* Omit secs & year */
99 printf("[Expires %s]\n", expireString);