diff options
author | brian <brian@FreeBSD.org> | 1999-04-08 21:36:27 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-04-08 21:36:27 +0000 |
commit | ee8f7b8bf011298bd73ef15bed2adf767d4c6cce (patch) | |
tree | d477ba9f86b464b3aed0ee7b5ff4cf91f083365f | |
parent | bb46603662773574159cd1e80402f5619310af03 (diff) | |
download | FreeBSD-src-ee8f7b8bf011298bd73ef15bed2adf767d4c6cce.zip FreeBSD-src-ee8f7b8bf011298bd73ef15bed2adf767d4c6cce.tar.gz |
Determine the host name using an array size of
MAXHOSTNAMELEN and call trimdomain() before implementing
the -u option.
This allows local hosts of a lan with a long domain name to
appear properly in utmp by base host name (w/o domain) rather
than by IP number.
-rw-r--r-- | libexec/telnetd/telnetd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index d8019ed..7472bd3 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93"; #endif static const char rcsid[] = - "$Id: telnetd.c,v 1.17 1999/04/06 23:05:58 brian Exp $"; + "$Id: telnetd.c,v 1.19 1999/04/07 08:39:54 brian Exp $"; #endif /* not lint */ #include "telnetd.h" @@ -90,7 +90,7 @@ int auth_level = 0; int require_SecurID = 0; #endif -char remote_hostname[UT_HOSTSIZE + 1]; +char remote_hostname[MAXHOSTNAMELEN]; int utmp_len = sizeof(remote_hostname) - 1; int registerd_host_only = 0; @@ -823,6 +823,7 @@ doit(who) Please contact your net administrator"); remote_hostname[sizeof(remote_hostname) - 1] = '\0'; + trimdomain(remote_hostname, UT_HOSTSIZE); if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len) strncpy(remote_hostname, inet_ntoa(who->sin_addr), sizeof(remote_hostname) - 1); |