]> andersk Git - moira.git/blobdiff - update/ticket.c
punt smskeyu.c
[moira.git] / update / ticket.c
index c27f3738a5dc3245b206e6a6c809bb7ec5a41d8b..3df7623eb17a141bd9a888885ef3662393082d20 100644 (file)
@@ -2,33 +2,48 @@
  *     $Source$
  *     $Header$
  */
+/*  (c) Copyright 1988 by the Massachusetts Institute of Technology. */
+/*  For copying and distribution information, please see the file */
+/*  <mit-copyright.h>. */
 
 #ifndef lint
 static char *rcsid_ticket_c = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include <stdio.h>
 #include <krb.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <strings.h>
-#include "sms_update_int.h"
-#include "com_err.h"
-#include "kludge.h"
+#include <update.h>
+#include <com_err.h>
+#include <krb_et.h>
 
 /* too bad we can't set the pathname easily */
-/*static char tkt_pathname[] = "/tmp/tkt:sms";*/
-static char *srvtab = SRVTAB; /* default == /etc/srvtab */
+static char *srvtab = KEYFILE; /* default == /etc/srvtab */
 static char realm[REALM_SZ];
-static char sms[] = "sms";
+static char master[] = "sms";
+static char service[] = "rcmd";
 
 extern char *tkt_string(), *PrincipalHostname();
-static int initialized = 0;
 
-#define init() { if (!initialized) { get_krbrlm(realm,0); initialized=1; }}
+
+static init()
+{
+    static int initialized = 0;
+
+    if (!initialized) {
+       if (krb_get_lrealm(realm, 1))
+           strcpy(realm, KRB_REALM);
+       initialize_krb_error_table();
+       initialized=1;
+    }
+}
+
 
 int
-get_sms_update_ticket(host, ticket)
+get_mr_update_ticket(host, ticket)
      char *host;
      KTEXT ticket;
 {
@@ -40,30 +55,30 @@ get_sms_update_ticket(host, ticket)
      init();
      strcpy(phost, PrincipalHostname(host));
  try_it:
-     code = mk_ap_req(ticket, sms, phost, realm, (long)0);
+     code = krb_mk_req(ticket, service, phost, realm, (long)0);
+     if (code)
+       code += ERROR_TABLE_BASE_krb;
      if (pass == 1) {
         /* maybe we're taking too long? */
-        if ((code = get_sms_tgt()) != 0) {
+        if ((code = get_mr_tgt()) != 0) {
             /* don't need phost buffer any more */
-            sprintf(phost, "%s: can't get Kerberos TGT",
-                    error_message(code));
-            sms_log_error(phost);
+            com_err(whoami, code, " can't get Kerberos TGT");
             return(code);
         }
         pass++;
         goto try_it;
      }
-     return(krb_err_frob(code));
+     return(code);
 }
 
 int
-get_sms_tgt()
+get_mr_tgt()
 {
     register int code;
     init();
-    code = get_svc_in_tkt(sms, "", realm, "krbtgt", realm, 1, srvtab);
+    code = krb_get_svc_in_tkt(master, "", realm, "krbtgt", realm, 1, srvtab);
     if (!code)
        return(0);
     else
-       return(krb_err_frob(code));
+       return(code + ERROR_TABLE_BASE_krb);
 }
This page took 0.04366 seconds and 4 git commands to generate.