Common subdirectories: ldapdns-2.06/admin and ldapdns-2.06.mod2//admin
Common subdirectories: ldapdns-2.06/debian and ldapdns-2.06.mod2//debian
diff -u ldapdns-2.06/engine.c ldapdns-2.06.mod2//engine.c
--- ldapdns-2.06/engine.c	2004-12-31 04:10:19.000000000 +0100
+++ ldapdns-2.06.mod2//engine.c	2010-04-07 12:07:13.000000000 +0200
@@ -422,11 +422,12 @@
 }
 static void do_axfrsearch(dns_ctx *c, char *q)
 {
-	const char *attrs[6] = {
+	const char *attrs[7] = {
 				"mail",
 				"nSRecord",
 				"sOARecord",
-				"modifyTimestamp"
+				"modifyTimestamp",
+				"entryTtl"
 	};
 	str_t sa, sb;
 	int r;
@@ -434,15 +435,15 @@
 retry_axfr_search_top_l:
 	if (ldapdns.dn_mode == DN_MODE_RFC1279
 			|| ldapdns.dn_mode == DN_MODE_MSDNS) {
-		attrs[4] = (const char *)"dNSRecord";
-		attrs[5] = (const char *)0;
+		attrs[5] = (const char *)"dNSRecord";
+		attrs[6] = (const char *)0;
 	} else if (ldapdns.dn_mode == DN_MODE_LDAPDNS) {
 
 		response_refuse(c);
 		complete_phase(c, '-');
 		return;
 	} else {
-		attrs[4] = (const char *)0;
+		attrs[5] = (const char *)0;
 	}
 
 	/* q is valid: safe */
@@ -483,7 +484,7 @@
 }
 static void do_simple_search(dns_ctx *c, char *q)
 {
-	const char *attrs[12];
+	const char *attrs[13];
 	str_t sb, sr;
 	register int i, j;
 	int r;
@@ -517,13 +518,14 @@
 	attrs[7] = (const char *)"nSRecord";
 	attrs[8] = (const char *)"sOARecord";
 	attrs[9] = (const char *)"modifyTimestamp";
+	attrs[10] = (const char *)"entryTtl";
 
 	if (ldapdns.dn_mode == DN_MODE_RFC1279
 			|| ldapdns.dn_mode == DN_MODE_MSDNS) {
-		attrs[10] = (const char *)"dNSRecord";
-		attrs[11] = (const char *)0;
+		attrs[11] = (const char *)"dNSRecord";
+		attrs[12] = (const char *)0;
 	} else {
-		attrs[10] = (const char *)0;
+		attrs[11] = (const char *)0;
 	}
 
 	/* q is valid: safe */
@@ -562,7 +564,7 @@
 }
 static void do_attrsearch(dns_ctx *c, char *q, int wild)
 {
-	const char *attrs[10];
+	const char *attrs[11];
 	str_t sa, sb;
 	list_t lp;
 	int r;
@@ -586,13 +588,14 @@
 	attrs[5] = (const char *)"photo";
 	attrs[6] = (const char *)"mail";
 	attrs[7] = (const char *)"modifyTimestamp";
+	attrs[8] = (const char *)"entryTtl";
 
 	if (ldapdns.dn_mode == DN_MODE_RFC1279
 			|| ldapdns.dn_mode == DN_MODE_MSDNS) {
-		attrs[8] = (const char *)"dNSRecord";
-		attrs[9] = (const char *)0;
+		attrs[9] = (const char *)"dNSRecord";
+		attrs[10] = (const char *)0;
 	} else {
-		attrs[8] = (const char *)0;
+		attrs[9] = (const char *)0;
 	}
 
 	dns_to_name(sa, q, 0);
@@ -625,7 +628,7 @@
 		}
 	}
 
-	// printf("X2 searching (%p) [%s]\n", c, str(sb));
+	//printf("X2 searching (%p) [%s]\n", c, str(sb));
 	pthread_mutex_lock(&c->c->lock);
 	r = ldap_search(c->c->ldap_con,
 			str(sb),		/* base */
@@ -656,7 +659,7 @@
 }
 static void do_zonesearch(dns_ctx *c, char *q)
 {
-	const char *attrs[5];
+	const char *attrs[6];
 	str_t sa, sb;
 	char *base;
 	char *filter;
@@ -682,15 +685,16 @@
 	attrs[0] = (const char *)"nSRecord";
 	attrs[1] = (const char *)"sOARecord";
 	attrs[2] = (const char *)"modifyTimestamp";
+	attrs[3] = (const char *)"entryTtl";
 	if (ldapdns.dn_mode == DN_MODE_RFC1279
 			|| ldapdns.dn_mode == DN_MODE_MSDNS) {
-		attrs[3] = (const char *)"dNSRecord";
-		attrs[4] = (const char *)0;
+		attrs[4] = (const char *)"dNSRecord";
+		attrs[5] = (const char *)0;
 	} else if (ldapdns.dn_mode == DN_MODE_LDAPDNS) {
-		attrs[3] = (const char *)"associatedDomain";
-		attrs[4] = (const char *)0;
+		attrs[4] = (const char *)"associatedDomain";
+		attrs[5] = (const char *)0;
 	} else {
-		attrs[3] = (const char *)0;
+		attrs[4] = (const char *)0;
 	}
 
 	/* q is valid: safe */
@@ -917,6 +921,7 @@
 	c->expire = default_expire;
 	c->minimum = default_minimum;
 	c->ttl = default_minimum;
+	c->rttl = c->ttl;
 
 	c->subreq = 0;
 	c->subreq_valid = 0;
@@ -1674,6 +1679,7 @@
 			c->expire = default_expire;
 			c->minimum = default_minimum;
 			c->ttl = c->minimum;
+			c->rttl = c->ttl;
 
 			c->NS = 0;
 			c->wantdie = 0;
@@ -1982,7 +1988,7 @@
 		}
 		response_rfinish(c, RESPONSE_ANSWER);
 		while ((dat = list_pop(&c->NS))) {
-			if (!response_rstart(c, c->request_name_zone, DNS_T_NS, c->ttl)
+			if (!response_rstart(c, c->request_name_zone, DNS_T_NS, c->ttl)
 			|| !response_addname(c, dat)) {
 				fatal("could not construct NS");
 			}
@@ -2133,7 +2139,7 @@
 						str_dup(c->request_name_alloc));
 			while ((dat = list_pop(&c->A))) {
 				if (!response_rstart(c, c->request_name_alloc,
-							DNS_T_A, c->ttl)
+							DNS_T_A, c->rttl)
 				|| !response_addbytes(c, dat, 4)) {
 					fatal("could not construct address");
 				}
@@ -2144,7 +2150,7 @@
 		} else if (c->CNAME) {
 			while ((dat = list_pop(&c->CNAME))) {
 				if (!response_rstart(c, c->request_name_alloc,
-							DNS_T_CNAME, c->ttl)
+							DNS_T_CNAME, c->rttl)
 				|| !response_addname(c, dat)) {
 					fatal("could not construct address");
 				}
@@ -2356,7 +2362,7 @@
 	} else if (_eq2(DNS_T_PTR)) {
 		while ((dat = list_pop(&c->PTR))) {
 			if (!response_rstart(c, c->request_name_alloc,
-						DNS_T_PTR, c->ttl)
+						DNS_T_PTR, c->rttl)
 			|| !response_addname(c, dat)) {
 				fatal("could not construct address");
 			}
@@ -2619,7 +2625,7 @@
 }
 static void ldapdns_process_axfrsearch_start(dns_ctx *c)
 {
-	const char *attrs[11] = {
+	const char *attrs[12] = {
 				"aRecord",
 				"mXRecord",
 				"cNAMERecord",
@@ -2628,7 +2634,8 @@
 				"photo",
 				"mail",
 				"nSRecord",
-				"modifyTimestamp"
+				"modifyTimestamp",
+				"entryTtl"
 	};
 	int r;
 	int err_code;
@@ -2707,10 +2714,10 @@
 retry_axfr_next_top_l:
 	if (ldapdns.dn_mode == DN_MODE_RFC1279
 			|| ldapdns.dn_mode == DN_MODE_MSDNS) {
-		attrs[9] = (const char *)"dNSRecord";
-		attrs[10] = (const char *)0;
+		attrs[10] = (const char *)"dNSRecord";
+		attrs[11] = (const char *)0;
 	} else {
-		attrs[9] = (const char *)0;
+		attrs[10] = (const char *)0;
 	}
 
 	pthread_mutex_lock(&c->c->lock);
diff -u ldapdns-2.06/ldapdns.c ldapdns-2.06.mod2//ldapdns.c
--- ldapdns-2.06/ldapdns.c	2004-12-31 03:48:24.000000000 +0100
+++ ldapdns-2.06.mod2//ldapdns.c	2010-04-07 12:07:13.000000000 +0200
@@ -21,6 +21,7 @@
 		list_push(&x, lp->str);
 		list_push(&seen, lp->str);
 HIT:
+		continue;
 	}
 
 	lp = *p;
@@ -809,6 +810,20 @@
 	}
 	return 0;
 }
+static int inline ldap_entryttl(dns_ctx * c, bin_t rrdata)
+{
+	/* TODO Debug */
+	char * txt=NULL;
+	unsigned long ttl=0;
+	txt = __parse_txt(rrdata);
+	/* Chomp space at beginning */
+	for(txt;*txt!='\0';txt++) if(isdigit((int)*txt)) break;
+	ttl=(unsigned long)atoll(txt);
+	if(ttl>0) {
+		c->rttl = ttl;
+	}
+	return 1;
+}
 static void inline handle_ldap_rrdata(dns_ctx *c, char *attr, bin_t rrdata)
 {
 	switch (attr[0]) {
@@ -866,6 +881,9 @@
 			ldap_soarecord(c, rrdata);
 		}
 		break;
+	case 'e':
+		/* entryTtl */
+		ldap_entryttl(c, rrdata);
 	};
 }
 int ldap_load_dns_attributes(dns_ctx *c, char **dn, int zonef)
@@ -899,6 +917,7 @@
 		str_lc(attr);
 
 		for (i = 0; bvals[i]; i++) {
+
 			len = bvals[i]->bv_len;
 			if (len < 1)
 				continue;
@@ -913,7 +932,6 @@
 				continue;
 			}
 
-
 			/* convert to bin */
 			bin_copy(rrdata, val, bvals[i]->bv_len);
 
diff -u ldapdns-2.06/ldapdns.h ldapdns-2.06.mod2//ldapdns.h
--- ldapdns-2.06/ldapdns.h	2004-12-31 03:39:57.000000000 +0100
+++ ldapdns-2.06.mod2//ldapdns.h	2010-04-07 12:07:13.000000000 +0200
@@ -101,6 +101,7 @@
 	list_t		NS;
 	unsigned long	serial, refresh, retry, expire, minimum;
 	unsigned long	ttl;
+	unsigned long   rttl;
 
 	/* used per-round */
 	list_t		DNSRecord;
Common subdirectories: ldapdns-2.06/sample and ldapdns-2.06.mod2//sample
Common subdirectories: ldapdns-2.06/sysvinit and ldapdns-2.06.mod2//sysvinit

