add-missing-include-file-afsd-windows-20031203
[openafs.git] / src / WINNT / afsd / cunlog.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 #include <afs/param.h>
11 #include <afs/stds.h>
12
13 #include <afs/auth.h>
14 #include "cmd.h"
15 #include <afsint.h>
16 #include <winsock2.h>
17
18 CommandProc (as, arock)
19   char *arock;
20   struct cmd_syndesc *as;
21 {
22   afs_int32 code, ecode=0;
23   struct ktc_principal server;
24   struct cmd_item *itp;
25
26   if (as->parms[0].items) {     /* A cell is provided */
27      for (itp=as->parms[0].items; itp; itp = itp->next) {
28         strcpy(server.cell, itp->data);
29         server.instance[0] = '\0';
30         strcpy(server.name, "afs");
31         code = ktc_ForgetToken(&server);
32         if (code) {
33            printf("unlog: could not discard tickets for cell %s, code %d\n",
34                   itp->data, code);
35            ecode = code;                   /* return last error */
36         }
37      }
38   } else {
39      ecode = ktc_ForgetAllTokens ();
40      if (ecode)
41         printf("unlog: could not discard tickets, code %d\n", ecode);
42   }
43   return ecode;
44 }
45
46
47 main(argc, argv)
48   int argc;
49   char *argv[];
50
51 {
52   struct cmd_syndesc *ts;
53   afs_int32 code;
54   WSADATA WSAjunk;
55
56   WSAStartup(0x0101, &WSAjunk);
57
58   ts = cmd_CreateSyntax((char *) 0, CommandProc, 0, "Release Kerberos authentication");
59   cmd_AddParm(ts, "-cell", CMD_LIST, CMD_OPTIONAL, "cell name");
60
61   code = cmd_Dispatch(argc, argv);
62   return (code);
63 }