]> andersk Git - moira.git/blob - incremental/ksrvtgt.c
Initial revision
[moira.git] / incremental / ksrvtgt.c
1 /*
2  * $Source$
3  * $Author$
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 <sys/param.h>
17 #include <krb.h>
18 #include <conf.h>
19
20 const char rcsid[] =
21     "$Header$";
22
23 main(argc,argv)
24     int argc;
25     char **argv;
26 {
27     char realm[REALM_SZ + 1];
28     register int code;
29     char srvtab[MAXPATHLEN + 1];
30
31     bzero(realm, sizeof(realm));
32     bzero(srvtab, sizeof(srvtab));
33
34     if (argc < 3 || argc > 5) {
35         fprintf(stderr, "Usage: %s name instance [[realm] srvtab]\n",
36                 argv[0]);
37         exit(1);
38     }
39     
40     if (argc == 4)
41         (void) strncpy(srvtab, argv[3], sizeof(srvtab) -1);
42     
43     if (argc == 5) {
44         (void) strncpy(realm, argv[3], sizeof(realm) - 1);
45         (void) strncpy(srvtab, argv[4], sizeof(srvtab) -1);
46     }
47
48     if (srvtab[0] == 0)
49         (void) strcpy(srvtab, KEYFILE);
50
51     if (realm[0] == 0)
52         if (krb_get_lrealm(realm) != KSUCCESS)
53             (void) strcpy(realm, KRB_REALM);
54
55     code = krb_get_svc_in_tkt(argv[1], argv[2], realm,
56                               "krbtgt", realm, 1, srvtab);
57     if (code)
58         fprintf(stderr, "%s\n", krb_err_txt[code]);
59     exit(code);
60 }
This page took 0.070891 seconds and 5 git commands to generate.