new version of nsd_acl_plugin

Colm MacCarthaigh colm.maccarthaigh at heanet.ie
Mon Jul 21 16:31:56 UTC 2003


On Mon, Jul 21, 2003 at 03:45:49PM +0100, Colm MacCarthaigh wrote:
> O.k., I've cleaned it up a lot, and it's now in a happy enough
> state for my own use anyway :) It's attached in tar.gz format,
> I've also attached a very small patch for NSD which allows
> register_data in plugin.c to register data throughout a zone
> recursively.

Sorry, patch was a bit skewed, loading data for "." didnt work
unless you were configured as a root server, fixed now :) new
patch attached.

-- 
Colm MacCárthaigh  /  HEAnet, Teach Brooklawn,  / Innealtóir Ghréasáin
+353 1 6609040    / Bóthar Shelbourne, BÁC, IE /   http://www.hea.net/
-------------- next part --------------
diff -ru nsd-1.2.1/nsd-plugin.h nsd-1.2.1-patched/nsd-plugin.h
--- nsd-1.2.1/nsd-plugin.h	Mon Jul  7 10:02:16 2003
+++ nsd-1.2.1/nsd-plugin.h	Mon Jul 21 08:42:22 2003
@@ -148,7 +148,8 @@
 		const struct nsd_plugin_interface *nsd,
 		nsd_plugin_id_type                 plugin_id,
 		const uint8_t *                    domain_name,
-		void *                             data);
+		void *                             data,
+		const uint8_t 			   recurse);
 };
 typedef struct nsd_plugin_interface nsd_plugin_interface_type;

--- nsd-1.2.1/plugins.c	Mon Jul  7 10:02:17 2003
+++ nsd-1.2.1/plugins.c	Mon Jul 21 16:38:16 2003
@@ -71,7 +71,8 @@
 	const nsd_plugin_interface_type *nsd,
 	nsd_plugin_id_type               plugin_id,
 	const uint8_t *                  domain_name,
-	void *                           data)
+	void *                           data,
+	const uint8_t			 recurse)
 {
 	struct domain *d;
 
@@ -79,6 +80,25 @@
 	assert(domain_name);
 
 	d = namedb_lookup(nsd->nsd->db, domain_name);
+
+	if (recurse) {
+		uint8_t dlen , klen;
+		void *key , *key_data;
+
+		dlen = *domain_name;
+		
+		HEAP_WALK(nsd->nsd->db->heap, key, key_data) {
+			klen = * (uint8_t *)key;
+
+			if ( ! bcmp( (uint8_t *) key + 1 + (klen - dlen), 
+				     (uint8_t *) domain_name + 1, klen - dlen) ) {
+				if (register_data(nsd, plugin_id, key, data, 0) == 0) {
+					return 0;
+				}
+			}
+		}	
+	}
+
 	if (d) {
 		void **plugin_data;
 		if (!d->runtime_data) {


More information about the nsd-users mailing list