mirror of https://github.com/getdnsapi/getdns.git
get_val_chain for all possible scenarios
This commit is contained in:
parent
e328f848eb
commit
3631cd658a
1021
src/dnssec.c
1021
src/dnssec.c
File diff suppressed because it is too large
Load Diff
|
@ -172,7 +172,7 @@ submit_network_request(getdns_network_req *netreq)
|
|||
static getdns_return_t
|
||||
getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t *transaction_id,
|
||||
void *userarg, getdns_dns_req **dnsreq_p,
|
||||
getdns_callback_t callbackfn, internal_cb_t internal_cb, int usenamespaces)
|
||||
{
|
||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
||||
|
@ -203,8 +203,8 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
req->user_callback = callbackfn;
|
||||
req->internal_cb = internal_cb;
|
||||
|
||||
if (transaction_id)
|
||||
*transaction_id = req->trans_id;
|
||||
if (dnsreq_p)
|
||||
*dnsreq_p = req;
|
||||
|
||||
getdns_context_track_outbound_request(req);
|
||||
|
||||
|
@ -253,12 +253,12 @@ getdns_general_ns(getdns_context *context, getdns_eventloop *loop,
|
|||
getdns_return_t
|
||||
priv_getdns_general_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t *transaction_id,
|
||||
void *userarg, getdns_dns_req **dnsreq_p,
|
||||
getdns_callback_t callback, internal_cb_t internal_cb)
|
||||
{
|
||||
return getdns_general_ns(context, loop,
|
||||
name, request_type, extensions,
|
||||
userarg, transaction_id, callback, internal_cb, 0);
|
||||
userarg, dnsreq_p, callback, internal_cb, 0);
|
||||
|
||||
} /* getdns_general_loop */
|
||||
|
||||
|
@ -270,6 +270,7 @@ priv_getdns_address_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
getdns_dict *my_extensions = extensions;
|
||||
getdns_return_t r;
|
||||
uint32_t value;
|
||||
getdns_dns_req *dnsreq = NULL;
|
||||
|
||||
if (!my_extensions) {
|
||||
if (!(my_extensions=getdns_dict_create_with_context(context)))
|
||||
|
@ -285,7 +286,9 @@ priv_getdns_address_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
|
||||
r = getdns_general_ns(context, loop,
|
||||
name, GETDNS_RRTYPE_AAAA, my_extensions,
|
||||
userarg, transaction_id, callback, NULL, 1);
|
||||
userarg, &dnsreq, callback, NULL, 1);
|
||||
if (dnsreq && transaction_id)
|
||||
*transaction_id = dnsreq->trans_id;
|
||||
|
||||
if (my_extensions != extensions)
|
||||
getdns_dict_destroy(my_extensions);
|
||||
|
@ -303,6 +306,7 @@ priv_getdns_hostname_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
uint16_t req_type;
|
||||
char name[1024];
|
||||
getdns_return_t retval;
|
||||
getdns_dns_req *dnsreq = NULL;
|
||||
|
||||
if ((retval =
|
||||
getdns_dict_get_bindata(address, "address_data",
|
||||
|
@ -376,7 +380,9 @@ priv_getdns_hostname_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
}
|
||||
retval = priv_getdns_general_loop(context, loop, name, req_type,
|
||||
extensions, userarg, transaction_id, callback, NULL);
|
||||
extensions, userarg, &dnsreq, callback, NULL);
|
||||
if (dnsreq && transaction_id)
|
||||
*transaction_id = dnsreq->trans_id;
|
||||
return retval;
|
||||
} /* getdns_hostname_loop */
|
||||
|
||||
|
@ -385,8 +391,13 @@ priv_getdns_service_loop(getdns_context *context, getdns_eventloop *loop,
|
|||
const char *name, getdns_dict *extensions, void *userarg,
|
||||
getdns_transaction_t * transaction_id, getdns_callback_t callback)
|
||||
{
|
||||
return getdns_general_ns(context, loop, name, GETDNS_RRTYPE_SRV,
|
||||
extensions, userarg, transaction_id, callback, NULL, 1);
|
||||
getdns_return_t r;
|
||||
getdns_dns_req *dnsreq = NULL;
|
||||
r = getdns_general_ns(context, loop, name, GETDNS_RRTYPE_SRV,
|
||||
extensions, userarg, &dnsreq, callback, NULL, 1);
|
||||
if (dnsreq && transaction_id)
|
||||
*transaction_id = dnsreq->trans_id;
|
||||
return r;
|
||||
} /* getdns_service_loop */
|
||||
|
||||
/**
|
||||
|
@ -398,11 +409,16 @@ getdns_general(getdns_context *context,
|
|||
void *userarg, getdns_transaction_t * transaction_id,
|
||||
getdns_callback_t callback)
|
||||
{
|
||||
if (!context) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
return priv_getdns_general_loop(context, context->extension,
|
||||
name, request_type, extensions,
|
||||
userarg, transaction_id, callback, NULL);
|
||||
getdns_return_t r;
|
||||
getdns_dns_req *dnsreq = NULL;
|
||||
|
||||
if (!context) return GETDNS_RETURN_INVALID_PARAMETER;
|
||||
r = priv_getdns_general_loop(context, context->extension,
|
||||
name, request_type, extensions,
|
||||
userarg, &dnsreq, callback, NULL);
|
||||
if (dnsreq && transaction_id)
|
||||
*transaction_id = dnsreq->trans_id;
|
||||
return r;
|
||||
} /* getdns_general */
|
||||
|
||||
/*
|
||||
|
|
|
@ -42,13 +42,13 @@
|
|||
|
||||
/* private inner helper used by sync and async */
|
||||
|
||||
void priv_getdns_call_user_callback(getdns_dns_req *, struct getdns_dict *);
|
||||
void priv_getdns_call_user_callback(getdns_dns_req *, getdns_dict *);
|
||||
void priv_getdns_check_dns_req_complete(getdns_dns_req *dns_req);
|
||||
|
||||
getdns_return_t
|
||||
priv_getdns_general_loop(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions,
|
||||
void *userarg, getdns_transaction_t *transaction_id,
|
||||
void *userarg, getdns_dns_req **dnsreq,
|
||||
getdns_callback_t callbackfn, internal_cb_t internal_cb);
|
||||
|
||||
getdns_return_t
|
||||
|
|
|
@ -40,6 +40,13 @@
|
|||
#include "gldns/str2wire.h"
|
||||
#include "gldns/gbuffer.h"
|
||||
#include "gldns/pkthdr.h"
|
||||
#include "dict.h"
|
||||
|
||||
getdns_dict dnssec_ok_checking_disabled_spc = {
|
||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||
{ 0 }
|
||||
};
|
||||
getdns_dict *dnssec_ok_checking_disabled = &dnssec_ok_checking_disabled_spc;
|
||||
|
||||
static int
|
||||
is_extension_set(getdns_dict *extensions, const char *extension)
|
||||
|
@ -49,6 +56,8 @@ is_extension_set(getdns_dict *extensions, const char *extension)
|
|||
|
||||
if (! extensions)
|
||||
return 0;
|
||||
else if (extensions == dnssec_ok_checking_disabled)
|
||||
return 0;
|
||||
|
||||
r = getdns_dict_get_int(extensions, extension, &value);
|
||||
return r == GETDNS_RETURN_GOOD && value == GETDNS_EXTENSION_TRUE;
|
||||
|
@ -209,14 +218,12 @@ dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
|||
= is_extension_set(extensions, "dnssec_return_only_secure");
|
||||
int dnssec_return_validation_chain
|
||||
= is_extension_set(extensions, "dnssec_return_validation_chain");
|
||||
int dnssec_ok_checking_disabled
|
||||
= is_extension_set(extensions, "dnssec_ok_checking_disabled");
|
||||
int edns_cookies
|
||||
= is_extension_set(extensions, "edns_cookies");
|
||||
|
||||
int dnssec_extension_set = dnssec_return_status
|
||||
|| dnssec_return_only_secure || dnssec_return_validation_chain
|
||||
|| dnssec_ok_checking_disabled;;
|
||||
|| (extensions == dnssec_ok_checking_disabled);
|
||||
|
||||
uint32_t edns_do_bit;
|
||||
int edns_maximum_udp_payload_size;
|
||||
|
@ -251,6 +258,9 @@ dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
|||
size_t max_query_sz, max_response_sz, netreq_sz, dnsreq_base_sz;
|
||||
uint8_t *region;
|
||||
|
||||
if (extensions == dnssec_ok_checking_disabled)
|
||||
extensions = NULL;
|
||||
|
||||
have_add_opt_parameters = getdns_dict_get_dict(extensions,
|
||||
"add_opt_parameters", &add_opt_parameters) == GETDNS_RETURN_GOOD;
|
||||
|
||||
|
|
|
@ -325,6 +325,8 @@ typedef struct getdns_dns_req {
|
|||
|
||||
/* utility methods */
|
||||
|
||||
extern getdns_dict *dnssec_ok_checking_disabled;
|
||||
|
||||
/* dns request utils */
|
||||
getdns_dns_req *dns_req_new(getdns_context *context, getdns_eventloop *loop,
|
||||
const char *name, uint16_t request_type, getdns_dict *extensions);
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
static getdns_extension_format extformats[] = {
|
||||
{"add_opt_parameters", t_dict},
|
||||
{"add_warning_for_bad_dns", t_int},
|
||||
{"dnssec_ok_checking_disabled", t_int},
|
||||
{"dnssec_return_only_secure", t_int},
|
||||
{"dnssec_return_status", t_int},
|
||||
{"dnssec_return_validation_chain", t_int},
|
||||
|
|
Loading…
Reference in New Issue