#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;
static char service[] = "rcmd";
static char master[] = "sms";
static char qmark[] = "???";
+C_Block session;
/*
* authentication request auth_001:
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)");
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);
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",