aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ldns-mx.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ldns-mx.c')
-rw-r--r--examples/ldns-mx.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/examples/ldns-mx.c b/examples/ldns-mx.c
index 873cf55f87de..84d27c837f89 100644
--- a/examples/ldns-mx.c
+++ b/examples/ldns-mx.c
@@ -40,6 +40,15 @@ main(int argc, char *argv[])
usage(stdout, argv[0]);
exit(EXIT_FAILURE);
}
+ if (! ldns_dname_str_absolute(argv[1]) &&
+ ldns_dname_absolute(domain)) {
+
+ /* ldns_dname_new_frm_str makes absolute dnames always!
+ * So deabsolutify domain.
+ * TODO: Create ldns_dname_new_frm_str_relative? Yuck!
+ */
+ ldns_rdf_set_size(domain, ldns_rdf_size(domain) - 1);
+ }
}
/* create a new resolver from /etc/resolv.conf */
@@ -52,11 +61,11 @@ main(int argc, char *argv[])
/* use the resolver to send a query for the mx
* records of the domain given on the command line
*/
- p = ldns_resolver_query(res,
- domain,
- LDNS_RR_TYPE_MX,
- LDNS_RR_CLASS_IN,
- LDNS_RD);
+ p = ldns_resolver_search(res,
+ domain,
+ LDNS_RR_TYPE_MX,
+ LDNS_RR_CLASS_IN,
+ LDNS_RD);
ldns_rdf_deep_free(domain);