2007-09-25 12:07:51 +00:00
|
|
|
--- netkit-telnet-0.17.orig/telnetd/telnetd.c 2007-03-13 16:31:20.000000000 +0000
|
|
|
|
+++ netkit-telnet-0.17.orig/telnetd/telnetd.c 2007-03-13 16:31:26.000000000 +0000
|
|
|
|
@@ -653,6 +653,11 @@ doit(struct sockaddr *who, socklen_t who
|
2007-04-13 12:29:34 +00:00
|
|
|
|
|
|
|
error = getnameinfo(who, wholen, namebuf, sizeof(namebuf), NULL, 0, 0);
|
|
|
|
|
2007-09-25 12:07:51 +00:00
|
|
|
+ /* if we can't get a hostname now, settle for an address */
|
|
|
|
+ if(error == EAI_AGAIN)
|
|
|
|
+ error = getnameinfo(who, wholen, namebuf, sizeof(namebuf),
|
|
|
|
+ NULL, 0, NI_NUMERICHOST);
|
|
|
|
+
|
2007-04-13 12:29:34 +00:00
|
|
|
if (error) {
|
|
|
|
perror("getnameinfo: localhost");
|
2007-09-25 12:07:51 +00:00
|
|
|
perror(gai_strerror(error));
|
|
|
|
@@ -681,7 +686,7 @@ doit(struct sockaddr *who, socklen_t who
|
|
|
|
/* Get local host name */
|
|
|
|
{
|
|
|
|
struct addrinfo hints;
|
|
|
|
- struct addrinfo *res;
|
|
|
|
+ struct addrinfo *res = 0;
|
|
|
|
int e;
|
|
|
|
|
|
|
|
memset(&hints, '\0', sizeof(hints));
|
|
|
|
@@ -690,11 +695,14 @@ doit(struct sockaddr *who, socklen_t who
|
2007-04-13 12:29:34 +00:00
|
|
|
|
2007-09-25 12:07:51 +00:00
|
|
|
gethostname(host_name, sizeof(host_name));
|
2007-04-13 12:29:34 +00:00
|
|
|
if ((e = getaddrinfo(host_name, NULL, &hints, &res)) != 0) {
|
2007-09-25 12:07:51 +00:00
|
|
|
- perror("getaddrinfo: localhost");
|
|
|
|
- perror(gai_strerror(e));
|
|
|
|
- exit(1);
|
|
|
|
+ if(e != EAI_AGAIN) {
|
|
|
|
+ fprintf(stderr, "getaddrinfo: localhost %s\n",
|
|
|
|
+ gai_strerror(e));
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
- freeaddrinfo(res);
|
|
|
|
+ if(res)
|
|
|
|
+ freeaddrinfo(res);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(AUTHENTICATE) || defined(ENCRYPT)
|
|
|
|
|