mirror of https://github.com/getdnsapi/getdns.git
don't try stubs without upstreams
This commit is contained in:
parent
623c9b04a5
commit
c017e75f5a
|
@ -390,6 +390,13 @@ set_os_defaults(struct getdns_context *context)
|
||||||
filechg_check(context, context->fchg_resolvconf);
|
filechg_check(context, context->fchg_resolvconf);
|
||||||
|
|
||||||
context->suffix = getdns_list_create_with_context(context);
|
context->suffix = getdns_list_create_with_context(context);
|
||||||
|
(void) getdns_list_get_length(context->suffix, &length);
|
||||||
|
if (length == 0 && *domain != 0) {
|
||||||
|
bindata.data = (uint8_t *)domain;
|
||||||
|
bindata.size = strlen(domain) + 1;
|
||||||
|
(void) getdns_list_set_bindata(context->suffix, 0, &bindata);
|
||||||
|
}
|
||||||
|
|
||||||
context->upstreams = upstreams_create(context, upstreams_limit);
|
context->upstreams = upstreams_create(context, upstreams_limit);
|
||||||
|
|
||||||
in = fopen(context->fchg_resolvconf->fn, "r");
|
in = fopen(context->fchg_resolvconf->fn, "r");
|
||||||
|
@ -467,12 +474,6 @@ set_os_defaults(struct getdns_context *context)
|
||||||
}
|
}
|
||||||
fclose(in);
|
fclose(in);
|
||||||
|
|
||||||
(void) getdns_list_get_length(context->suffix, &length);
|
|
||||||
if (length == 0 && *domain != 0) {
|
|
||||||
bindata.data = (uint8_t *)domain;
|
|
||||||
bindata.size = strlen(domain) + 1;
|
|
||||||
(void) getdns_list_set_bindata(context->suffix, 0, &bindata);
|
|
||||||
}
|
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
} /* set_os_defaults */
|
} /* set_os_defaults */
|
||||||
|
|
||||||
|
@ -1678,6 +1679,8 @@ priv_getdns_ns_dns_setup(struct getdns_context *context)
|
||||||
/* We get away with just setting up ldns here here because sync mode
|
/* We get away with just setting up ldns here here because sync mode
|
||||||
* always hits this method because at the moment all sync calls use DNS
|
* always hits this method because at the moment all sync calls use DNS
|
||||||
* namespace */
|
* namespace */
|
||||||
|
if (!context->upstreams || !context->upstreams->count)
|
||||||
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
r = ub_setup_stub(context->unbound_ctx, context->upstreams);
|
r = ub_setup_stub(context->unbound_ctx, context->upstreams);
|
||||||
if (r != GETDNS_RETURN_GOOD)
|
if (r != GETDNS_RETURN_GOOD)
|
||||||
return r;
|
return r;
|
||||||
|
@ -1992,7 +1995,7 @@ priv_get_context_settings(getdns_context* context) {
|
||||||
r |= getdns_dict_set_int(result, "append_name", context->append_name);
|
r |= getdns_dict_set_int(result, "append_name", context->append_name);
|
||||||
/* list fields */
|
/* list fields */
|
||||||
r |= priv_dict_set_list_if_not_null(result, "suffix", context->suffix);
|
r |= priv_dict_set_list_if_not_null(result, "suffix", context->suffix);
|
||||||
if (context->upstreams->count > 0) {
|
if (context->upstreams && context->upstreams->count > 0) {
|
||||||
size_t i;
|
size_t i;
|
||||||
getdns_upstream *upstream;
|
getdns_upstream *upstream;
|
||||||
getdns_list *upstreams =
|
getdns_list *upstreams =
|
||||||
|
|
Loading…
Reference in New Issue