]> andersk Git - moira.git/blobdiff - update/auth_001.c
Remove useless delcaration of index().
[moira.git] / update / auth_001.c
index 506d3597e4defd6c0cc6eabc2afd10f6325c0e39..9ff2bf6bc9850fe23da3769244feb3e6b0d62f8d 100644 (file)
@@ -12,12 +12,15 @@ static char *rcsid_auth_001_c = "$Header$";
 
 #include <mit-copyright.h>
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include <gdb.h>
 #include <krb.h>
 #include <krb_et.h>
 #include <netinet/in.h>
 #include <errno.h>
+#ifdef POSIX
+#include <sys/utsname.h>
+#endif
 
 extern char buf[BUFSIZ];
 extern int have_authorization;
@@ -28,6 +31,7 @@ extern char *PrincipalHostname();
 static char service[] = "rcmd";
 static char master[] = "sms";
 static char qmark[] = "???";
+C_Block session;
 
 /*
  * authentication request auth_001:
@@ -49,6 +53,9 @@ auth_001(str)
     AUTH_DAT ad;
     char *p, *first, *config_lookup();
     KTEXT_ST ticket_st;
+#ifdef POSIX
+    struct utsname name;
+#endif
 
     if (send_ok())
        lose("sending okay for authorization (auth_001)");
@@ -57,10 +64,15 @@ auth_001(str)
        code = connection_errno(conn);
        lose("awaiting Kerberos authenticators");
     }
-    gethostname(host, BUFSIZ);
+#ifdef POSIX
+    (void) uname(&name);
+    strncpy(host, name.nodename, sizeof(host));
+#else
+    gethostname(host, sizeof(host));
+#endif
     ticket_st.mbz = 0;
     ticket_st.length = MAX_STRING_SIZE(data);
-    bcopy(STRING_DATA(data), ticket_st.dat, MAX_STRING_SIZE(data));
+    memcpy(ticket_st.dat, STRING_DATA(data), MAX_STRING_SIZE(data));
     code = krb_rd_req(&ticket_st, service,
                      krb_get_phost(host), 0,
                      &ad, KEYFILE);
@@ -100,6 +112,8 @@ auth_001(str)
     if (send_ok())
        lose("sending approval of authorization");
     have_authorization = 1;
+    /* Stash away session key */
+    memcpy(session, ad.session, sizeof(session));
     return(0);
 auth_failed:
     sprintf(buf, "auth for %s.%s@%s failed: %s",
This page took 0.157392 seconds and 4 git commands to generate.