]> andersk Git - moira.git/blame - update/ticket.c
additional arg to get_file()
[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];
b95ec814 26static char master[INST_SZ] = "sms";
27static char service[ANAME_SZ] = "rcmd";
49b589d4 28C_Block session;
851fd300 29
5c87ce34 30
31static init()
32{
33 static int initialized = 0;
34
35 if (!initialized) {
f4f2cbe9 36 if (krb_get_lrealm(realm, 1))
37 strcpy(realm, KRB_REALM);
851fd300 38 initialize_krb_error_table();
5c87ce34 39 initialized=1;
40 }
41}
de56407f 42
de56407f 43
44int
2ad0a777 45get_mr_update_ticket(host, ticket)
de56407f 46 char *host;
47 KTEXT ticket;
48{
49 register int code;
50 register int pass;
51 char phost[BUFSIZ];
49b589d4 52 CREDENTIALS cr;
de56407f 53
54 pass = 1;
55 init();
b95ec814 56 strcpy(phost, krb_get_phost(host));
de56407f 57 try_it:
5c87ce34 58 code = krb_mk_req(ticket, service, phost, realm, (long)0);
b95ec814 59 if (code) {
60 code += ERROR_TABLE_BASE_krb;
61 com_err(whoami, code, "in krb_mk_req");
49b589d4 62 } else {
63 code = krb_get_cred(service, phost, realm, &cr);
64 bcopy(cr.session, session, sizeof(session));
b95ec814 65 }
66#ifdef notdef
de56407f 67 if (pass == 1) {
68 /* maybe we're taking too long? */
2ad0a777 69 if ((code = get_mr_tgt()) != 0) {
5c87ce34 70 com_err(whoami, code, " can't get Kerberos TGT");
de56407f 71 return(code);
72 }
73 pass++;
74 goto try_it;
75 }
b95ec814 76#endif /* notdef */
5c87ce34 77 return(code);
de56407f 78}
79
80int
2ad0a777 81get_mr_tgt()
de56407f 82{
83 register int code;
b95ec814 84 char linst[INST_SZ], kinst[INST_SZ];
85
de56407f 86 init();
b95ec814 87 linst[0] = '\0';
88 strcpy(kinst, "krbtgt");
89 code = krb_get_svc_in_tkt(master, linst, realm, kinst, realm, 1, srvtab);
de56407f 90 if (!code)
91 return(0);
92 else
851fd300 93 return(code + ERROR_TABLE_BASE_krb);
de56407f 94}
This page took 0.08093 seconds and 5 git commands to generate.