|
|
1.1 ! root 1: /* ! 2: * $Source: /usr/src/kerberosIV/ksrvtgt/RCS/ksrvtgt.c,v $ ! 3: * $Author: kfall $ ! 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 <des.h> ! 18: #include <krb.h> ! 19: #include <conf.h> ! 20: ! 21: const char rcsid[] = ! 22: "$Header: /usr/src/kerberosIV/ksrvtgt/RCS/ksrvtgt.c,v 4.4 90/06/25 21:03:27 kfall Exp $"; ! 23: ! 24: main(argc,argv) ! 25: int argc; ! 26: char **argv; ! 27: { ! 28: char realm[REALM_SZ + 1]; ! 29: register int code; ! 30: char srvtab[MAXPATHLEN + 1]; ! 31: ! 32: bzero(realm, sizeof(realm)); ! 33: bzero(srvtab, sizeof(srvtab)); ! 34: ! 35: if (argc < 3 || argc > 5) { ! 36: fprintf(stderr, "Usage: %s name instance [[realm] srvtab]\n", ! 37: argv[0]); ! 38: exit(1); ! 39: } ! 40: ! 41: if (argc == 4) ! 42: (void) strncpy(srvtab, argv[3], sizeof(srvtab) -1); ! 43: ! 44: if (argc == 5) { ! 45: (void) strncpy(realm, argv[3], sizeof(realm) - 1); ! 46: (void) strncpy(srvtab, argv[4], sizeof(srvtab) -1); ! 47: } ! 48: ! 49: if (srvtab[0] == 0) ! 50: (void) strcpy(srvtab, KEYFILE); ! 51: ! 52: if (realm[0] == 0) ! 53: if (krb_get_lrealm(realm) != KSUCCESS) ! 54: (void) strcpy(realm, KRB_REALM); ! 55: ! 56: code = krb_get_svc_in_tkt(argv[1], argv[2], realm, ! 57: "krbtgt", realm, 1, srvtab); ! 58: if (code) ! 59: fprintf(stderr, "%s\n", krb_err_txt[code]); ! 60: exit(code); ! 61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.