Module Name:    src
Committed By:   spz
Date:           Thu Jan 12 08:38:31 UTC 2017

Added Files:
        src/external/bsd/bind/dist/bin/named: pfilter.c pfilter.h

Log Message:
don't "clean up" the blacklistd integration


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.4 src/external/bsd/bind/dist/bin/named/pfilter.c
cvs rdiff -u -r0 -r1.3 src/external/bsd/bind/dist/bin/named/pfilter.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/bsd/bind/dist/bin/named/pfilter.c
diff -u /dev/null src/external/bsd/bind/dist/bin/named/pfilter.c:1.4
--- /dev/null	Thu Jan 12 08:38:31 2017
+++ src/external/bsd/bind/dist/bin/named/pfilter.c	Thu Jan 12 08:38:31 2017
@@ -0,0 +1,47 @@
+#include <config.h>
+
+#include <isc/platform.h>
+#include <isc/util.h>
+#include <named/types.h>
+#include <named/client.h>
+
+#include <blacklist.h>
+
+#include "pfilter.h"
+
+static struct blacklist *blstate;
+
+void
+pfilter_open(void)
+{
+	if (blstate == NULL)
+		blstate = blacklist_open();
+}
+
+#define TCP_CLIENT(c)  (((c)->attributes & NS_CLIENTATTR_TCP) != 0)
+
+void
+pfilter_notify(isc_result_t res, ns_client_t *client, const char *msg)
+{
+	isc_socket_t *socket;
+
+	pfilter_open();
+
+	if (TCP_CLIENT(client))
+		socket = client->tcpsocket;
+	else {
+		socket = client->udpsocket;
+		if (!client->peeraddr_valid)
+			return;
+	}
+
+	if (socket == NULL)
+		return;
+
+	if (blstate == NULL)
+		return;
+
+	blacklist_sa_r(blstate, 
+	    res != ISC_R_SUCCESS, isc_socket_getfd(socket),
+	    &client->peeraddr.type.sa, client->peeraddr.length, msg);
+}

Index: src/external/bsd/bind/dist/bin/named/pfilter.h
diff -u /dev/null src/external/bsd/bind/dist/bin/named/pfilter.h:1.3
--- /dev/null	Thu Jan 12 08:38:31 2017
+++ src/external/bsd/bind/dist/bin/named/pfilter.h	Thu Jan 12 08:38:31 2017
@@ -0,0 +1,2 @@
+void pfilter_open(void);
+void pfilter_notify(isc_result_t, ns_client_t *, const char *);

Reply via email to