]> andersk Git - moira.git/blobdiff - update/auth_001.c
missing glue func
[moira.git] / update / auth_001.c
index 83a5ebf7ac92c9a0e397f21decfd22f6cba2388e..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;
@@ -50,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)");
@@ -58,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);
@@ -102,7 +113,7 @@ auth_001(str)
        lose("sending approval of authorization");
     have_authorization = 1;
     /* Stash away session key */
-    bcopy(ad.session, session, sizeof(session));
+    memcpy(session, ad.session, sizeof(session));
     return(0);
 auth_failed:
     sprintf(buf, "auth for %s.%s@%s failed: %s",
This page took 0.034146 seconds and 4 git commands to generate.