1 - resolve hostnames in hosts.{allow,deny}, should fix a bunch of issues with IPv4/6
2 --- tcp_wrappers_7.6/tcpd.h.220015 2007-06-28 15:42:49.000000000 +0200
3 +++ tcp_wrappers_7.6/tcpd.h 2007-06-28 15:43:59.000000000 +0200
6 /* look up endpoint addresses */
7 extern void sock_host __P((struct request_info *));
8 +extern void sock_hostnofd __P((struct request_info *));
9 /* translate address to hostname */
10 extern void sock_hostname __P((struct host_info *));
11 /* address to printable address */
12 --- tcp_wrappers_7.6/hosts_ctl.c.220015 1994-12-28 17:42:28.000000000 +0100
13 +++ tcp_wrappers_7.6/hosts_ctl.c 2007-06-28 15:42:49.000000000 +0200
16 struct request_info request;
18 - return (hosts_access(request_init(&request,
20 - RQ_CLIENT_NAME, name,
21 - RQ_CLIENT_ADDR, addr,
24 + request_init(&request, RQ_DAEMON, daemon,
25 + RQ_CLIENT_NAME, name,
26 + RQ_CLIENT_ADDR, addr,
29 + sock_hostnofd(&request);
31 + return (hosts_access(&request));
33 --- tcp_wrappers_7.6/socket.c.220015 2007-06-28 15:42:49.000000000 +0200
34 +++ tcp_wrappers_7.6/socket.c 2007-06-28 15:42:49.000000000 +0200
39 +/* sock_hostnofd - look up endpoint addresses and install conversion methods */
41 +void sock_hostnofd(request)
42 +struct request_info *request;
44 + static struct sockaddr_storage client;
45 + struct addrinfo hints, *res;
49 + /* If the address field is non-empty and non-unknown and if the hostname
50 + * field is empty or unknown, use the address field to get the sockaddr
52 + if (strlen(request->client->addr) &&
53 + HOSTNAME_KNOWN(request->client->addr) &&
54 + (!strlen(request->client->addr) ||
55 + !HOSTNAME_KNOWN(request->client->name)))
56 + host = request->client->addr;
60 + memset(&hints, 0, sizeof(hints));
61 + hints.ai_family = AF_INET6;
62 + hints.ai_socktype = SOCK_STREAM;
63 + hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
65 + ret = getaddrinfo(host, NULL, &hints, &res);
67 + hints.ai_family = AF_INET;
68 + ret = getaddrinfo(host, NULL, &hints, &res);
72 + tcpd_warn("can't resolve hostname (%s): %s", host, gai_strerror(ret));
74 + sock_methods(request);
76 + memcpy(&client, res->ai_addr, res->ai_addrlen);
77 + request->client->sin = (struct sockaddr *)&client;
80 + request->client->name[0] = 0;
84 /* sock_hostaddr - map endpoint address to printable form */
86 void sock_hostaddr(host)