Blame SOURCES/netkit-telnet-0.17-nodns.patch

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