]> andersk Git - moira.git/blame - update/ticket.c
Cleanup (these changes were by Mike).
[moira.git] / update / ticket.c
CommitLineData
de56407f 1/*
2 * $Source$
3 * $Header$
4 */
5
6#ifndef lint
7static char *rcsid_ticket_c = "$Header$";
8#endif lint
9
10#include <stdio.h>
11#include <krb.h>
12#include <sys/types.h>
13#include <sys/stat.h>
14#include <strings.h>
15#include "sms_update_int.h"
16#include "com_err.h"
17#include "kludge.h"
18
19/* too bad we can't set the pathname easily */
20/*static char tkt_pathname[] = "/tmp/tkt:sms";*/
21static char *srvtab = SRVTAB; /* default == /etc/srvtab */
22static char realm[REALM_SZ];
23static char sms[] = "sms";
24
25extern char *tkt_string(), *PrincipalHostname();
26static int initialized = 0;
27
28#define init() { if (!initialized) { get_krbrlm(realm,0); initialized=1; }}
29
30int
31get_sms_update_ticket(host, ticket)
32 char *host;
33 KTEXT ticket;
34{
35 register int code;
36 register int pass;
37 char phost[BUFSIZ];
38
39 pass = 1;
40 init();
41 strcpy(phost, PrincipalHostname(host));
42 try_it:
43 code = mk_ap_req(ticket, sms, phost, realm, (long)0);
44 if (pass == 1) {
45 /* maybe we're taking too long? */
46 if ((code = get_sms_tgt()) != 0) {
47 /* don't need phost buffer any more */
48 sprintf(phost, "%s: can't get Kerberos TGT",
49 error_message(code));
50 sms_log_error(phost);
51 return(code);
52 }
53 pass++;
54 goto try_it;
55 }
56 return(krb_err_frob(code));
57}
58
59int
60get_sms_tgt()
61{
62 register int code;
63 init();
64 code = get_svc_in_tkt(sms, "", realm, "krbtgt", realm, 1, srvtab);
65 if (!code)
66 return(0);
67 else
68 return(krb_err_frob(code));
69}
This page took 0.078106 seconds and 5 git commands to generate.