]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/netkit-telnet-0.17-nodns.patch
wget: Update to 1.20.2
[ipfire-2.x.git] / src / patches / netkit-telnet-0.17-nodns.patch
CommitLineData
b52f6eb2
DW
1--- netkit-telnet-0.17.orig/telnetd/telnetd.c 2007-03-13 16:31:20.000000000 +0000
2+++ netkit-telnet-0.17.orig/telnetd/telnetd.c 2007-03-13 16:31:26.000000000 +0000
3@@ -653,6 +653,11 @@ doit(struct sockaddr *who, socklen_t who
4
5 error = getnameinfo(who, wholen, namebuf, sizeof(namebuf), NULL, 0, 0);
6
7+ /* if we can't get a hostname now, settle for an address */
8+ if(error == EAI_AGAIN)
9+ error = getnameinfo(who, wholen, namebuf, sizeof(namebuf),
10+ NULL, 0, NI_NUMERICHOST);
11+
12 if (error) {
13 perror("getnameinfo: localhost");
14 perror(gai_strerror(error));
15@@ -681,7 +686,7 @@ doit(struct sockaddr *who, socklen_t who
16 /* Get local host name */
17 {
18 struct addrinfo hints;
19- struct addrinfo *res;
20+ struct addrinfo *res = 0;
21 int e;
22
23 memset(&hints, '\0', sizeof(hints));
24@@ -690,11 +695,14 @@ doit(struct sockaddr *who, socklen_t who
25
26 gethostname(host_name, sizeof(host_name));
27 if ((e = getaddrinfo(host_name, NULL, &hints, &res)) != 0) {
28- perror("getaddrinfo: localhost");
29- perror(gai_strerror(e));
30- exit(1);
31+ if(e != EAI_AGAIN) {
32+ fprintf(stderr, "getaddrinfo: localhost %s\n",
33+ gai_strerror(e));
34+ exit(1);
35+ }
36 }
37- freeaddrinfo(res);
38+ if(res)
39+ freeaddrinfo(res);
40 }
41
42 #if defined(AUTHENTICATE) || defined(ENCRYPT)
43