From ac015392d33daece5de3b5cf9ecfa6a8988860fe Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 10 Mar 2001 19:03:39 +0000 Subject: [PATCH] + Bugfixes: @@ -1,3 +1,11 @@ +adns (1.1); urgency=medium + + Bugfixes: + * Stop searching on a CNAME (even if it's broken). + * When search list runs out, _qf_owner sets owner to query domain. + + -- + adns (1.0); urgency=medium Bugfixes: --- changelog | 8 ++++++++ src/query.c | 16 +++++++++------- src/reply.c | 5 +++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/changelog b/changelog index d8e3400..0cea196 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,11 @@ +adns (1.1); urgency=medium + + Bugfixes: + * Stop searching on a CNAME (even if it's broken). + * When search list runs out, _qf_owner sets owner to query domain. + + -- + adns (1.0); urgency=medium Bugfixes: diff --git a/src/query.c b/src/query.c index 6cfebb5..2bb5236 100644 --- a/src/query.c +++ b/src/query.c @@ -157,8 +157,8 @@ void adns__search_next(adns_state ads, adns_query qu, struct timeval now) { } else { if (qu->search_pos >= ads->nsearchlist) { if (qu->search_doneabs) { + qu->search_vb.used= qu->search_origlen; stat= adns_s_nxdomain; goto x_fail; - return; } else { nextentry= 0; qu->search_doneabs= 1; @@ -171,9 +171,8 @@ void adns__search_next(adns_state ads, adns_query qu, struct timeval now) { qu->search_vb.used= qu->search_origlen; if (nextentry) { if (!adns__vbuf_append(&qu->search_vb,".",1) || - !adns__vbuf_appendstr(&qu->search_vb,nextentry)) { - stat= adns_s_nomemory; goto x_fail; - } + !adns__vbuf_appendstr(&qu->search_vb,nextentry)) + goto x_nomemory; } free(qu->query_dgram); @@ -181,7 +180,9 @@ void adns__search_next(adns_state ads, adns_query qu, struct timeval now) { query_simple(ads,qu, qu->search_vb.buf, qu->search_vb.used, qu->typei, qu->flags, now); return; - + +x_nomemory: + stat= adns_s_nomemory; x_fail: adns__query_fail(qu,stat); } @@ -190,6 +191,8 @@ static int save_owner(adns_query qu, const char *owner, int ol) { /* Returns 1 if OK, otherwise there was no memory. */ adns_answer *ans; + if (!(qu->flags & adns_qf_owner)) return 1; + ans= qu->answer; assert(!ans->owner); @@ -508,8 +511,7 @@ void adns__query_done(adns_query qu) { qu->id= -1; ans= qu->answer; - if (qu->flags & adns_qf_owner && qu->flags & adns_qf_search && - ans->status != adns_s_nomemory) { + if (qu->flags & adns_qf_search && ans->status != adns_s_nomemory) { if (!save_owner(qu, qu->search_vb.buf, qu->search_vb.used)) { adns__query_fail(qu,adns_s_nomemory); return; diff --git a/src/reply.c b/src/reply.c index 83988a0..2691f67 100644 --- a/src/reply.c +++ b/src/reply.c @@ -198,7 +198,8 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, qu->cname_begin= rdstart; qu->cname_dglen= dglen; st= adns__parse_domain(ads,serv,qu, &qu->vb, - qu->flags & adns_qf_quotefail_cname ? 0 : pdf_quoteok, + qu->flags & adns_qf_quotefail_cname + ? 0 : pdf_quoteok, dgram,dglen, &rdstart,rdstart+rdlength); if (!qu->vb.used) goto x_truncated; if (st) { adns__query_fail(qu,st); return; } @@ -257,7 +258,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, /* We still wanted to look for the SOA so we could find the TTL. */ adns__update_expires(qu,soattl,now); - if (qu->flags & adns_qf_search) { + if (qu->flags & adns_qf_search && !qu->cname_dgram) { adns__search_next(ads,qu,now); } else { adns__query_fail(qu,adns_s_nxdomain); -- 2.11.0