summaryrefslogtreecommitdiff
path: root/examples/ldns-keyfetcher.c
diff options
context:
space:
mode:
authorWillem Toorop <willem@NLnetLabs.nl>2012-09-25 13:58:14 +0200
committerWillem Toorop <willem@NLnetLabs.nl>2012-09-25 13:58:14 +0200
commite5822572592c6c47f516e99c0ca99e211461859d (patch)
tree013330ffe556c5c3ec9007b11a8adb298ea3c8f1 /examples/ldns-keyfetcher.c
parentbb5b0f6359d7e9494dec17f40323b3d87c9fec8e (diff)
downloadldns-e5822572592c6c47f516e99c0ca99e211461859d.tar.gz
Final code review thingies:
Bufferoverflow in data_buffer2wire in ldns-testpkts.c Print unknown rcodes in ldns_axfr_next in resolver.c Handle errors in main in ldns-keyfetcher.c Continue in correct loop in ldns_resolver_new_frm_fp_l in resolver.c Skip set delimeters (to del) when tokenread i.s.o. delim in ldns_bget_token and ldns_fget_token in parse.c Test reply when verifying tsig in ldns_send_buffer in net.c Assert that verify_next_hashed_name is only called with nsecs in the zone with ldns-verify-zone.c Set inception and expiration on keys after they are read from the engine in main in ldns-signzone.c Gracefully return from ldns_dnssec_zone_add_empty_nonterminals in a broken rbtree. Check if tree->rr is null before use in ldns_dnssec_trust_tree_contains_keys in dnssec_verify.c Check data for null before use in ldns_dnssec_create_nsec_bitmap in dnssec.c Dead code in ldns_str2rdf_wks, ldns_resolver_query, examples/ldns_testpkts/data_buffer2wire, drill/work/packetbuffromfile & ldns_dnssec_verify_denial_nsec3_match.
Diffstat (limited to 'examples/ldns-keyfetcher.c')
-rw-r--r--examples/ldns-keyfetcher.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/examples/ldns-keyfetcher.c b/examples/ldns-keyfetcher.c
index 267822f8..ee06aea9 100644
--- a/examples/ldns-keyfetcher.c
+++ b/examples/ldns-keyfetcher.c
@@ -649,10 +649,21 @@ main(int argc, char *argv[])
fprintf(stderr, "Warning: Unable to create stub resolver from /etc/resolv.conf:\n");
fprintf(stderr, "%s\n", ldns_get_errorstr_by_id(status));
fprintf(stderr, "defaulting to nameserver at 127.0.0.1 for separate nameserver name lookups\n");
- res = ldns_resolver_new();
- ns = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, "127.0.0.1");
- status = ldns_resolver_push_nameserver(res, ns);
- if (status != LDNS_STATUS_OK) {
+ for (;;) {
+ res = ldns_resolver_new();
+ if (res) {
+ ns = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A,
+ "127.0.0.1");
+ if (ns) {
+ status = ldns_resolver_push_nameserver(
+ res, ns);
+ if (status == LDNS_STATUS_OK) {
+ break;
+ }
+ ldns_rdf_deep_free(ns);
+ }
+ ldns_resolver_free(res);
+ }
fprintf(stderr, "Unable to create stub resolver: %s\n", ldns_get_errorstr_by_id(status));
exit(EXIT_FAILURE);
}