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