You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tcp_wrappers/SOURCES/tcp_wrappers-7.6-220015.patch

89 lines
2.9 KiB

diff -up tcp_wrappers_7.6/hosts_ctl.c.patch17 tcp_wrappers_7.6/hosts_ctl.c
--- tcp_wrappers_7.6/hosts_ctl.c.patch17 1994-12-28 17:42:28.000000000 +0100
+++ tcp_wrappers_7.6/hosts_ctl.c 2008-08-29 09:45:12.000000000 +0200
@@ -29,10 +29,12 @@ char *user;
{
struct request_info request;
- return (hosts_access(request_init(&request,
- RQ_DAEMON, daemon,
- RQ_CLIENT_NAME, name,
- RQ_CLIENT_ADDR, addr,
- RQ_USER, user,
- 0)));
+ request_init(&request, RQ_DAEMON, daemon,
+ RQ_CLIENT_NAME, name,
+ RQ_CLIENT_ADDR, addr,
+ RQ_USER, user,
+ 0);
+ sock_hostnofd(&request);
+
+ return (hosts_access(&request));
}
diff -up tcp_wrappers_7.6/socket.c.patch17 tcp_wrappers_7.6/socket.c
--- tcp_wrappers_7.6/socket.c.patch17 2008-08-29 09:45:12.000000000 +0200
+++ tcp_wrappers_7.6/socket.c 2008-08-29 09:45:12.000000000 +0200
@@ -130,6 +130,51 @@ struct request_info *request;
request->server->sin = &server;
}
+/* sock_hostnofd - look up endpoint addresses and install conversion methods */
+
+void sock_hostnofd(request)
+struct request_info *request;
+{
+ static struct sockaddr_storage client;
+ struct addrinfo hints, *res;
+ int ret;
+ char *host;
+
+ /* If the address field is non-empty and non-unknown and if the hostname
+ * field is empty or unknown, use the address field to get the sockaddr
+ * and hostname. */
+ if (strlen(request->client->addr) &&
+ HOSTNAME_KNOWN(request->client->addr) &&
+ (!strlen(request->client->name) ||
+ !HOSTNAME_KNOWN(request->client->name)))
+ host = request->client->addr;
+ else
+ return;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
+
+ ret = getaddrinfo(host, NULL, &hints, &res);
+ if (ret != 0) {
+ hints.ai_family = AF_INET;
+ ret = getaddrinfo(host, NULL, &hints, &res);
+ }
+
+ if (ret != 0) {
+ tcpd_warn("can't resolve hostname (%s): %s", host, gai_strerror(ret));
+ } else {
+ sock_methods(request);
+
+ memcpy(&client, res->ai_addr, res->ai_addrlen);
+ request->client->sin = (struct sockaddr *)&client;
+ freeaddrinfo(res);
+
+ request->client->name[0] = 0;
+ }
+}
+
/* sock_hostaddr - map endpoint address to printable form */
void sock_hostaddr(host)
diff -up tcp_wrappers_7.6/tcpd.h.patch17 tcp_wrappers_7.6/tcpd.h
--- tcp_wrappers_7.6/tcpd.h.patch17 2008-08-29 09:45:12.000000000 +0200
+++ tcp_wrappers_7.6/tcpd.h 2008-08-29 09:45:12.000000000 +0200
@@ -167,6 +167,7 @@ extern char *eval_server __P((struct req
/* look up endpoint addresses */
extern void sock_host __P((struct request_info *));
+extern void sock_hostnofd __P((struct request_info *));
/* translate address to hostname */
extern void sock_hostname __P((struct host_info *));
/* address to printable address */