diff options
| author | Brian Somers <brian@FreeBSD.org> | 1999-04-06 00:29:41 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 1999-04-06 00:29:41 +0000 |
| commit | 51d8a6713face6901c25eb654c0aaaf79461eb84 (patch) | |
| tree | 1f0c5138f3918629e05be35f6df481b5e319ff29 /libexec/telnetd | |
| parent | 5999400ea8905c8adebba27de01ca616d03fc3c3 (diff) | |
Notes
Diffstat (limited to 'libexec/telnetd')
| -rw-r--r-- | libexec/telnetd/telnetd.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index 37564e343518..c825eab64575 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.14 1998/04/26 06:51:36 phk Exp $"; + "$Id: telnetd.c,v 1.15 1998/12/16 06:04:29 peter Exp $"; #endif /* not lint */ #include "telnetd.h" @@ -821,7 +821,23 @@ doit(who) Please contact your net administrator"); } else if (hp && (strlen(hp->h_name) <= ((utmp_len < 0) ? -utmp_len : utmp_len))) { - host = hp->h_name; + strncpy(remote_host_name, hp->h_name, + sizeof(remote_host_name)-1); + hp = gethostbyname(remote_host_name); + if (hp == NULL) + host = inet_ntoa(who->sin_addr); + else for (; ; hp->h_addr_list++) { + if (hp->h_addr_list[0] == NULL) { + /* End of list - ditch it */ + host = inet_ntoa(who->sin_addr); + break; + } + if (!bcmp(hp->h_addr_list[0], (caddr_t)&who->sin_addr, + sizeof(who->sin_addr))) { + host = hp->h_name; + break; /* OK! */ + } + } } else { host = inet_ntoa(who->sin_addr); } |
