From 68437b1a0e8b58742a74cd819278c2cd5f520bb3 Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 7 Apr 1999 08:39:54 +0000 Subject: Really fix -u.... --- libexec/telnetd/telnetd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libexec/telnetd') diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index fd4b6da..d8019ed 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -817,11 +817,15 @@ doit(who) #endif /* _SC_CRAY_SECURE_SYS */ /* get name of connected client */ - if (realhostname(remote_hostname, utmp_len, + if (realhostname(remote_hostname, sizeof(remote_hostname) - 1, &who->sin_addr) == HOSTNAME_INVALIDADDR && registerd_host_only) fatal(net, "Couldn't resolve your address into a host name.\r\n\ Please contact your net administrator"); - remote_hostname[utmp_len] = '\0'; + remote_hostname[sizeof(remote_hostname) - 1] = '\0'; + + if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len) + strncpy(remote_hostname, inet_ntoa(who->sin_addr), + sizeof(remote_hostname) - 1); (void) gethostname(host_name, sizeof(host_name) - 1); host_name[sizeof(host_name) - 1] = '\0'; -- cgit v1.1