]> andersk Git - moira.git/blob - update/ticket.c
add_user_group modified to side-effect the time for tbs for groups as
[moira.git] / update / ticket.c
1 /*
2  *      $Source$
3  *      $Header$
4  */
5
6 #ifndef lint
7 static 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";*/
21 static char *srvtab = SRVTAB; /* default == /etc/srvtab */
22 static char realm[REALM_SZ];
23 static char master[] = "sms";
24 static char service[] = "rcmd";
25
26 extern char *tkt_string(), *PrincipalHostname();
27 static int initialized = 0;
28
29 #define init() { if (!initialized) { get_krbrlm(realm,0); initialized=1; }}
30
31 int
32 get_sms_update_ticket(host, ticket)
33      char *host;
34      KTEXT ticket;
35 {
36      register int code;
37      register int pass;
38      char phost[BUFSIZ];
39
40      pass = 1;
41      init();
42      strcpy(phost, PrincipalHostname(host));
43  try_it:
44      code = mk_ap_req(ticket, service, phost, realm, (long)0);
45      if (pass == 1) {
46          /* maybe we're taking too long? */
47          if ((code = get_sms_tgt()) != 0) {
48              /* don't need phost buffer any more */
49              sprintf(phost, "%s: can't get Kerberos TGT",
50                      error_message(code));
51              sms_log_error(phost);
52              return(code);
53          }
54          pass++;
55          goto try_it;
56      }
57      return(krb_err_frob(code));
58 }
59
60 int
61 get_sms_tgt()
62 {
63     register int code;
64     init();
65     code = get_svc_in_tkt(master, "", realm, "krbtgt", realm, 1, srvtab);
66     if (!code)
67         return(0);
68     else
69         return(krb_err_frob(code));
70 }
This page took 0.062867 seconds and 5 git commands to generate.