3 @@ -103,12 +103,13 @@ static int doname(void)
4 return response_addname(d1);
7 -static int doit(char *q,char qtype[2])
8 +static int doit1(char **pqname,char qtype[2])
18 @@ -122,6 +123,12 @@ static int doit(char *q,char qtype[2])
25 + if (loop++ >= 100) return 0 ;
31 @@ -136,7 +143,14 @@ static int doit(char *q,char qtype[2])
32 if (byte_equal(type,2,DNS_T_NS)) flagns = 1;
35 - if (!*control) return 0; /* q is not within our bailiwick */
36 + if (!*control) { /* q is not within our bailiwick */
41 + goto DONE; /* The administrator has issued contradictory instructions */
47 @@ -172,9 +186,17 @@ static int doit(char *q,char qtype[2])
50 if (!response_rstart(q,type,ttl)) return 0;
51 - if (byte_equal(type,2,DNS_T_NS) || byte_equal(type,2,DNS_T_CNAME) || byte_equal(type,2,DNS_T_PTR)) {
52 + if (byte_equal(type,2,DNS_T_NS) || byte_equal(type,2,DNS_T_PTR)) {
53 if (!doname()) return 0;
55 + else if (byte_equal(type,2,DNS_T_CNAME)) {
56 + if (!doname()) return 0;
57 + if (byte_diff(type,2,qtype)) {
58 + response_rfinish(RESPONSE_ANSWER);
59 + if (!dns_domain_copy(pqname,d1)) return 0 ;
63 else if (byte_equal(type,2,DNS_T_MX)) {
64 if (!dobytes(2)) return 0;
65 if (!doname()) return 0;
66 @@ -275,9 +297,21 @@ static int doit(char *q,char qtype[2])
74 +static int doit(char *qname,char qtype[2])
79 + if (!dns_domain_copy(&q, qname)) return 0 ;
80 + r = doit1(&q, qtype) ;
81 + dns_domain_free(&q) ;
85 int respond(char *q,char qtype[2],char ip[4])
87 static struct tai cdb_valid = { 0 };