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

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