View | Details | Raw Unified | Return to bug 115297
Collapse All | Expand All

(-)Makefile (+1 lines)
Lines 7-12 Link Here
7
7
8
PORTNAME=	adns
8
PORTNAME=	adns
9
PORTVERSION=	1.4
9
PORTVERSION=	1.4
10
PORTREVISION=	1
10
CATEGORIES=	dns
11
CATEGORIES=	dns
11
MASTER_SITES=	ftp://ftp.chiark.greenend.org.uk/users/ian/adns/ \
12
MASTER_SITES=	ftp://ftp.chiark.greenend.org.uk/users/ian/adns/ \
12
		http://www.chiark.greenend.org.uk/~ian/adns/ftp/
13
		http://www.chiark.greenend.org.uk/~ian/adns/ftp/
(-)files/patch-cname-chains (+56 lines)
Added Link Here
1
Index: src/query.c
2
===================================================================
3
--- src/query.c	(revision 14)
4
+++ src/query.c	(working copy)
5
@@ -63,6 +63,10 @@
6
 
7
   qu->cname_dgram= 0;
8
   qu->cname_dglen= qu->cname_begin= 0;
9
+  /* Patch to allow CNAME chains */
10
+  /* Credits: Brad Spencer, see http://www.chiark.greenend.org.uk/pipermail/adns-discuss/2006/001161.html */
11
+  /* Allow CNAME chains up to some sane limit */
12
+  qu->cname_alias_hops_left = 10;
13
 
14
   adns__vbuf_init(&qu->search_vb);
15
   qu->search_origlen= qu->search_pos= qu->search_doneabs= 0;
16
Index: src/internal.h
17
===================================================================
18
--- src/internal.h	(revision 14)
19
+++ src/internal.h	(working copy)
20
@@ -231,6 +231,11 @@
21
   int cname_dglen, cname_begin;
22
   /* If non-0, has been allocated using . */
23
 
24
+  /* Patch to allow CNAME chains */
25
+  /* Credits: Brad Spencer, see http://www.chiark.greenend.org.uk/pipermail/adns-discuss/2006/001161.html */
26
+  int cname_alias_hops_left;
27
+  /* The number of cname alias hops we will allow */
28
+
29
   vbuf search_vb;
30
   int search_origlen, search_pos, search_doneabs;
31
   /* Used by the searching algorithm.  The query domain in textual form
32
Index: src/reply.c
33
===================================================================
34
--- src/reply.c	(revision 14)
35
+++ src/reply.c	(working copy)
36
@@ -190,12 +190,17 @@
37
       if (qu->flags & adns_qf_cname_forbid) {
38
 	adns__query_fail(qu,adns_s_prohibitedcname);
39
 	return;
40
-      } else if (qu->cname_dgram) { /* Ignore second and subsequent CNAME(s) */
41
+      }
42
+
43
+    /* Patch to allow CNAME chains */
44
+    /* Credits: Brad Spencer, see http://www.chiark.greenend.org.uk/pipermail/adns-discuss/2006/001161.html */
45
+    else if (qu->cname_dgram && --(qu->cname_alias_hops_left) <= 0) { /* Don't follow "too long" CNAME chains */
46
 	adns__debug(ads,serv,qu,"allegedly canonical name %s"
47
-		    " is actually alias for %s", qu->answer->cname,
48
+           " is actually alias for %s and aliases too deep",
49
+                    qu->answer->cname,
50
 		    adns__diag_domain(ads,serv,qu, &qu->vb,
51
 				      dgram,dglen,rdstart));
52
-	adns__query_fail(qu,adns_s_prohibitedcname);
53
+    adns__query_fail(qu,adns_s_norecurse);
54
 	return;
55
       } else if (wantedrrs) { /* Ignore CNAME(s) after RR(s). */
56
 	adns__debug(ads,serv,qu,"ignoring CNAME (to %s) coexisting with RR",

Return to bug 115297