cups/cups-1.2.7-libwrap.patch

55 lines
1.5 KiB
Diff

*** cups-1.2.7/scheduler/Makefile.orig Mon Sep 11 20:30:09 2006
--- cups-1.2.7/scheduler/Makefile Tue Feb 13 17:56:10 2007
*************** TARGETS = \
*** 77,82 ****
--- 77,83 ----
testspeed \
testsub
+ CUPSDLIBS += -lwrap
#
# Make everything...
--- cups-1.2.7/scheduler/client.c.orig 2006-11-15 21:28:39.000000000 +0100
+++ cups-1.2.7/scheduler/client.c 2007-02-13 19:10:38.000000000 +0100
@@ -65,6 +65,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...
@@ -180,6 +185,27 @@ cupsdAcceptClient(cupsd_listener_t *lis)
con->http.hostaddr->ipv4.sin_port = lis->address.ipv4.sin_port;
/*
+ * libwrap/tcp_wrappers:
+ * draht@suse.de, Tue Jan 29 2002
+ * kssingvo@suse.de, Thu Feb 01 2007
+ */
+
+ if (lis->address.addr.sa_family == AF_INET || lis->address.addr.sa_family == AF_INET6) {
+ 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, ip=%s. See /etc/hosts.allow and /etc/hosts.deny.",
+ eval_client(&wrap_req), eval_hostaddr(wrap_req.client));
+ close(con->http.fd);
+ free(con);
+ return;
+ }
+ }
+
+ /*
* Check the number of clients on the same address...
*/