|
|
1.1 root 1: /*
2: * $Source: /mit/kerberos/src/kuser/RCS/ksrvtgt.c,v $
3: * $Author: steiner $
4: *
5: * Copyright 1988 by the Massachusetts Institute of Technology.
6: *
7: * For copying and distribution information, please see the file
8: * <mit-copyright.h>.
9: *
10: * Get a ticket-granting-ticket given a service key file (srvtab)
11: * The lifetime is the shortest allowed [1 five-minute interval]
12: *
13: */
14:
15: #include <stdio.h>
16: #include <kerberos/krb.h>
17: #include <kerberos/conf.h>
18:
19: const char rcsid[] =
20: "$Header: ksrvtgt.c,v 4.2 89/01/13 18:05:19 steiner Exp $";
21:
22: char realmbuf[REALM_SZ];
23: static char *realm = NULL;
24: static char *srvtab = NULL;
25: static char srvtabfile[] = KEYFILE;
26:
27: main(argc,argv)
28: int argc;
29: char **argv;
30: {
31: register int code;
32: if (argc < 3 || argc > 5) {
33: fprintf(stderr, "Usage: %s name instance [[realm] srvtab]\n",
34: argv[0]);
35: exit(1);
36: }
37: if (argc == 5) {
38: realm = argv[3];
39: srvtab = argv[4];
40: }
41: else if (argc == 4)
42: srvtab = argv[3];
43:
44: if(realm == NULL) {
45: if(krb_get_lrealm(realmbuf, 1) != KSUCCESS) {
46: fprintf(stderr, "Couldn't get local relm info.\n");
47: exit(1);
48: }
49: realm = realmbuf;
50: }
51:
52: if(srvtab == NULL)
53: srvtab = srvtabfile;
54:
55: code = krb_get_svc_in_tkt(argv[1], argv[2], realm,
56: "krbtgt", realm, 1, srvtab);
57: if (code != KSUCCESS)
58: fprintf(stderr, "%s\n", krb_err_txt[code]);
59: exit(code);
60: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.