mirror of https://github.com/getdnsapi/getdns.git
Something wrong with /etc/hosts?
This commit is contained in:
parent
eecc18703a
commit
dc6bb0fa52
|
@ -192,7 +192,7 @@
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_address(context, "localhost", NULL,
|
ASSERT_RC(getdns_address(context, "localhost.", NULL,
|
||||||
&fn_ref, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
|
|
||||||
CONTEXT_CREATE(TRUE);
|
CONTEXT_CREATE(TRUE);
|
||||||
|
|
||||||
ASSERT_RC(getdns_address_sync(context, "localhost", NULL, &response),
|
ASSERT_RC(getdns_address_sync(context, "localhost.", NULL, &response),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address_sync()");
|
||||||
|
|
||||||
EXTRACT_LOCAL_RESPONSE;
|
EXTRACT_LOCAL_RESPONSE;
|
||||||
|
|
|
@ -70,6 +70,7 @@ void extract_response(struct getdns_dict *response, struct extracted_response *e
|
||||||
* If it is absent, do not try to decompose the replies_tree, because the
|
* If it is absent, do not try to decompose the replies_tree, because the
|
||||||
* answer most likely came not from DNS.
|
* answer most likely came not from DNS.
|
||||||
*/
|
*/
|
||||||
|
ex_response->reponse = response;
|
||||||
have_answer_type = getdns_dict_get_int(response, "answer_type", &ex_response->top_answer_type) ==
|
have_answer_type = getdns_dict_get_int(response, "answer_type", &ex_response->top_answer_type) ==
|
||||||
GETDNS_RETURN_GOOD;
|
GETDNS_RETURN_GOOD;
|
||||||
|
|
||||||
|
@ -233,11 +234,14 @@ void assert_address_in_answer(struct extracted_response *ex_response, int a, int
|
||||||
*/
|
*/
|
||||||
void assert_address_in_just_address_answers(struct extracted_response *ex_response)
|
void assert_address_in_just_address_answers(struct extracted_response *ex_response)
|
||||||
{
|
{
|
||||||
size_t length;
|
size_t length = 0;
|
||||||
|
char *resp_str = "";
|
||||||
ASSERT_RC(getdns_list_get_length(ex_response->just_address_answers, &length),
|
ASSERT_RC(getdns_list_get_length(ex_response->just_address_answers, &length),
|
||||||
GETDNS_RETURN_GOOD, "Failed to extract \"just_address_answers\" length");
|
GETDNS_RETURN_GOOD, "Failed to extract \"just_address_answers\" length");
|
||||||
|
|
||||||
ck_assert_msg(length > 0, "Expected \"just_address_answers\" length > 0, got %d", length);
|
if (length == 0) resp_str = getdns_pretty_print_dict(ex_response->response);
|
||||||
|
ck_assert_msg(length > 0, "Expected \"just_address_answers\" length > 0, got %d\n%s", length, resp_str);
|
||||||
|
if (length == 0) free(resp_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
struct extracted_response {
|
struct extracted_response {
|
||||||
uint32_t top_answer_type;
|
uint32_t top_answer_type;
|
||||||
|
struct getdns_dict *response;
|
||||||
struct getdns_bindata *top_canonical_name;
|
struct getdns_bindata *top_canonical_name;
|
||||||
struct getdns_list *just_address_answers;
|
struct getdns_list *just_address_answers;
|
||||||
struct getdns_list *replies_full;
|
struct getdns_list *replies_full;
|
||||||
|
|
Loading…
Reference in New Issue