aboutsummaryrefslogtreecommitdiff
path: root/libexec/telnetd
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1999-04-06 00:29:41 +0000
committerBrian Somers <brian@FreeBSD.org>1999-04-06 00:29:41 +0000
commit51d8a6713face6901c25eb654c0aaaf79461eb84 (patch)
tree1f0c5138f3918629e05be35f6df481b5e319ff29 /libexec/telnetd
parent5999400ea8905c8adebba27de01ca616d03fc3c3 (diff)
Notes
Diffstat (limited to 'libexec/telnetd')
-rw-r--r--libexec/telnetd/telnetd.c20
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);
}