* SOFTWARE.
*/
-/* $Id: resolver.c,v 1.150 2000/07/19 23:19:05 gson Exp $ */
+/* $Id: resolver.c,v 1.151 2000/07/24 20:10:26 gson Exp $ */
#include <config.h>
qname = &fctx->name;
type = fctx->type;
result = dns_message_firstname(message, DNS_SECTION_ANSWER);
- while (result == ISC_R_SUCCESS) {
+ while (!done && result == ISC_R_SUCCESS) {
name = NULL;
dns_message_currentname(message, DNS_SECTION_ANSWER, &name);
external = ISC_TF(!dns_name_issubdomain(name, &fctx->domain));
found = ISC_FALSE;
want_chaining = ISC_FALSE;
aflag = 0;
- if (rdataset->type == type ||
- type == dns_rdatatype_any) {
+ if (rdataset->type == type) {
/*
* We've found an ordinary answer.
*/
found = ISC_TRUE;
+ done = ISC_TRUE;
+ aflag = DNS_RDATASETATTR_ANSWER;
+ } else if (type == dns_rdatatype_any) {
+ /*
+ * We've found an answer matching
+ * an ANY query. There may be
+ * more.
+ */
+ found = ISC_TRUE;
aflag = DNS_RDATASETATTR_ANSWER;
} else if (rdataset->type == dns_rdatatype_sig
&& rdataset->covers == type) {
}
result = dns_message_nextname(message, DNS_SECTION_ANSWER);
}
- if (result != ISC_R_NOMORE)
+ if (result == ISC_R_NOMORE)
+ result = ISC_R_SUCCESS;
+ if (result != ISC_R_SUCCESS)
return (result);
/*
}
result = dns_message_nextname(message, DNS_SECTION_AUTHORITY);
}
- if (result != ISC_R_NOMORE)
- return (result);
+ if (result == ISC_R_NOMORE)
+ result = ISC_R_SUCCESS;
- return (ISC_R_SUCCESS);
+ return (result);
}
static void