+2000-12-06 Ken Raeburn <raeburn@mit.edu>
+
+ * krlogind.c (doit): Cast first argument to pty_make_sane_hostname
+ to sockaddr pointer.
+ * krshd.c (doit): Likewise.
+
2000-11-01 Ezra Peisach <epeisach@mit.edu>
* configure.in: Update to autoconf 2 macro names:
setenv("TERM",term, 1);
}
- retval = pty_make_sane_hostname(fromp, maxhostlen,
+ retval = pty_make_sane_hostname((struct sockaddr *) fromp, maxhostlen,
stripdomain, always_ip,
&rhost_sane);
if (retval)
hostname[0] = '\0';
#ifdef KERBEROS
- status = pty_make_sane_hostname(fromp, maxhostlen,
+ status = pty_make_sane_hostname((struct sockaddr *) fromp, maxhostlen,
stripdomain, always_ip, &sane_host);
if (status) {
error("failed make_sane_hostname: %s\n", error_message(status));
+2000-12-06 Ken Raeburn <raeburn@mit.edu>
+
+ * ftpd.c (dolog): Cast first argument to pty_make_sane_hostname to
+ sockaddr pointer.
+
2000-10-16 Ezra Peisach <epeisach@mit.edu>
* ftpd.c (reply): For gssapi connection, do not include NULL in
remotehost[0] = '\0';
strncpy(rhost_addra, inet_ntoa(sin->sin_addr), sizeof (rhost_addra));
rhost_addra[sizeof (rhost_addra) - 1] = '\0';
- retval = pty_make_sane_hostname(sin, maxhostlen,
+ retval = pty_make_sane_hostname((struct sockaddr *) sin, maxhostlen,
stripdomain, always_ip, &rhost_sane);
if (retval) {
fprintf(stderr, "make_sane_hostname: %s\n",
+2000-12-06 Ken Raeburn <raeburn@mit.edu>
+
+ * telnetd.c (doit): Cast pty_make_sane_hostname first argument to
+ sockaddr pointer.
+
2000-11-01 Ezra Peisach <epeisach@mit.edu>
* configure.in: Use AC_CHECK_HEADER and AC_CHECK_FUNC instead of
}
#endif /* _SC_CRAY_SECURE_SYS */
- retval = pty_make_sane_hostname(who, maxhostlen,
+ retval = pty_make_sane_hostname((struct sockaddr *) who, maxhostlen,
stripdomain, always_ip,
&rhost_sane);
if (retval) {
+2000-12-06 Ken Raeburn <raeburn@mit.edu>
+
+ * sane_hostname.c (pty_make_sane_hostname, do_ntoa): Pass address
+ as sockaddr pointer.
+ * libpty.h (pty_make_sane_hostname): Update prototype.
+
2000-11-01 Ezra Peisach <epeisach@mit.edu>
* configure.in: Quote macro use inside AC_CHECK_LIB. Change
struct sockaddr_in;
#endif
-long pty_make_sane_hostname(struct sockaddr_in *, int, int, int, char **);
+long pty_make_sane_hostname(struct sockaddr *, int, int, int, char **);
#else /*__STDC__*/
long pty_init();
long pty_getpty();
* pty_make_sane_hostname: Make a sane hostname from an IP address.
* This returns allocated memory!
*
- * Copyright 1999 by the Massachusetts Institute of Technology.
+ * Copyright 1999,2000 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
#include <arpa/inet.h>
static long
-do_ntoa(struct sockaddr_in *addr,
+do_ntoa(struct sockaddr *addr,
size_t hostlen,
char **out)
{
- strncpy(*out, inet_ntoa(addr->sin_addr), hostlen);
+ if (addr->sa_family == AF_INET)
+ strncpy(*out, inet_ntoa(((struct sockaddr_in *)addr)->sin_addr),
+ hostlen);
+ else
+ strncpy(*out, "??", hostlen);
(*out)[hostlen - 1] = '\0';
return 0;
}
long
-pty_make_sane_hostname(struct sockaddr_in *addr,
+pty_make_sane_hostname(struct sockaddr *addr,
int maxlen,
int strip_ldomain,
int always_ipaddr,
if (always_ipaddr) {
return do_ntoa(addr, ut_host_len, out);
}
- hp = gethostbyaddr((char *)&addr->sin_addr, sizeof (struct in_addr),
- addr->sin_family);
+ if (addr->sa_family == AF_INET)
+ hp = gethostbyaddr((char *)&((struct sockaddr_in *)addr)->sin_addr,
+ sizeof (struct in_addr), addr->sa_family);
+ else
+ hp = NULL;
if (hp == NULL) {
return do_ntoa(addr, ut_host_len, out);
}