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