mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
After receiving a connection and doing a reverse
lookup on the incoming IP, do a forward lookup on the result and make sure that the IP is in the resulting list. If it's not, put the IP number in utmp/wtmp instead of the rogue name. Stolen from: rlogind Suggested by: sef
This commit is contained in:
parent
5999400ea8
commit
51d8a6713f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45353
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user