]> andersk Git - moira.git/blame - update/ticket.c
name changes for new DES library (qjb)
[moira.git] / update / ticket.c
CommitLineData
de56407f 1/*
2 * $Source$
3 * $Header$
4 */
546bc43b 5/* (c) Copyright 1988 by the Massachusetts Institute of Technology. */
6/* For copying and distribution information, please see the file */
7/* <mit-copyright.h>. */
de56407f 8
9#ifndef lint
10static char *rcsid_ticket_c = "$Header$";
11#endif lint
12
546bc43b 13#include <mit-copyright.h>
de56407f 14#include <stdio.h>
15#include <krb.h>
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <strings.h>
5c87ce34 19#include <update.h>
20#include <com_err.h>
851fd300 21#include <krb_et.h>
de56407f 22
23/* too bad we can't set the pathname easily */
5c87ce34 24static char *srvtab = KEYFILE; /* default == /etc/srvtab */
de56407f 25static char realm[REALM_SZ];
1c6164bb 26static char master[] = "sms";
27static char service[] = "rcmd";
de56407f 28
29extern char *tkt_string(), *PrincipalHostname();
851fd300 30
5c87ce34 31
32static init()
33{
34 static int initialized = 0;
35
36 if (!initialized) {
37 get_krbrlm(realm, 1);
851fd300 38 initialize_krb_error_table();
5c87ce34 39 initialized=1;
40 }
41}
de56407f 42
de56407f 43
44int
45get_sms_update_ticket(host, ticket)
46 char *host;
47 KTEXT ticket;
48{
49 register int code;
50 register int pass;
51 char phost[BUFSIZ];
52
53 pass = 1;
54 init();
55 strcpy(phost, PrincipalHostname(host));
56 try_it:
5c87ce34 57 code = krb_mk_req(ticket, service, phost, realm, (long)0);
58 if (code)
851fd300 59 code += ERROR_TABLE_BASE_krb;
de56407f 60 if (pass == 1) {
61 /* maybe we're taking too long? */
62 if ((code = get_sms_tgt()) != 0) {
63 /* don't need phost buffer any more */
5c87ce34 64 com_err(whoami, code, " can't get Kerberos TGT");
de56407f 65 return(code);
66 }
67 pass++;
68 goto try_it;
69 }
5c87ce34 70 return(code);
de56407f 71}
72
73int
74get_sms_tgt()
75{
76 register int code;
77 init();
1c6164bb 78 code = get_svc_in_tkt(master, "", realm, "krbtgt", realm, 1, srvtab);
de56407f 79 if (!code)
80 return(0);
81 else
851fd300 82 return(code + ERROR_TABLE_BASE_krb);
de56407f 83}
This page took 0.076229 seconds and 5 git commands to generate.