[cvslog] (2004-12-22 17:41:04 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Wed Dec 22 11:41:04 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2004-12-22 17:41:04 UTC
Commited by: Bryan Drewery <lordares at shatow.net>

Modified files:
     lib/eggdrop/dns.c

Log message:

* reply.ttl was clobbered, using the lowest value from the replies now

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/dns.c
diff -u eggdrop1.9/lib/eggdrop/dns.c:1.10 eggdrop1.9/lib/eggdrop/dns.c:1.11
--- eggdrop1.9/lib/eggdrop/dns.c:1.10	Mon Dec 20 16:18:51 2004
+++ eggdrop1.9/lib/eggdrop/dns.c	Wed Dec 22 11:40:54 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: dns.c,v 1.10 2004/12/20 22:18:51 lordares Exp $";
+static const char rcsid[] = "$Id: dns.c,v 1.11 2004/12/22 17:40:54 lordares Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -580,6 +580,7 @@
 	char result[512];
 	unsigned char *ptr;
 	int i;
+	time_t ttl = 0;
 
 	ptr = (unsigned char *)response;
 	memcpy(&header, ptr, 12);
@@ -613,6 +614,8 @@
 		reply.type = ntohs(reply.type);
 		reply.rdlength = ntohs(reply.rdlength);
 		reply.ttl = ntohl(reply.ttl);
+		/* Cache the lowest ttl */
+		if (reply.ttl && (reply.ttl < ttl)) ttl = reply.ttl
 		ptr += 10;
 		if (reply.type == 1) {
 			/*fprintf(fp, "ipv4 reply\n");*/
@@ -663,7 +666,7 @@
 	if (prev) prev->next = q->next;
 	else query_head = q->next;
 
-	cache_add(q->query, &q->answer, reply.ttl);
+	cache_add(q->query, &q->answer, ttl);
 
 	q->callback(q->client_data, q->query, q->answer.list);
 	answer_free(&q->answer);
----------------------- End of diff -----------------------



More information about the Changes mailing list