cups/cups-1.2rc3-libwrap.patch

51 lines
1.2 KiB
Diff

--- cups-1.2rc3/scheduler/Makefile.orig 2006-03-05 17:48:12.000000000 +0100
+++ cups-1.2rc3/scheduler/Makefile 2006-04-26 16:52:06.000000000 +0200
@@ -73,6 +73,7 @@
testmime \
testspeed
+CUPSDLIBS += -lwrap
#
# Make everything...
--- cups-1.2rc3/scheduler/client.c.orig 2006-04-17 23:24:17.000000000 +0200
+++ cups-1.2rc3/scheduler/client.c 2006-04-26 16:34:40.000000000 +0200
@@ -59,6 +59,11 @@
# include <gnutls/x509.h>
#endif /* HAVE_GNUTLS */
+#include <tcpd.h>
+#include <syslog.h>
+int allow_severity = LOG_INFO;
+int deny_severity = LOG_WARNING;
+
/*
* Local functions...
@@ -149,6 +154,25 @@
return;
}
+ /*
+ * libwrap/tcp_wrappers:
+ * draht@suse.de, Tue Jan 29 2002
+ */
+
+ {
+ struct request_info wrap_req;
+
+ request_init(&wrap_req, RQ_DAEMON, "cupsd" , RQ_FILE, con->http.fd, NULL);
+ fromhost(&wrap_req);
+ if (!hosts_access(&wrap_req)) { /* we do not accept the connection: */
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "tcp_wrappers refused connection from %s. See /etc/hosts.allow and /etc/hosts.deny.",
+ eval_client(&wrap_req));
+ close(con->http.fd);
+ return;
+ }
+ }
+
#ifdef AF_INET6
if (lis->address.addr.sa_family == AF_INET6)
{