summaryrefslogtreecommitdiffstats
path: root/contrib/tcp_wrappers/tli.c
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-02-03 10:27:03 +0000
committershin <shin@FreeBSD.org>2000-02-03 10:27:03 +0000
commit225d233deb08e4006d8cabd0a6572f76d729f90d (patch)
tree5e244ba219acd7cbeb17a0c5dc92b62227ab2828 /contrib/tcp_wrappers/tli.c
parent22aa8f5f0343020efcf93d4ebc043c5f558995d5 (diff)
downloadFreeBSD-src-225d233deb08e4006d8cabd0a6572f76d729f90d.zip
FreeBSD-src-225d233deb08e4006d8cabd0a6572f76d729f90d.tar.gz
Missing tcp_wrapper IPv6 support seemed to be a bug, so commit it.
Now when tcp_wrapper is enabled by inetd -wW, several accesses which should be permitted are refused only for IPv6, if hostname is used to decide the host to be allowed. IPv6 users will be just upset. About security related concern. -All extensions are wrapped by #ifdef INET6, so people can completely disable the extension by recompile libwrap without INET6 option. -Access via IPv6 is not enabled by default. People need to enable IPv6 access by changing /etc/inetd.conf at first, by adding tcp6 and/or tcp46 entries. -The base of patches are from KAME package and are actually daily used for more than a year in several Japanese IPv6 environments. -Patches are reviewed by markm. Approved by: jkh Submitted by: Hajimu UMEMOTO <ume@mahoroba.org> Reviewed by: markm Obtained from: KAME project
Diffstat (limited to 'contrib/tcp_wrappers/tli.c')
-rw-r--r--contrib/tcp_wrappers/tli.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/contrib/tcp_wrappers/tli.c b/contrib/tcp_wrappers/tli.c
index 14579d1..36d6f7e 100644
--- a/contrib/tcp_wrappers/tli.c
+++ b/contrib/tcp_wrappers/tli.c
@@ -12,6 +12,8 @@
* Diagnostics are reported through syslog(3).
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
+ *
+ * $FreeBSD$
*/
#ifndef lint
@@ -65,8 +67,13 @@ static void tli_sink();
void tli_host(request)
struct request_info *request;
{
+#ifdef INET6
+ static struct sockaddr_storage client;
+ static struct sockaddr_storage server;
+#else
static struct sockaddr_in client;
static struct sockaddr_in server;
+#endif
/*
* If we discover that we are using an IP transport, pretend we never
@@ -75,15 +82,31 @@ struct request_info *request;
*/
tli_endpoints(request);
+#ifdef INET6
+ if ((request->config = tli_transport(request->fd)) != 0
+ && (STR_EQ(request->config->nc_protofmly, "inet") ||
+ STR_EQ(request->config->nc_protofmly, "inet6"))) {
+#else
if ((request->config = tli_transport(request->fd)) != 0
- && STR_EQ(request->config->nc_protofmly, "inet")) {
+ && STR_EQ(request->config->nc_protofmly, "inet")) {
+#endif
if (request->client->unit != 0) {
+#ifdef INET6
+ client = *(struct sockaddr_storage *) request->client->unit->addr.buf;
+ request->client->sin = (struct sockaddr *) &client;
+#else
client = *(struct sockaddr_in *) request->client->unit->addr.buf;
request->client->sin = &client;
+#endif
}
if (request->server->unit != 0) {
- server = *(struct sockaddr_in *) request->server->unit->addr.buf;
- request->server->sin = &server;
+#ifdef INET6
+ server = *(struct sockaddr_storage *) request->server->unit->addr.buf;
+ request->server->sin = (struct sockaddr *) &server;
+#else
+ server = *(struct sockaddr_in *) request->server->unit->addr.buf;
+ request->server->sin = &server;
+#endif
}
tli_cleanup(request);
sock_methods(request);
@@ -187,7 +210,15 @@ int fd;
}
while (config = getnetconfig(handlep)) {
if (stat(config->nc_device, &from_config) == 0) {
+#ifdef NO_CLONE_DEVICE
+ /*
+ * If the network devices are not cloned (as is the case for
+ * Solaris 8 Beta), we must compare the major device numbers.
+ */
+ if (major(from_config.st_rdev) == major(from_client.st_rdev))
+#else
if (minor(from_config.st_rdev) == major(from_client.st_rdev))
+#endif
break;
}
}
OpenPOWER on IntegriCloud