Commit 9a8cec49 authored by Mark Andrews's avatar Mark Andrews
Browse files

1995. [bug] 'host' was reporting multiple "is an alias" messages.

                        [RT #15702]
parent 641f68d4
1995. [bug] 'host' was reporting multiple "is an alias" messages.
[RT #15702]
1994. [port] OpenSSL 0.9.8 support. [RT #15694]
1993. [bug] Log messsage, via syslog, were missing the space
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: host.c,v 1.106 2005/08/25 00:40:49 marka Exp $ */
/* $Id: host.c,v 1.107 2006/03/02 01:45:46 marka Exp $ */
/*! \file */
......@@ -39,6 +39,7 @@
#include <dns/rdataclass.h>
#include <dns/rdataset.h>
#include <dns/rdatatype.h>
#include <dns/rdatastruct.h>
#include <dig/dig.h>
......@@ -355,6 +356,32 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
return (ISC_R_SUCCESS);
}
static void
chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
isc_result_t result;
dns_rdataset_t *rdataset;
dns_rdata_cname_t cname;
dns_rdata_t rdata = DNS_RDATA_INIT;
unsigned int i = msg->counts[DNS_SECTION_ANSWER];
while (i-- > 0) {
rdataset = NULL;
result = dns_message_findname(msg, DNS_SECTION_ANSWER, qname,
dns_rdatatype_cname, 0, NULL,
&rdataset);
if (result != ISC_R_SUCCESS)
return;
result = dns_rdataset_first(rdataset);
check_result(result, "dns_rdataset_first");
dns_rdata_reset(&rdata);
dns_rdataset_current(rdataset, &rdata);
result = dns_rdata_tostruct(&rdata, &cname, NULL);
check_result(result, "dns_rdata_tostruct");
dns_name_copy(&cname.cname, qname, NULL);
dns_rdata_freestruct(&cname);
}
}
isc_result_t
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
isc_boolean_t did_flag = ISC_FALSE;
......@@ -393,10 +420,15 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) {
char namestr[DNS_NAME_FORMATSIZE];
dig_lookup_t *lookup;
dns_fixedname_t fixed;
dns_name_t *name;
/* Add AAAA and MX lookups. */
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
dns_name_copy(query->lookup->name, name, NULL);
chase_cnamechain(msg, name);
dns_name_format(name, namestr, sizeof(namestr));
lookup = clone_lookup(query->lookup, ISC_FALSE);
if (lookup != NULL) {
strncpy(lookup->textname, namestr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment