X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fquery.c;h=2b36d041f4a19967638daf5c5941ae62b117caaa;hb=0ea82d760348fe9153dfd2adc10335a50f59628b;hp=0b62ff6227d60d95cb79519fbce45cd1b2230f60;hpb=d24e2a7e320670a31d52040213c58e1be337726c;p=adns.git diff --git a/src/query.c b/src/query.c index 0b62ff6..2b36d04 100644 --- a/src/query.c +++ b/src/query.c @@ -5,12 +5,11 @@ * - query submission and cancellation (user-visible and internal) */ /* - * This file is - * Copyright (C) 1997-2000 Ian Jackson - * - * It is part of adns, which is - * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999-2000 Tony Finch + * This file is part of adns, which is + * Copyright (C) 1997-2000,2003,2006 Ian Jackson + * Copyright (C) 1999-2000,2003,2006 Tony Finch + * Copyright (C) 1991 Massachusetts Institute of Technology + * (See the file INSTALL for full details.) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +36,8 @@ #include "internal.h" -static adns_query query_alloc(adns_state ads, const typeinfo *typei, +static adns_query query_alloc(adns_state ads, + const typeinfo *typei, adns_rrtype type, adns_queryflags flags, struct timeval now) { /* Allocate a virgin query and return it. */ adns_query qu; @@ -79,7 +79,7 @@ static adns_query query_alloc(adns_state ads, const typeinfo *typei, qu->answer->status= adns_s_ok; qu->answer->cname= qu->answer->owner= 0; - qu->answer->type= typei->type; + qu->answer->type= type; qu->answer->expires= -1; qu->answer->nrrs= 0; qu->answer->rrs.untyped= 0; @@ -115,7 +115,7 @@ adns_status adns__internal_submit(adns_state ads, adns_query *query_r, const qcontext *ctx) { adns_query qu; - qu= query_alloc(ads,typei,flags,now); + qu= query_alloc(ads,typei,typei->typekey,flags,now); if (!qu) { adns__vbuf_free(qumsg_vb); return adns_s_nomemory; } *query_r= qu; @@ -133,7 +133,8 @@ static void query_simple(adns_state ads, adns_query qu, int id; adns_status stat; - stat= adns__mkquery(ads,&qu->vb,&id, owner,ol, typei,flags); + stat= adns__mkquery(ads,&qu->vb,&id, owner,ol, + typei,qu->answer->type, flags); if (stat) { if (stat == adns_s_querydomaintoolong && (flags & adns_qf_search)) { adns__search_next(ads,qu,now); @@ -225,11 +226,12 @@ int adns_submit(adns_state ads, if (!typei) return ENOSYS; r= gettimeofday(&now,0); if (r) goto x_errno; - qu= query_alloc(ads,typei,flags,now); if (!qu) goto x_errno; + qu= query_alloc(ads,typei,type,flags,now); if (!qu) goto x_errno; qu->ctx.ext= context; qu->ctx.callback= 0; - memset(&qu->ctx.info,0,sizeof(qu->ctx.info)); + memset(&qu->ctx.pinfo,0,sizeof(qu->ctx.pinfo)); + memset(&qu->ctx.tinfo,0,sizeof(qu->ctx.tinfo)); *query_r= qu;