mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'develop' into merge-develops
This commit is contained in:
commit
5cc67ff554
|
@ -95,9 +95,16 @@ AC_PROG_CPP
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
CFLAGS="$CFLAGS"
|
CFLAGS="$CFLAGS"
|
||||||
|
WPEDANTICFLAG=""
|
||||||
|
WNOERRORFLAG=""
|
||||||
AC_PROG_CC_C99
|
AC_PROG_CC_C99
|
||||||
AX_CHECK_COMPILE_FLAG([-xc99],[CFLAGS="$CFLAGS -xc99"],[],[])
|
AX_CHECK_COMPILE_FLAG([-xc99],[CFLAGS="$CFLAGS -xc99"],[],[])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wall],[CFLAGS="$CFLAGS -Wall"],[],[])
|
AX_CHECK_COMPILE_FLAG([-Wall],[CFLAGS="$CFLAGS -Wall"],[],[])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wextra],[CFLAGS="$CFLAGS -Wextra"],[],[])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wpedantic],[WPEDANTICFLAG="-Wpedantic"],[],[])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Wno-error=unused-parameter],[WNOERRORFLAG="-Wno-error=unused-parameter"],[],[])
|
||||||
|
AC_SUBST(WPEDANTICFLAG)
|
||||||
|
AC_SUBST(WNOERRORFLAG)
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux* ) CFLAGS="$CFLAGS -D_BSD_SOURCE -D_DEFAULT_SOURCE"
|
linux* ) CFLAGS="$CFLAGS -D_BSD_SOURCE -D_DEFAULT_SOURCE"
|
||||||
|
|
|
@ -48,7 +48,9 @@ srcdir = @srcdir@
|
||||||
LIBTOOL = ../libtool
|
LIBTOOL = ../libtool
|
||||||
|
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
CFLAGS=-I$(srcdir) -I. @CFLAGS@ @CPPFLAGS@
|
CFLAGS=-I$(srcdir) -I. @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS)
|
||||||
|
WPEDANTICFLAG=@WPEDANTICFLAG@
|
||||||
|
WNOERRORFLAG=@WNOERRORFLAG@
|
||||||
LDFLAGS=@LDFLAGS@ @LIBS@
|
LDFLAGS=@LDFLAGS@ @LIBS@
|
||||||
|
|
||||||
EXTENSION_LIBEVENT_LIB=@EXTENSION_LIBEVENT_LIB@
|
EXTENSION_LIBEVENT_LIB=@EXTENSION_LIBEVENT_LIB@
|
||||||
|
@ -83,35 +85,35 @@ NON_C99_OBJS=context.lo libuv.lo
|
||||||
.SUFFIXES: .c .o .a .lo .h
|
.SUFFIXES: .c .o .a .lo .h
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||||
|
|
||||||
.c.lo:
|
.c.lo:
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: libgetdns.la $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBUV_LIB) $(EXTENSION_LIBEV_LIB)
|
all: libgetdns.la $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBUV_LIB) $(EXTENSION_LIBEV_LIB)
|
||||||
|
|
||||||
$(GETDNS_OBJ):
|
$(GETDNS_OBJ):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
$(GLDNS_OBJ):
|
$(GLDNS_OBJ):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/gldns/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/gldns/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
$(COMPAT_OBJ):
|
$(COMPAT_OBJ):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/compat/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/compat/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
$(UTIL_OBJ):
|
$(UTIL_OBJ):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/util/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WNOERRORFLAG) -c $(srcdir)/util/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
$(EXTENSION_OBJ):
|
$(EXTENSION_OBJ):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/extension/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/extension/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
context.lo:
|
context.lo:
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(C99COMPATFLAGS) -c $(srcdir)/context.c -o context.lo
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/context.c -o context.lo
|
||||||
|
|
||||||
libuv.lo:
|
libuv.lo:
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(C99COMPATFLAGS) -c $(srcdir)/extension/libuv.c -o libuv.lo
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) $(C99COMPATFLAGS) -c $(srcdir)/extension/libuv.c -o libuv.lo
|
||||||
|
|
||||||
install: libgetdns.la
|
install: libgetdns.la
|
||||||
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
|
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
|
||||||
|
@ -134,18 +136,18 @@ uninstall:
|
||||||
if test $(have_libev) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEV_LIB) ; fi
|
if test $(have_libev) = 1; then $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(EXTENSION_LIBEV_LIB) ; fi
|
||||||
|
|
||||||
libgetdns_ext_event.la: libgetdns.la libevent.lo
|
libgetdns_ext_event.la: libgetdns.la libevent.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ libevent.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libevent.symbols
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libevent.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libevent.symbols
|
||||||
|
|
||||||
libgetdns_ext_uv.la: libgetdns.la libuv.lo
|
libgetdns_ext_uv.la: libgetdns.la libuv.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ libuv.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libuv.symbols
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libuv.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libuv.symbols
|
||||||
|
|
||||||
|
|
||||||
libgetdns_ext_ev.la: libgetdns.la libev.lo
|
libgetdns_ext_ev.la: libgetdns.la libev.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ libev.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libev.symbols
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ libev.lo libgetdns.la $(LDFLAGS) $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/extension/libev.symbols
|
||||||
|
|
||||||
|
|
||||||
libgetdns.la: $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ)
|
libgetdns.la: $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ)
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(GETDNS_OBJ) version.lo context.lo default_eventloop.lo $(GLDNS_OBJ) $(COMPAT_OBJ) $(UTIL_OBJ) $(LDFLAGS) -rpath $(libdir) -version-info $(libversion) -no-undefined -export-symbols $(srcdir)/libgetdns.symbols
|
||||||
|
|
||||||
|
|
||||||
test: all
|
test: all
|
||||||
|
|
|
@ -723,8 +723,11 @@ _getdns_upstream_shutdown(getdns_upstream *upstream)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tls_is_in_transports_list(getdns_context *context) {
|
tls_is_in_transports_list(getdns_context *context)
|
||||||
for (size_t i=0; i< context->dns_transport_count;i++) {
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i< context->dns_transport_count;i++) {
|
||||||
if (context->dns_transports[i] == GETDNS_TRANSPORT_TLS)
|
if (context->dns_transports[i] == GETDNS_TRANSPORT_TLS)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1894,11 +1897,13 @@ getdns_context_set_tls_authentication(getdns_context *context,
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
} /* getdns_context_set_tls_authentication_list */
|
} /* getdns_context_set_tls_authentication_list */
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUNBOUND
|
||||||
static void
|
static void
|
||||||
set_ub_limit_outstanding_queries(struct getdns_context* context, uint16_t value) {
|
set_ub_limit_outstanding_queries(getdns_context* context, uint16_t value) {
|
||||||
/* num-queries-per-thread */
|
/* num-queries-per-thread */
|
||||||
set_ub_number_opt(context, "num-queries-per-thread:", value);
|
set_ub_number_opt(context, "num-queries-per-thread:", value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* getdns_context_set_limit_outstanding_queries
|
* getdns_context_set_limit_outstanding_queries
|
||||||
*
|
*
|
||||||
|
@ -1908,7 +1913,9 @@ getdns_context_set_limit_outstanding_queries(struct getdns_context *context,
|
||||||
uint16_t limit)
|
uint16_t limit)
|
||||||
{
|
{
|
||||||
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
||||||
|
#ifdef HAVE_LIBUNBOUND
|
||||||
set_ub_limit_outstanding_queries(context, limit);
|
set_ub_limit_outstanding_queries(context, limit);
|
||||||
|
#endif
|
||||||
if (limit != context->limit_outstanding_queries) {
|
if (limit != context->limit_outstanding_queries) {
|
||||||
context->limit_outstanding_queries = limit;
|
context->limit_outstanding_queries = limit;
|
||||||
dispatch_updated(context,
|
dispatch_updated(context,
|
||||||
|
@ -2280,11 +2287,13 @@ getdns_context_set_dnssec_trust_anchors(
|
||||||
return GETDNS_RETURN_GOOD;
|
return GETDNS_RETURN_GOOD;
|
||||||
} /* getdns_context_set_dnssec_trust_anchors */
|
} /* getdns_context_set_dnssec_trust_anchors */
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUNBOUND
|
||||||
static void
|
static void
|
||||||
set_ub_dnssec_allowed_skew(struct getdns_context* context, uint32_t value) {
|
set_ub_dnssec_allowed_skew(struct getdns_context* context, uint32_t value) {
|
||||||
set_ub_number_opt(context, "val-sig-skew-min:", value);
|
set_ub_number_opt(context, "val-sig-skew-min:", value);
|
||||||
set_ub_number_opt(context, "val-sig-skew-max:", value);
|
set_ub_number_opt(context, "val-sig-skew-max:", value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* getdns_context_set_dnssec_allowed_skew
|
* getdns_context_set_dnssec_allowed_skew
|
||||||
*
|
*
|
||||||
|
@ -2294,7 +2303,9 @@ getdns_context_set_dnssec_allowed_skew(struct getdns_context *context,
|
||||||
uint32_t value)
|
uint32_t value)
|
||||||
{
|
{
|
||||||
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
||||||
|
#ifdef HAVE_LIBUNBOUND
|
||||||
set_ub_dnssec_allowed_skew(context, value);
|
set_ub_dnssec_allowed_skew(context, value);
|
||||||
|
#endif
|
||||||
if (value != context->dnssec_allowed_skew) {
|
if (value != context->dnssec_allowed_skew) {
|
||||||
context->dnssec_allowed_skew = value;
|
context->dnssec_allowed_skew = value;
|
||||||
dispatch_updated(context, GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW);
|
dispatch_updated(context, GETDNS_CONTEXT_CODE_DNSSEC_ALLOWED_SKEW);
|
||||||
|
@ -2562,6 +2573,7 @@ error:
|
||||||
} /* getdns_context_set_upstream_recursive_servers */
|
} /* getdns_context_set_upstream_recursive_servers */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUNBOUND
|
||||||
static void
|
static void
|
||||||
set_ub_edns_maximum_udp_payload_size(struct getdns_context* context,
|
set_ub_edns_maximum_udp_payload_size(struct getdns_context* context,
|
||||||
int value) {
|
int value) {
|
||||||
|
@ -2569,6 +2581,7 @@ set_ub_edns_maximum_udp_payload_size(struct getdns_context* context,
|
||||||
if (value >= 512 && value <= 65535)
|
if (value >= 512 && value <= 65535)
|
||||||
set_ub_number_opt(context, "edns-buffer-size:", (uint16_t)value);
|
set_ub_number_opt(context, "edns-buffer-size:", (uint16_t)value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getdns_context_set_edns_maximum_udp_payload_size
|
* getdns_context_set_edns_maximum_udp_payload_size
|
||||||
|
@ -2585,7 +2598,9 @@ getdns_context_set_edns_maximum_udp_payload_size(struct getdns_context *context,
|
||||||
if (value < 512)
|
if (value < 512)
|
||||||
value = 512;
|
value = 512;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUNBOUND
|
||||||
set_ub_edns_maximum_udp_payload_size(context, value);
|
set_ub_edns_maximum_udp_payload_size(context, value);
|
||||||
|
#endif
|
||||||
if (value != context->edns_maximum_udp_payload_size) {
|
if (value != context->edns_maximum_udp_payload_size) {
|
||||||
context->edns_maximum_udp_payload_size = value;
|
context->edns_maximum_udp_payload_size = value;
|
||||||
dispatch_updated(context,
|
dispatch_updated(context,
|
||||||
|
@ -2986,7 +3001,7 @@ getdns_return_t
|
||||||
_getdns_context_prepare_for_resolution(struct getdns_context *context,
|
_getdns_context_prepare_for_resolution(struct getdns_context *context,
|
||||||
int usenamespaces)
|
int usenamespaces)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
getdns_return_t r;
|
getdns_return_t r;
|
||||||
|
|
||||||
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
|
||||||
|
@ -3472,7 +3487,7 @@ _getdns_context_local_namespace_resolve(
|
||||||
getdns_context *context = dnsreq->context;
|
getdns_context *context = dnsreq->context;
|
||||||
host_name_addrs *hnas;
|
host_name_addrs *hnas;
|
||||||
uint8_t lookup[256];
|
uint8_t lookup[256];
|
||||||
getdns_list empty_list = { 0 };
|
getdns_list empty_list = { 0, 0, NULL, { NULL, {{ NULL, NULL, NULL }}}};
|
||||||
getdns_bindata bindata;
|
getdns_bindata bindata;
|
||||||
getdns_list *jaa;
|
getdns_list *jaa;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
|
@ -192,7 +192,7 @@ struct getdns_context {
|
||||||
/* Context values */
|
/* Context values */
|
||||||
getdns_resolution_t resolution_type;
|
getdns_resolution_t resolution_type;
|
||||||
getdns_namespace_t *namespaces;
|
getdns_namespace_t *namespaces;
|
||||||
int namespace_count;
|
size_t namespace_count;
|
||||||
uint64_t timeout;
|
uint64_t timeout;
|
||||||
uint64_t idle_timeout;
|
uint64_t idle_timeout;
|
||||||
getdns_redirects_t follow_redirects;
|
getdns_redirects_t follow_redirects;
|
||||||
|
|
|
@ -53,9 +53,6 @@
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
/* stuff to make it compile pedantically */
|
|
||||||
#define UNUSED_PARAM(x) ((void)(x))
|
|
||||||
|
|
||||||
/* strdup is marked deprecated by the Windows compiler */
|
/* strdup is marked deprecated by the Windows compiler */
|
||||||
#ifndef STRDUP
|
#ifndef STRDUP
|
||||||
#ifdef GETDNS_ON_WINDOWS
|
#ifdef GETDNS_ON_WINDOWS
|
||||||
|
@ -64,6 +61,7 @@
|
||||||
#define STRDUP(x) strdup(x)
|
#define STRDUP(x) strdup(x)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
getdns_return_t
|
getdns_return_t
|
||||||
getdns_convert_dns_name_to_fqdn(
|
getdns_convert_dns_name_to_fqdn(
|
||||||
const getdns_bindata *dns_name_wire_fmt, char **fqdn_as_string)
|
const getdns_bindata *dns_name_wire_fmt, char **fqdn_as_string)
|
||||||
|
|
19
src/dict.c
19
src/dict.c
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
|
|
||||||
static char *_json_ptr_first(const struct mem_funcs *mf,
|
static char *_json_ptr_first(const struct mem_funcs *mf,
|
||||||
const char *jptr, char *first, size_t first_sz)
|
const char *jptr, char *first, ssize_t first_sz)
|
||||||
{
|
{
|
||||||
const char *next_ref, *k;
|
const char *next_ref, *k;
|
||||||
char *j;
|
char *j;
|
||||||
|
@ -735,14 +735,13 @@ _getdns_bindata_is_dname(getdns_bindata *bindata)
|
||||||
/**
|
/**
|
||||||
* private function to pretty print bindata to a gldns_buffer
|
* private function to pretty print bindata to a gldns_buffer
|
||||||
* @param buf buffer to write to
|
* @param buf buffer to write to
|
||||||
* @param indent number of spaces to append after newline
|
|
||||||
* @param bindata the bindata to print
|
* @param bindata the bindata to print
|
||||||
* @return on success the number of written characters
|
* @return on success the number of written characters
|
||||||
* if an output error is encountered, a negative value
|
* if an output error is encountered, a negative value
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
getdns_pp_bindata(gldns_buffer *buf, size_t indent,
|
getdns_pp_bindata(gldns_buffer *buf, getdns_bindata *bindata,
|
||||||
getdns_bindata *bindata, int rdata_raw, int json)
|
int rdata_raw, int json)
|
||||||
{
|
{
|
||||||
size_t i, p = gldns_buffer_position(buf);
|
size_t i, p = gldns_buffer_position(buf);
|
||||||
uint8_t *dptr;
|
uint8_t *dptr;
|
||||||
|
@ -887,7 +886,7 @@ getdns_pp_list(gldns_buffer *buf, size_t indent, const getdns_list *list,
|
||||||
GETDNS_RETURN_GOOD)
|
GETDNS_RETURN_GOOD)
|
||||||
return -1;
|
return -1;
|
||||||
if (getdns_pp_bindata(
|
if (getdns_pp_bindata(
|
||||||
buf, indent, bindata_item, 0, json) < 0)
|
buf, bindata_item, 0, json) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1096,7 +1095,7 @@ getdns_pp_dict(gldns_buffer * buf, size_t indent,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
} else if (getdns_pp_bindata(
|
} else if (getdns_pp_bindata(
|
||||||
buf, indent, item->i.data.bindata,
|
buf, item->i.data.bindata,
|
||||||
(strcmp(item->node.key, "rdata_raw") == 0),
|
(strcmp(item->node.key, "rdata_raw") == 0),
|
||||||
json) < 0)
|
json) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1189,7 +1188,7 @@ getdns_pretty_snprint_dict(char *str, size_t size, const getdns_dict *dict)
|
||||||
|
|
||||||
gldns_buffer_init_frm_data(&buf, str, size);
|
gldns_buffer_init_frm_data(&buf, str, size);
|
||||||
return getdns_pp_dict(&buf, 0, dict, 0) < 0
|
return getdns_pp_dict(&buf, 0, dict, 0) < 0
|
||||||
? -1 : gldns_buffer_position(&buf);
|
? -1 : (int)gldns_buffer_position(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -1223,7 +1222,7 @@ getdns_pretty_snprint_list(char *str, size_t size, const getdns_list *list)
|
||||||
|
|
||||||
gldns_buffer_init_frm_data(&buf, str, size);
|
gldns_buffer_init_frm_data(&buf, str, size);
|
||||||
return getdns_pp_list(&buf, 0, list, 0, 0) < 0
|
return getdns_pp_list(&buf, 0, list, 0, 0) < 0
|
||||||
? -1 : gldns_buffer_position(&buf);
|
? -1 : (int)gldns_buffer_position(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -1258,7 +1257,7 @@ getdns_snprint_json_dict(
|
||||||
|
|
||||||
gldns_buffer_init_frm_data(&buf, str, size);
|
gldns_buffer_init_frm_data(&buf, str, size);
|
||||||
return getdns_pp_dict(&buf, 0, dict, pretty ? 1 : 2) < 0
|
return getdns_pp_dict(&buf, 0, dict, pretty ? 1 : 2) < 0
|
||||||
? -1 : gldns_buffer_position(&buf);
|
? -1 : (int)gldns_buffer_position(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -1293,7 +1292,7 @@ getdns_snprint_json_list(
|
||||||
|
|
||||||
gldns_buffer_init_frm_data(&buf, str, size);
|
gldns_buffer_init_frm_data(&buf, str, size);
|
||||||
return getdns_pp_list(&buf, 0, list, 0, pretty ? 1 : 2) < 0
|
return getdns_pp_list(&buf, 0, list, 0, pretty ? 1 : 2) < 0
|
||||||
? -1 : gldns_buffer_position(&buf);
|
? -1 : (int)gldns_buffer_position(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dict.c */
|
/* dict.c */
|
||||||
|
|
|
@ -256,7 +256,7 @@ static uint8_t *_dname_label_copy(uint8_t *dst, const uint8_t *src, size_t dst_l
|
||||||
{
|
{
|
||||||
uint8_t *r = dst, i;
|
uint8_t *r = dst, i;
|
||||||
|
|
||||||
if (!src || (unsigned)(*src + 1) > dst_len)
|
if (!src || (size_t)*src + 1 > dst_len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = (*dst++ = *src++); i ; i--)
|
for (i = (*dst++ = *src++); i ; i--)
|
||||||
|
@ -528,7 +528,7 @@ static chain_head *add_rrset2val_chain(struct mem_funcs *mf,
|
||||||
chain_head *head;
|
chain_head *head;
|
||||||
const uint8_t *labels[128], **last_label, **label;
|
const uint8_t *labels[128], **last_label, **label;
|
||||||
|
|
||||||
size_t max_labels; /* max labels in common */
|
ssize_t max_labels; /* max labels in common */
|
||||||
chain_head *max_head;
|
chain_head *max_head;
|
||||||
chain_node *max_node;
|
chain_node *max_node;
|
||||||
|
|
||||||
|
@ -857,6 +857,7 @@ static getdns_dict *CD_extension(getdns_dns_req *dnsreq)
|
||||||
? dnssec_ok_checking_disabled_roadblock_avoidance
|
? dnssec_ok_checking_disabled_roadblock_avoidance
|
||||||
: dnssec_ok_checking_disabled_avoid_roadblocks;
|
: dnssec_ok_checking_disabled_avoid_roadblocks;
|
||||||
#else
|
#else
|
||||||
|
(void)dnsreq;
|
||||||
return dnssec_ok_checking_disabled;
|
return dnssec_ok_checking_disabled;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1871,7 +1872,7 @@ static int ds_authenticates_keys(struct mem_funcs *mf,
|
||||||
max_supported_digest = ds->rr_i.rr_type[13];
|
max_supported_digest = ds->rr_i.rr_type[13];
|
||||||
max_supported_result = 0;
|
max_supported_result = 0;
|
||||||
|
|
||||||
if (digest_len != ds->rr_i.nxt - ds->rr_i.rr_type-14
|
if ((int)digest_len != ds->rr_i.nxt - ds->rr_i.rr_type-14
|
||||||
|| memcmp(digest, ds->rr_i.rr_type+14, digest_len) != 0) {
|
|| memcmp(digest, ds->rr_i.rr_type+14, digest_len) != 0) {
|
||||||
if (digest != digest_spc)
|
if (digest != digest_spc)
|
||||||
GETDNS_FREE(*mf, digest);
|
GETDNS_FREE(*mf, digest);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "extension/default_eventloop.h"
|
#include "extension/default_eventloop.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "types-internal.h"
|
||||||
|
|
||||||
static uint64_t get_now_plus(uint64_t amount)
|
static uint64_t get_now_plus(uint64_t amount)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +42,8 @@ static uint64_t get_now_plus(uint64_t amount)
|
||||||
}
|
}
|
||||||
now = tv.tv_sec * 1000000 + tv.tv_usec;
|
now = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||||
|
|
||||||
return (now + amount * 1000) >= now ? now + amount * 1000 : -1;
|
return (now + amount * 1000) >= now
|
||||||
|
? now + amount * 1000 : TIMEOUT_FOREVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getdns_return_t
|
static getdns_return_t
|
||||||
|
@ -151,11 +153,15 @@ default_eventloop_clear(getdns_eventloop *loop, getdns_eventloop_event *event)
|
||||||
static void
|
static void
|
||||||
default_eventloop_cleanup(getdns_eventloop *loop)
|
default_eventloop_cleanup(getdns_eventloop *loop)
|
||||||
{
|
{
|
||||||
|
(void)loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
default_read_cb(int fd, getdns_eventloop_event *event)
|
default_read_cb(int fd, getdns_eventloop_event *event)
|
||||||
{
|
{
|
||||||
|
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
|
||||||
|
(void)fd;
|
||||||
|
#endif
|
||||||
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNCTION__, fd, event);
|
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNCTION__, fd, event);
|
||||||
event->read_cb(event->userarg);
|
event->read_cb(event->userarg);
|
||||||
}
|
}
|
||||||
|
@ -163,6 +169,9 @@ default_read_cb(int fd, getdns_eventloop_event *event)
|
||||||
static void
|
static void
|
||||||
default_write_cb(int fd, getdns_eventloop_event *event)
|
default_write_cb(int fd, getdns_eventloop_event *event)
|
||||||
{
|
{
|
||||||
|
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
|
||||||
|
(void)fd;
|
||||||
|
#endif
|
||||||
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNCTION__, fd, event);
|
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNCTION__, fd, event);
|
||||||
event->write_cb(event->userarg);
|
event->write_cb(event->userarg);
|
||||||
}
|
}
|
||||||
|
@ -170,6 +179,9 @@ default_write_cb(int fd, getdns_eventloop_event *event)
|
||||||
static void
|
static void
|
||||||
default_timeout_cb(int fd, getdns_eventloop_event *event)
|
default_timeout_cb(int fd, getdns_eventloop_event *event)
|
||||||
{
|
{
|
||||||
|
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
|
||||||
|
(void)fd;
|
||||||
|
#endif
|
||||||
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNCTION__, fd, event);
|
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNCTION__, fd, event);
|
||||||
event->timeout_cb(event->userarg);
|
event->timeout_cb(event->userarg);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +193,7 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking)
|
||||||
|
|
||||||
fd_set readfds, writefds;
|
fd_set readfds, writefds;
|
||||||
int fd, max_fd = -1;
|
int fd, max_fd = -1;
|
||||||
uint64_t now, timeout = (uint64_t)-1;
|
uint64_t now, timeout = TIMEOUT_FOREVER;
|
||||||
size_t i;
|
size_t i;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
|
@ -212,7 +224,7 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking)
|
||||||
if (default_loop->fd_timeout_times[fd] < timeout)
|
if (default_loop->fd_timeout_times[fd] < timeout)
|
||||||
timeout = default_loop->fd_timeout_times[fd];
|
timeout = default_loop->fd_timeout_times[fd];
|
||||||
}
|
}
|
||||||
if (max_fd == -1 && timeout == (uint64_t)-1)
|
if (max_fd == -1 && timeout == TIMEOUT_FOREVER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (! blocking || now > timeout) {
|
if (! blocking || now > timeout) {
|
||||||
|
@ -223,7 +235,7 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking)
|
||||||
tv.tv_usec = (long)((timeout - now) % 1000000);
|
tv.tv_usec = (long)((timeout - now) % 1000000);
|
||||||
}
|
}
|
||||||
if (select(max_fd + 1, &readfds, &writefds, NULL,
|
if (select(max_fd + 1, &readfds, &writefds, NULL,
|
||||||
(timeout == ((uint64_t)-1) ? NULL : &tv)) < 0) {
|
(timeout == TIMEOUT_FOREVER ? NULL : &tv)) < 0) {
|
||||||
perror("select() failed");
|
perror("select() failed");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ static void
|
||||||
getdns_libev_read_cb(struct ev_loop *l, struct ev_io *io, int revents)
|
getdns_libev_read_cb(struct ev_loop *l, struct ev_io *io, int revents)
|
||||||
{
|
{
|
||||||
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data;
|
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data;
|
||||||
|
(void)l; (void)revents;
|
||||||
assert(el_ev->read_cb);
|
assert(el_ev->read_cb);
|
||||||
el_ev->read_cb(el_ev->userarg);
|
el_ev->read_cb(el_ev->userarg);
|
||||||
}
|
}
|
||||||
|
@ -105,14 +106,16 @@ static void
|
||||||
getdns_libev_write_cb(struct ev_loop *l, struct ev_io *io, int revents)
|
getdns_libev_write_cb(struct ev_loop *l, struct ev_io *io, int revents)
|
||||||
{
|
{
|
||||||
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data;
|
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data;
|
||||||
|
(void)l; (void)revents;
|
||||||
assert(el_ev->write_cb);
|
assert(el_ev->write_cb);
|
||||||
el_ev->write_cb(el_ev->userarg);
|
el_ev->write_cb(el_ev->userarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
getdns_libev_timeout_cb(struct ev_loop *l, struct ev_timer *timer, int revent)
|
getdns_libev_timeout_cb(struct ev_loop *l, struct ev_timer *timer, int revents)
|
||||||
{
|
{
|
||||||
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data;
|
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data;
|
||||||
|
(void)l; (void)revents;
|
||||||
assert(el_ev->timeout_cb);
|
assert(el_ev->timeout_cb);
|
||||||
el_ev->timeout_cb(el_ev->userarg);
|
el_ev->timeout_cb(el_ev->userarg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ static getdns_return_t
|
||||||
getdns_libevent_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
|
getdns_libevent_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
|
||||||
{
|
{
|
||||||
struct event *my_ev = (struct event *)el_ev->ev;
|
struct event *my_ev = (struct event *)el_ev->ev;
|
||||||
|
(void)loop;
|
||||||
|
|
||||||
assert(my_ev);
|
assert(my_ev);
|
||||||
|
|
||||||
|
@ -110,6 +111,7 @@ static void
|
||||||
getdns_libevent_callback(evutil_socket_t fd, short bits, void *arg)
|
getdns_libevent_callback(evutil_socket_t fd, short bits, void *arg)
|
||||||
{
|
{
|
||||||
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)arg;
|
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)arg;
|
||||||
|
(void)fd;
|
||||||
|
|
||||||
if (bits & EV_READ) {
|
if (bits & EV_READ) {
|
||||||
assert(el_ev->read_cb);
|
assert(el_ev->read_cb);
|
||||||
|
|
|
@ -104,6 +104,7 @@ getdns_libuv_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
|
||||||
poll_timer *my_ev = (poll_timer *)el_ev->ev;
|
poll_timer *my_ev = (poll_timer *)el_ev->ev;
|
||||||
uv_poll_t *my_poll;
|
uv_poll_t *my_poll;
|
||||||
uv_timer_t *my_timer;
|
uv_timer_t *my_timer;
|
||||||
|
(void)loop;
|
||||||
|
|
||||||
assert(my_ev);
|
assert(my_ev);
|
||||||
|
|
||||||
|
@ -141,6 +142,7 @@ static void
|
||||||
getdns_libuv_read_cb(uv_poll_t *poll, int status, int events)
|
getdns_libuv_read_cb(uv_poll_t *poll, int status, int events)
|
||||||
{
|
{
|
||||||
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)poll->data;
|
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)poll->data;
|
||||||
|
(void)status; (void)events;
|
||||||
assert(el_ev->read_cb);
|
assert(el_ev->read_cb);
|
||||||
DEBUG_UV("enter libuv_read_cb(el_ev = %p, el_ev->ev = %p)\n"
|
DEBUG_UV("enter libuv_read_cb(el_ev = %p, el_ev->ev = %p)\n"
|
||||||
, el_ev, el_ev->ev);
|
, el_ev, el_ev->ev);
|
||||||
|
@ -153,6 +155,7 @@ static void
|
||||||
getdns_libuv_write_cb(uv_poll_t *poll, int status, int events)
|
getdns_libuv_write_cb(uv_poll_t *poll, int status, int events)
|
||||||
{
|
{
|
||||||
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)poll->data;
|
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)poll->data;
|
||||||
|
(void)status; (void)events;
|
||||||
assert(el_ev->write_cb);
|
assert(el_ev->write_cb);
|
||||||
DEBUG_UV("enter libuv_write_cb(el_ev = %p, el_ev->ev = %p)\n"
|
DEBUG_UV("enter libuv_write_cb(el_ev = %p, el_ev->ev = %p)\n"
|
||||||
, el_ev, el_ev->ev);
|
, el_ev, el_ev->ev);
|
||||||
|
|
|
@ -328,7 +328,7 @@ rrinternal_write_typeclassttl(gldns_buffer* strbuf, uint8_t* rr, size_t len,
|
||||||
|
|
||||||
/** find delimiters for type */
|
/** find delimiters for type */
|
||||||
static const char*
|
static const char*
|
||||||
rrinternal_get_delims(gldns_rdf_type rdftype, uint16_t r_cnt, uint16_t r_max)
|
rrinternal_get_delims(gldns_rdf_type rdftype, size_t r_cnt, size_t r_max)
|
||||||
{
|
{
|
||||||
switch(rdftype) {
|
switch(rdftype) {
|
||||||
case GLDNS_RDF_TYPE_B64 :
|
case GLDNS_RDF_TYPE_B64 :
|
||||||
|
@ -463,7 +463,7 @@ rrinternal_parse_unknown(gldns_buffer* strbuf, char* token, size_t token_len,
|
||||||
static int
|
static int
|
||||||
rrinternal_parse_rdf(gldns_buffer* strbuf, char* token, size_t token_len,
|
rrinternal_parse_rdf(gldns_buffer* strbuf, char* token, size_t token_len,
|
||||||
uint8_t* rr, size_t rr_len, size_t* rr_cur_len, gldns_rdf_type rdftype,
|
uint8_t* rr, size_t rr_len, size_t* rr_cur_len, gldns_rdf_type rdftype,
|
||||||
uint16_t rr_type, uint16_t r_cnt, uint16_t r_max, size_t dname_len,
|
uint16_t rr_type, size_t r_cnt, size_t r_max, size_t dname_len,
|
||||||
uint8_t* origin, size_t origin_len)
|
uint8_t* origin, size_t origin_len)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -613,7 +613,7 @@ rrinternal_parse_rdata(gldns_buffer* strbuf, char* token, size_t token_len,
|
||||||
uint8_t* origin, size_t origin_len)
|
uint8_t* origin, size_t origin_len)
|
||||||
{
|
{
|
||||||
const gldns_rr_descriptor *desc = gldns_rr_descript((uint16_t)rr_type);
|
const gldns_rr_descriptor *desc = gldns_rr_descript((uint16_t)rr_type);
|
||||||
uint16_t r_cnt, r_min, r_max;
|
size_t r_cnt, r_min, r_max;
|
||||||
size_t rr_cur_len = dname_len + 10, pre_data_pos, token_strlen;
|
size_t rr_cur_len = dname_len + 10, pre_data_pos, token_strlen;
|
||||||
int was_unknown_rr_format = 0, parens = 0, status, quoted;
|
int was_unknown_rr_format = 0, parens = 0, status, quoted;
|
||||||
const char* delimiters;
|
const char* delimiters;
|
||||||
|
@ -693,7 +693,7 @@ rrinternal_parse_rdata(gldns_buffer* strbuf, char* token, size_t token_len,
|
||||||
gldns_buffer_position(strbuf));
|
gldns_buffer_position(strbuf));
|
||||||
}
|
}
|
||||||
/* write rdata length */
|
/* write rdata length */
|
||||||
gldns_write_uint16(rr+dname_len+8, rr_cur_len-dname_len-10);
|
gldns_write_uint16(rr+dname_len+8, (uint16_t)(rr_cur_len-dname_len-10));
|
||||||
*rr_len = rr_cur_len;
|
*rr_len = rr_cur_len;
|
||||||
return GLDNS_WIREPARSE_ERR_OK;
|
return GLDNS_WIREPARSE_ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1369,7 +1369,7 @@ int gldns_str2wire_time_buf(const char* str, uint8_t* rd, size_t* len)
|
||||||
if (tm.tm_sec < 0 || tm.tm_sec > 59)
|
if (tm.tm_sec < 0 || tm.tm_sec > 59)
|
||||||
return GLDNS_WIREPARSE_ERR_SYNTAX_TIME;
|
return GLDNS_WIREPARSE_ERR_SYNTAX_TIME;
|
||||||
|
|
||||||
gldns_write_uint32(rd, gldns_mktime_from_utc(&tm));
|
gldns_write_uint32(rd, (uint32_t)gldns_mktime_from_utc(&tm));
|
||||||
} else {
|
} else {
|
||||||
/* handle it as 32 bits timestamp */
|
/* handle it as 32 bits timestamp */
|
||||||
char *end;
|
char *end;
|
||||||
|
@ -1932,7 +1932,7 @@ int gldns_str2wire_tag_buf(const char* str, uint8_t* rd, size_t* len)
|
||||||
if(!isalnum((unsigned char)*ptr))
|
if(!isalnum((unsigned char)*ptr))
|
||||||
return RET_ERR(GLDNS_WIREPARSE_ERR_SYNTAX_TAG, ptr-str);
|
return RET_ERR(GLDNS_WIREPARSE_ERR_SYNTAX_TAG, ptr-str);
|
||||||
}
|
}
|
||||||
rd[0] = slen;
|
rd[0] = (uint8_t)slen;
|
||||||
memmove(rd+1, str, slen);
|
memmove(rd+1, str, slen);
|
||||||
*len = slen+1;
|
*len = slen+1;
|
||||||
return GLDNS_WIREPARSE_ERR_OK;
|
return GLDNS_WIREPARSE_ERR_OK;
|
||||||
|
@ -2000,7 +2000,7 @@ int gldns_str2wire_hip_buf(const char* str, uint8_t* rd, size_t* len)
|
||||||
return RET_ERR_SHIFT(e, s-(char*)str);
|
return RET_ERR_SHIFT(e, s-(char*)str);
|
||||||
if(pklen > 65535)
|
if(pklen > 65535)
|
||||||
return RET_ERR(GLDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+65535);
|
return RET_ERR(GLDNS_WIREPARSE_ERR_LABEL_OVERFLOW, s-(char*)str+65535);
|
||||||
gldns_write_uint16(rd+2, pklen);
|
gldns_write_uint16(rd+2, (uint16_t)pklen);
|
||||||
|
|
||||||
*len = 4 + hitlen + pklen;
|
*len = 4 + hitlen + pklen;
|
||||||
return GLDNS_WIREPARSE_ERR_OK;
|
return GLDNS_WIREPARSE_ERR_OK;
|
||||||
|
|
|
@ -668,7 +668,7 @@ int gldns_wire2str_rdata_scan(uint8_t** d, size_t* dlen, char** s,
|
||||||
uint8_t* origd = *d;
|
uint8_t* origd = *d;
|
||||||
char* origs = *s;
|
char* origs = *s;
|
||||||
size_t origdlen = *dlen, origslen = *slen;
|
size_t origdlen = *dlen, origslen = *slen;
|
||||||
uint16_t r_cnt, r_max;
|
size_t r_cnt, r_max;
|
||||||
gldns_rdf_type rdftype;
|
gldns_rdf_type rdftype;
|
||||||
int w = 0, n;
|
int w = 0, n;
|
||||||
|
|
||||||
|
@ -789,8 +789,9 @@ int gldns_wire2str_dname_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* spool label characters, end with '.' */
|
/* spool label characters, end with '.' */
|
||||||
if(in_buf && *dlen < labellen) labellen = *dlen;
|
if(in_buf && *dlen < (size_t)labellen)
|
||||||
else if(!in_buf && pos+labellen > pkt+pktlen)
|
labellen = (uint8_t)*dlen;
|
||||||
|
else if(!in_buf && pos+(size_t)labellen > pkt+pktlen)
|
||||||
labellen = (uint8_t)(pkt + pktlen - pos);
|
labellen = (uint8_t)(pkt + pktlen - pos);
|
||||||
for(i=0; i<(unsigned)labellen; i++) {
|
for(i=0; i<(unsigned)labellen; i++) {
|
||||||
w += dname_char_print(s, slen, *pos++);
|
w += dname_char_print(s, slen, *pos++);
|
||||||
|
@ -1983,10 +1984,10 @@ int gldns_wire2str_edns_scan(uint8_t** data, size_t* data_len, char** str,
|
||||||
w += gldns_str_print(str, str_len, " ; udp: %u", (unsigned)udpsize);
|
w += gldns_str_print(str, str_len, " ; udp: %u", (unsigned)udpsize);
|
||||||
|
|
||||||
if(rdatalen) {
|
if(rdatalen) {
|
||||||
if(*data_len < rdatalen) {
|
if((size_t)*data_len < rdatalen) {
|
||||||
w += gldns_str_print(str, str_len,
|
w += gldns_str_print(str, str_len,
|
||||||
" ; Error EDNS rdata too short; ");
|
" ; Error EDNS rdata too short; ");
|
||||||
rdatalen = *data_len;
|
rdatalen = (uint16_t)*data_len;
|
||||||
}
|
}
|
||||||
w += print_edns_opts(str, str_len, *data, rdatalen);
|
w += print_edns_opts(str, str_len, *data, rdatalen);
|
||||||
(*data) += rdatalen;
|
(*data) += rdatalen;
|
||||||
|
|
|
@ -312,7 +312,7 @@ getdns_return_t
|
||||||
_getdns_list_copy(const struct getdns_list * srclist,
|
_getdns_list_copy(const struct getdns_list * srclist,
|
||||||
struct getdns_list ** dstlist)
|
struct getdns_list ** dstlist)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
size_t i;
|
||||||
getdns_return_t retval;
|
getdns_return_t retval;
|
||||||
|
|
||||||
if (!dstlist)
|
if (!dstlist)
|
||||||
|
|
|
@ -97,7 +97,7 @@ getdns_dict* getdns_pubkey_pin_create_from_string(
|
||||||
const char* str)
|
const char* str)
|
||||||
{
|
{
|
||||||
BIO *bio = NULL;
|
BIO *bio = NULL;
|
||||||
int i;
|
size_t i;
|
||||||
uint8_t buf[SHA256_DIGEST_LENGTH];
|
uint8_t buf[SHA256_DIGEST_LENGTH];
|
||||||
char inbuf[B64_ENCODED_SHA256_LENGTH + 1];
|
char inbuf[B64_ENCODED_SHA256_LENGTH + 1];
|
||||||
getdns_bindata value = { .size = SHA256_DIGEST_LENGTH, .data = buf };
|
getdns_bindata value = { .size = SHA256_DIGEST_LENGTH, .data = buf };
|
||||||
|
@ -425,7 +425,7 @@ _getdns_verify_pinset_match(const sha256_pin_t *pinset,
|
||||||
#endif
|
#endif
|
||||||
/* digest the cert with sha256 */
|
/* digest the cert with sha256 */
|
||||||
len = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), NULL);
|
len = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), NULL);
|
||||||
if (len > sizeof(raw)) {
|
if (len > (int)sizeof(raw)) {
|
||||||
DEBUG_STUB("%s %-35s: Pubkey %d is larger than "PRIsz" octets\n",
|
DEBUG_STUB("%s %-35s: Pubkey %d is larger than "PRIsz" octets\n",
|
||||||
STUB_DEBUG_SETUP_TLS, __FUNCTION__, i, sizeof(raw));
|
STUB_DEBUG_SETUP_TLS, __FUNCTION__, i, sizeof(raw));
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -65,20 +65,20 @@
|
||||||
|
|
||||||
getdns_dict dnssec_ok_checking_disabled_spc = {
|
getdns_dict dnssec_ok_checking_disabled_spc = {
|
||||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||||
{ 0 }
|
{ NULL, {{ NULL, NULL, NULL }}}
|
||||||
};
|
};
|
||||||
getdns_dict *dnssec_ok_checking_disabled = &dnssec_ok_checking_disabled_spc;
|
getdns_dict *dnssec_ok_checking_disabled = &dnssec_ok_checking_disabled_spc;
|
||||||
|
|
||||||
getdns_dict dnssec_ok_checking_disabled_roadblock_avoidance_spc = {
|
getdns_dict dnssec_ok_checking_disabled_roadblock_avoidance_spc = {
|
||||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||||
{ 0 }
|
{ NULL, {{ NULL, NULL, NULL }}}
|
||||||
};
|
};
|
||||||
getdns_dict *dnssec_ok_checking_disabled_roadblock_avoidance
|
getdns_dict *dnssec_ok_checking_disabled_roadblock_avoidance
|
||||||
= &dnssec_ok_checking_disabled_roadblock_avoidance_spc;
|
= &dnssec_ok_checking_disabled_roadblock_avoidance_spc;
|
||||||
|
|
||||||
getdns_dict dnssec_ok_checking_disabled_avoid_roadblocks_spc = {
|
getdns_dict dnssec_ok_checking_disabled_avoid_roadblocks_spc = {
|
||||||
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
{ RBTREE_NULL, 0, (int (*)(const void *, const void *)) strcmp },
|
||||||
{ 0 }
|
{ NULL, {{ NULL, NULL, NULL }}}
|
||||||
};
|
};
|
||||||
getdns_dict *dnssec_ok_checking_disabled_avoid_roadblocks
|
getdns_dict *dnssec_ok_checking_disabled_avoid_roadblocks
|
||||||
= &dnssec_ok_checking_disabled_avoid_roadblocks_spc;
|
= &dnssec_ok_checking_disabled_avoid_roadblocks_spc;
|
||||||
|
|
307
src/rr-dict.c
307
src/rr-dict.c
|
@ -47,6 +47,7 @@
|
||||||
static const uint8_t *
|
static const uint8_t *
|
||||||
apl_n_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
apl_n_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
||||||
{
|
{
|
||||||
|
(void)pkt;
|
||||||
return rdf < pkt_end ? rdf + 1 : NULL;
|
return rdf < pkt_end ? rdf + 1 : NULL;
|
||||||
}
|
}
|
||||||
static getdns_return_t
|
static getdns_return_t
|
||||||
|
@ -107,6 +108,7 @@ apl_afdpart_rdf_end(
|
||||||
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
||||||
{
|
{
|
||||||
const uint8_t *end = rdf + (rdf[-1] & 0x7F);
|
const uint8_t *end = rdf + (rdf[-1] & 0x7F);
|
||||||
|
(void)(pkt);
|
||||||
return end <= pkt_end ? end : NULL;
|
return end <= pkt_end ? end : NULL;
|
||||||
}
|
}
|
||||||
static getdns_return_t
|
static getdns_return_t
|
||||||
|
@ -335,6 +337,7 @@ static const uint8_t *
|
||||||
hip_pk_algorithm_rdf_end(
|
hip_pk_algorithm_rdf_end(
|
||||||
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
||||||
{
|
{
|
||||||
|
(void)(pkt);
|
||||||
return rdf + 4 > pkt_end ? NULL
|
return rdf + 4 > pkt_end ? NULL
|
||||||
: rdf + 4 + *rdf + gldns_read_uint16(rdf + 2) > pkt_end ? NULL
|
: rdf + 4 + *rdf + gldns_read_uint16(rdf + 2) > pkt_end ? NULL
|
||||||
: rdf + 1;
|
: rdf + 1;
|
||||||
|
@ -397,6 +400,7 @@ static _getdns_rdf_special hip_pk_algorithm = {
|
||||||
static const uint8_t *
|
static const uint8_t *
|
||||||
hip_hit_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
hip_hit_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
||||||
{
|
{
|
||||||
|
(void)(pkt);
|
||||||
return rdf + 3 > pkt_end ? NULL
|
return rdf + 3 > pkt_end ? NULL
|
||||||
: rdf + 3 + rdf[-1] + gldns_read_uint16(rdf + 1) > pkt_end ? NULL
|
: rdf + 3 + rdf[-1] + gldns_read_uint16(rdf + 1) > pkt_end ? NULL
|
||||||
: rdf + 1;
|
: rdf + 1;
|
||||||
|
@ -467,6 +471,7 @@ static const uint8_t *
|
||||||
hip_public_key_rdf_end(
|
hip_public_key_rdf_end(
|
||||||
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
|
||||||
{
|
{
|
||||||
|
(void)(pkt);
|
||||||
return rdf + 2 > pkt_end ? NULL
|
return rdf + 2 > pkt_end ? NULL
|
||||||
: rdf + 2 + rdf[-2] + gldns_read_uint16(rdf) > pkt_end ? NULL
|
: rdf + 2 + rdf[-2] + gldns_read_uint16(rdf) > pkt_end ? NULL
|
||||||
: rdf + 2 + rdf[-2] + gldns_read_uint16(rdf);
|
: rdf + 2 + rdf[-2] + gldns_read_uint16(rdf);
|
||||||
|
@ -537,222 +542,222 @@ static _getdns_rdf_special hip_public_key = {
|
||||||
|
|
||||||
|
|
||||||
static _getdns_rdata_def a_rdata[] = {
|
static _getdns_rdata_def a_rdata[] = {
|
||||||
{ "ipv4_address" , GETDNS_RDF_A }};
|
{ "ipv4_address" , GETDNS_RDF_A , NULL }};
|
||||||
static _getdns_rdata_def ns_rdata[] = {
|
static _getdns_rdata_def ns_rdata[] = {
|
||||||
{ "nsdname" , GETDNS_RDF_N_C }};
|
{ "nsdname" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def md_rdata[] = {
|
static _getdns_rdata_def md_rdata[] = {
|
||||||
{ "madname" , GETDNS_RDF_N_C }};
|
{ "madname" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def cname_rdata[] = {
|
static _getdns_rdata_def cname_rdata[] = {
|
||||||
{ "cname" , GETDNS_RDF_N_C }};
|
{ "cname" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def soa_rdata[] = {
|
static _getdns_rdata_def soa_rdata[] = {
|
||||||
{ "mname" , GETDNS_RDF_N_C },
|
{ "mname" , GETDNS_RDF_N_C , NULL },
|
||||||
{ "rname" , GETDNS_RDF_N_C },
|
{ "rname" , GETDNS_RDF_N_C , NULL },
|
||||||
{ "serial" , GETDNS_RDF_I4 },
|
{ "serial" , GETDNS_RDF_I4 , NULL },
|
||||||
{ "refresh" , GETDNS_RDF_I4 },
|
{ "refresh" , GETDNS_RDF_I4 , NULL },
|
||||||
{ "retry" , GETDNS_RDF_I4 },
|
{ "retry" , GETDNS_RDF_I4 , NULL },
|
||||||
{ "expire" , GETDNS_RDF_I4 },
|
{ "expire" , GETDNS_RDF_I4 , NULL },
|
||||||
{ "minimum" , GETDNS_RDF_I4 }};
|
{ "minimum" , GETDNS_RDF_I4 , NULL }};
|
||||||
static _getdns_rdata_def mg_rdata[] = {
|
static _getdns_rdata_def mg_rdata[] = {
|
||||||
{ "mgmname" , GETDNS_RDF_N_C }};
|
{ "mgmname" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def mr_rdata[] = {
|
static _getdns_rdata_def mr_rdata[] = {
|
||||||
{ "newname" , GETDNS_RDF_N_C }};
|
{ "newname" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def null_rdata[] = {
|
static _getdns_rdata_def null_rdata[] = {
|
||||||
{ "anything" , GETDNS_RDF_X }};
|
{ "anything" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def wks_rdata[] = {
|
static _getdns_rdata_def wks_rdata[] = {
|
||||||
{ "address" , GETDNS_RDF_A },
|
{ "address" , GETDNS_RDF_A , NULL },
|
||||||
{ "protocol" , GETDNS_RDF_I1 },
|
{ "protocol" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "bitmap" , GETDNS_RDF_X }};
|
{ "bitmap" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def ptr_rdata[] = {
|
static _getdns_rdata_def ptr_rdata[] = {
|
||||||
{ "ptrdname" , GETDNS_RDF_N_C }};
|
{ "ptrdname" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def hinfo_rdata[] = {
|
static _getdns_rdata_def hinfo_rdata[] = {
|
||||||
{ "cpu" , GETDNS_RDF_S },
|
{ "cpu" , GETDNS_RDF_S , NULL },
|
||||||
{ "os" , GETDNS_RDF_S }};
|
{ "os" , GETDNS_RDF_S , NULL }};
|
||||||
static _getdns_rdata_def minfo_rdata[] = {
|
static _getdns_rdata_def minfo_rdata[] = {
|
||||||
{ "rmailbx" , GETDNS_RDF_N_C },
|
{ "rmailbx" , GETDNS_RDF_N_C , NULL },
|
||||||
{ "emailbx" , GETDNS_RDF_N_C }};
|
{ "emailbx" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def mx_rdata[] = {
|
static _getdns_rdata_def mx_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "exchange" , GETDNS_RDF_N_C }};
|
{ "exchange" , GETDNS_RDF_N_C , NULL }};
|
||||||
static _getdns_rdata_def txt_rdata[] = {
|
static _getdns_rdata_def txt_rdata[] = {
|
||||||
{ "txt_strings" , GETDNS_RDF_S_M }};
|
{ "txt_strings" , GETDNS_RDF_S_M , NULL }};
|
||||||
static _getdns_rdata_def rp_rdata[] = {
|
static _getdns_rdata_def rp_rdata[] = {
|
||||||
{ "mbox_dname" , GETDNS_RDF_N },
|
{ "mbox_dname" , GETDNS_RDF_N , NULL },
|
||||||
{ "txt_dname" , GETDNS_RDF_N }};
|
{ "txt_dname" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def afsdb_rdata[] = {
|
static _getdns_rdata_def afsdb_rdata[] = {
|
||||||
{ "subtype" , GETDNS_RDF_I2 },
|
{ "subtype" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "hostname" , GETDNS_RDF_N }};
|
{ "hostname" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def x25_rdata[] = {
|
static _getdns_rdata_def x25_rdata[] = {
|
||||||
{ "psdn_address" , GETDNS_RDF_S }};
|
{ "psdn_address" , GETDNS_RDF_S , NULL }};
|
||||||
static _getdns_rdata_def isdn_rdata[] = {
|
static _getdns_rdata_def isdn_rdata[] = {
|
||||||
{ "isdn_address" , GETDNS_RDF_S },
|
{ "isdn_address" , GETDNS_RDF_S , NULL },
|
||||||
{ "sa" , GETDNS_RDF_S }};
|
{ "sa" , GETDNS_RDF_S , NULL }};
|
||||||
static _getdns_rdata_def rt_rdata[] = {
|
static _getdns_rdata_def rt_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "intermediate_host" , GETDNS_RDF_N }};
|
{ "intermediate_host" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def nsap_rdata[] = {
|
static _getdns_rdata_def nsap_rdata[] = {
|
||||||
{ "nsap" , GETDNS_RDF_X }};
|
{ "nsap" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def sig_rdata[] = {
|
static _getdns_rdata_def sig_rdata[] = {
|
||||||
{ "sig_obsolete" , GETDNS_RDF_X }};
|
{ "sig_obsolete" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def key_rdata[] = {
|
static _getdns_rdata_def key_rdata[] = {
|
||||||
{ "key_obsolete" , GETDNS_RDF_X }};
|
{ "key_obsolete" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def px_rdata[] = {
|
static _getdns_rdata_def px_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "map822" , GETDNS_RDF_N },
|
{ "map822" , GETDNS_RDF_N , NULL },
|
||||||
{ "mapx400" , GETDNS_RDF_N }};
|
{ "mapx400" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def gpos_rdata[] = {
|
static _getdns_rdata_def gpos_rdata[] = {
|
||||||
{ "longitude" , GETDNS_RDF_S },
|
{ "longitude" , GETDNS_RDF_S , NULL },
|
||||||
{ "latitude" , GETDNS_RDF_S },
|
{ "latitude" , GETDNS_RDF_S , NULL },
|
||||||
{ "altitude" , GETDNS_RDF_S }};
|
{ "altitude" , GETDNS_RDF_S , NULL }};
|
||||||
static _getdns_rdata_def aaaa_rdata[] = {
|
static _getdns_rdata_def aaaa_rdata[] = {
|
||||||
{ "ipv6_address" , GETDNS_RDF_AAAA }};
|
{ "ipv6_address" , GETDNS_RDF_AAAA , NULL }};
|
||||||
static _getdns_rdata_def loc_rdata[] = {
|
static _getdns_rdata_def loc_rdata[] = {
|
||||||
{ "loc_obsolete" , GETDNS_RDF_X }};
|
{ "loc_obsolete" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def nxt_rdata[] = {
|
static _getdns_rdata_def nxt_rdata[] = {
|
||||||
{ "nxt_obsolete" , GETDNS_RDF_X }};
|
{ "nxt_obsolete" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def srv_rdata[] = {
|
static _getdns_rdata_def srv_rdata[] = {
|
||||||
{ "priority" , GETDNS_RDF_I2 },
|
{ "priority" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "weight" , GETDNS_RDF_I2 },
|
{ "weight" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "port" , GETDNS_RDF_I2 },
|
{ "port" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "target" , GETDNS_RDF_N }};
|
{ "target" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def atma_rdata[] = {
|
static _getdns_rdata_def atma_rdata[] = {
|
||||||
{ "format" , GETDNS_RDF_X }};
|
{ "format" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def naptr_rdata[] = {
|
static _getdns_rdata_def naptr_rdata[] = {
|
||||||
{ "order" , GETDNS_RDF_I2 },
|
{ "order" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "flags" , GETDNS_RDF_S },
|
{ "flags" , GETDNS_RDF_S , NULL },
|
||||||
{ "service" , GETDNS_RDF_S },
|
{ "service" , GETDNS_RDF_S , NULL },
|
||||||
{ "regexp" , GETDNS_RDF_S },
|
{ "regexp" , GETDNS_RDF_S , NULL },
|
||||||
{ "replacement" , GETDNS_RDF_N }};
|
{ "replacement" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def kx_rdata[] = {
|
static _getdns_rdata_def kx_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "exchanger" , GETDNS_RDF_N }};
|
{ "exchanger" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def cert_rdata[] = {
|
static _getdns_rdata_def cert_rdata[] = {
|
||||||
{ "type" , GETDNS_RDF_I2 },
|
{ "type" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "key_tag" , GETDNS_RDF_I2 },
|
{ "key_tag" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "certificate_or_crl" , GETDNS_RDF_B }};
|
{ "certificate_or_crl" , GETDNS_RDF_B , NULL }};
|
||||||
static _getdns_rdata_def a6_rdata[] = {
|
static _getdns_rdata_def a6_rdata[] = {
|
||||||
{ "a6_obsolete" , GETDNS_RDF_X }};
|
{ "a6_obsolete" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def dname_rdata[] = {
|
static _getdns_rdata_def dname_rdata[] = {
|
||||||
{ "target" , GETDNS_RDF_N }};
|
{ "target" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def opt_rdata[] = {
|
static _getdns_rdata_def opt_rdata[] = {
|
||||||
{ "options" , GETDNS_RDF_R },
|
{ "options" , GETDNS_RDF_R , NULL },
|
||||||
{ "option_code" , GETDNS_RDF_I2 },
|
{ "option_code" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "option_data" , GETDNS_RDF_X_S }};
|
{ "option_data" , GETDNS_RDF_X_S , NULL }};
|
||||||
static _getdns_rdata_def apl_rdata[] = {
|
static _getdns_rdata_def apl_rdata[] = {
|
||||||
{ "apitems" , GETDNS_RDF_R },
|
{ "apitems" , GETDNS_RDF_R , NULL },
|
||||||
{ "address_family" , GETDNS_RDF_I2 },
|
{ "address_family" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "prefix" , GETDNS_RDF_I1 },
|
{ "prefix" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "n" , GETDNS_RDF_SPECIAL, &apl_n },
|
{ "n" , GETDNS_RDF_SPECIAL, &apl_n },
|
||||||
{ "afdpart" , GETDNS_RDF_SPECIAL, &apl_afdpart }};
|
{ "afdpart" , GETDNS_RDF_SPECIAL, &apl_afdpart }};
|
||||||
static _getdns_rdata_def ds_rdata[] = {
|
static _getdns_rdata_def ds_rdata[] = {
|
||||||
{ "key_tag" , GETDNS_RDF_I2 },
|
{ "key_tag" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "digest_type" , GETDNS_RDF_I1 },
|
{ "digest_type" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "digest" , GETDNS_RDF_X }};
|
{ "digest" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def sshfp_rdata[] = {
|
static _getdns_rdata_def sshfp_rdata[] = {
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "fp_type" , GETDNS_RDF_I1 },
|
{ "fp_type" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "fingerprint" , GETDNS_RDF_X }};
|
{ "fingerprint" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def ipseckey_rdata[] = {
|
static _getdns_rdata_def ipseckey_rdata[] = {
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "gateway_type" , GETDNS_RDF_I1 },
|
{ "gateway_type" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "precedence" , GETDNS_RDF_I1 },
|
{ "precedence" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "gateway" , GETDNS_RDF_SPECIAL, &ipseckey_gateway },
|
{ "gateway" , GETDNS_RDF_SPECIAL, &ipseckey_gateway },
|
||||||
{ "public_key" , GETDNS_RDF_B }};
|
{ "public_key" , GETDNS_RDF_B , NULL }};
|
||||||
static _getdns_rdata_def rrsig_rdata[] = {
|
static _getdns_rdata_def rrsig_rdata[] = {
|
||||||
{ "type_covered" , GETDNS_RDF_I2 },
|
{ "type_covered" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "labels" , GETDNS_RDF_I1 },
|
{ "labels" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "original_ttl" , GETDNS_RDF_I4 },
|
{ "original_ttl" , GETDNS_RDF_I4 , NULL },
|
||||||
{ "signature_expiration" , GETDNS_RDF_T },
|
{ "signature_expiration" , GETDNS_RDF_T , NULL },
|
||||||
{ "signature_inception" , GETDNS_RDF_T },
|
{ "signature_inception" , GETDNS_RDF_T , NULL },
|
||||||
{ "key_tag" , GETDNS_RDF_I2 },
|
{ "key_tag" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "signers_name" , GETDNS_RDF_N },
|
{ "signers_name" , GETDNS_RDF_N , NULL },
|
||||||
{ "signature" , GETDNS_RDF_B }};
|
{ "signature" , GETDNS_RDF_B , NULL }};
|
||||||
static _getdns_rdata_def nsec_rdata[] = {
|
static _getdns_rdata_def nsec_rdata[] = {
|
||||||
{ "next_domain_name" , GETDNS_RDF_N },
|
{ "next_domain_name" , GETDNS_RDF_N , NULL },
|
||||||
{ "type_bit_maps" , GETDNS_RDF_X }};
|
{ "type_bit_maps" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def dnskey_rdata[] = {
|
static _getdns_rdata_def dnskey_rdata[] = {
|
||||||
{ "flags" , GETDNS_RDF_I2 },
|
{ "flags" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "protocol" , GETDNS_RDF_I1 },
|
{ "protocol" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "public_key" , GETDNS_RDF_B }};
|
{ "public_key" , GETDNS_RDF_B , NULL }};
|
||||||
static _getdns_rdata_def dhcid_rdata[] = {
|
static _getdns_rdata_def dhcid_rdata[] = {
|
||||||
{ "dhcid_opaque" , GETDNS_RDF_B }};
|
{ "dhcid_opaque" , GETDNS_RDF_B , NULL }};
|
||||||
static _getdns_rdata_def nsec3_rdata[] = {
|
static _getdns_rdata_def nsec3_rdata[] = {
|
||||||
{ "hash_algorithm" , GETDNS_RDF_I1 },
|
{ "hash_algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "flags" , GETDNS_RDF_I1 },
|
{ "flags" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "iterations" , GETDNS_RDF_I2 },
|
{ "iterations" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "salt" , GETDNS_RDF_X_C },
|
{ "salt" , GETDNS_RDF_X_C , NULL },
|
||||||
{ "next_hashed_owner_name" , GETDNS_RDF_B32_C},
|
{ "next_hashed_owner_name" , GETDNS_RDF_B32_C , NULL },
|
||||||
{ "type_bit_maps" , GETDNS_RDF_X }};
|
{ "type_bit_maps" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def nsec3param_rdata[] = {
|
static _getdns_rdata_def nsec3param_rdata[] = {
|
||||||
{ "hash_algorithm" , GETDNS_RDF_I1 },
|
{ "hash_algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "flags" , GETDNS_RDF_I1 },
|
{ "flags" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "iterations" , GETDNS_RDF_I2 },
|
{ "iterations" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "salt" , GETDNS_RDF_X_C }};
|
{ "salt" , GETDNS_RDF_X_C , NULL }};
|
||||||
static _getdns_rdata_def tlsa_rdata[] = {
|
static _getdns_rdata_def tlsa_rdata[] = {
|
||||||
{ "certificate_usage" , GETDNS_RDF_I1 },
|
{ "certificate_usage" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "selector" , GETDNS_RDF_I1 },
|
{ "selector" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "matching_type" , GETDNS_RDF_I1 },
|
{ "matching_type" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "certificate_association_data", GETDNS_RDF_X }};
|
{ "certificate_association_data", GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def hip_rdata[] = {
|
static _getdns_rdata_def hip_rdata[] = {
|
||||||
{ "pk_algorithm" , GETDNS_RDF_SPECIAL, &hip_pk_algorithm },
|
{ "pk_algorithm" , GETDNS_RDF_SPECIAL, &hip_pk_algorithm },
|
||||||
{ "hit" , GETDNS_RDF_SPECIAL, &hip_hit },
|
{ "hit" , GETDNS_RDF_SPECIAL, &hip_hit },
|
||||||
{ "public_key" , GETDNS_RDF_SPECIAL, &hip_public_key },
|
{ "public_key" , GETDNS_RDF_SPECIAL, &hip_public_key },
|
||||||
{ "rendezvous_servers" , GETDNS_RDF_N_M }};
|
{ "rendezvous_servers" , GETDNS_RDF_N_M , NULL }};
|
||||||
static _getdns_rdata_def csync_rdata[] = {
|
static _getdns_rdata_def csync_rdata[] = {
|
||||||
{ "serial" , GETDNS_RDF_I4 },
|
{ "serial" , GETDNS_RDF_I4 , NULL },
|
||||||
{ "flags" , GETDNS_RDF_I2 },
|
{ "flags" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "type_bit_maps" , GETDNS_RDF_X }};
|
{ "type_bit_maps" , GETDNS_RDF_X , NULL }};
|
||||||
static _getdns_rdata_def spf_rdata[] = {
|
static _getdns_rdata_def spf_rdata[] = {
|
||||||
{ "text" , GETDNS_RDF_S_M }};
|
{ "text" , GETDNS_RDF_S_M , NULL }};
|
||||||
static _getdns_rdata_def nid_rdata[] = {
|
static _getdns_rdata_def nid_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "node_id" , GETDNS_RDF_AA }};
|
{ "node_id" , GETDNS_RDF_AA , NULL }};
|
||||||
static _getdns_rdata_def l32_rdata[] = {
|
static _getdns_rdata_def l32_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "locator32" , GETDNS_RDF_A }};
|
{ "locator32" , GETDNS_RDF_A , NULL }};
|
||||||
static _getdns_rdata_def l64_rdata[] = {
|
static _getdns_rdata_def l64_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "locator64" , GETDNS_RDF_AA }};
|
{ "locator64" , GETDNS_RDF_AA , NULL }};
|
||||||
static _getdns_rdata_def lp_rdata[] = {
|
static _getdns_rdata_def lp_rdata[] = {
|
||||||
{ "preference" , GETDNS_RDF_I2 },
|
{ "preference" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "fqdn" , GETDNS_RDF_N }};
|
{ "fqdn" , GETDNS_RDF_N , NULL }};
|
||||||
static _getdns_rdata_def eui48_rdata[] = {
|
static _getdns_rdata_def eui48_rdata[] = {
|
||||||
{ "eui48_address" , GETDNS_RDF_X6 }};
|
{ "eui48_address" , GETDNS_RDF_X6 , NULL }};
|
||||||
static _getdns_rdata_def eui64_rdata[] = {
|
static _getdns_rdata_def eui64_rdata[] = {
|
||||||
{ "eui64_address" , GETDNS_RDF_X8 }};
|
{ "eui64_address" , GETDNS_RDF_X8 , NULL }};
|
||||||
static _getdns_rdata_def tkey_rdata[] = {
|
static _getdns_rdata_def tkey_rdata[] = {
|
||||||
{ "algorithm" , GETDNS_RDF_N },
|
{ "algorithm" , GETDNS_RDF_N , NULL },
|
||||||
{ "inception" , GETDNS_RDF_T },
|
{ "inception" , GETDNS_RDF_T , NULL },
|
||||||
{ "expiration" , GETDNS_RDF_T },
|
{ "expiration" , GETDNS_RDF_T , NULL },
|
||||||
{ "mode" , GETDNS_RDF_I2 },
|
{ "mode" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "error" , GETDNS_RDF_I2 },
|
{ "error" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "key_data" , GETDNS_RDF_X_S },
|
{ "key_data" , GETDNS_RDF_X_S , NULL },
|
||||||
{ "other_data" , GETDNS_RDF_X_S }};
|
{ "other_data" , GETDNS_RDF_X_S , NULL }};
|
||||||
static _getdns_rdata_def tsig_rdata[] = {
|
static _getdns_rdata_def tsig_rdata[] = {
|
||||||
{ "algorithm" , GETDNS_RDF_N },
|
{ "algorithm" , GETDNS_RDF_N , NULL },
|
||||||
{ "time_signed" , GETDNS_RDF_T6 },
|
{ "time_signed" , GETDNS_RDF_T6 , NULL },
|
||||||
{ "fudge" , GETDNS_RDF_I2 },
|
{ "fudge" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "mac" , GETDNS_RDF_X_S },
|
{ "mac" , GETDNS_RDF_X_S , NULL },
|
||||||
{ "original_id" , GETDNS_RDF_I2 },
|
{ "original_id" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "error" , GETDNS_RDF_I2 },
|
{ "error" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "other_data" , GETDNS_RDF_X_S }};
|
{ "other_data" , GETDNS_RDF_X_S , NULL }};
|
||||||
static _getdns_rdata_def uri_rdata[] = {
|
static _getdns_rdata_def uri_rdata[] = {
|
||||||
{ "priority" , GETDNS_RDF_I2 },
|
{ "priority" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "weight" , GETDNS_RDF_I2 },
|
{ "weight" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "target" , GETDNS_RDF_S_L }};
|
{ "target" , GETDNS_RDF_S_L , NULL }};
|
||||||
static _getdns_rdata_def caa_rdata[] = {
|
static _getdns_rdata_def caa_rdata[] = {
|
||||||
{ "flags" , GETDNS_RDF_I1 },
|
{ "flags" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "tag" , GETDNS_RDF_S },
|
{ "tag" , GETDNS_RDF_S , NULL },
|
||||||
{ "value" , GETDNS_RDF_S_L }};
|
{ "value" , GETDNS_RDF_S_L , NULL }};
|
||||||
static _getdns_rdata_def dlv_rdata[] = {
|
static _getdns_rdata_def dlv_rdata[] = {
|
||||||
{ "key_tag" , GETDNS_RDF_I2 },
|
{ "key_tag" , GETDNS_RDF_I2 , NULL },
|
||||||
{ "algorithm" , GETDNS_RDF_I1 },
|
{ "algorithm" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "digest_type" , GETDNS_RDF_I1 },
|
{ "digest_type" , GETDNS_RDF_I1 , NULL },
|
||||||
{ "digest" , GETDNS_RDF_X }};
|
{ "digest" , GETDNS_RDF_X , NULL }};
|
||||||
|
|
||||||
static _getdns_rr_def _getdns_rr_defs[] = {
|
static _getdns_rr_def _getdns_rr_defs[] = {
|
||||||
{ NULL, NULL, 0 },
|
{ NULL, NULL, 0 },
|
||||||
|
|
|
@ -138,7 +138,7 @@ typedef struct _getdns_rdata_def {
|
||||||
typedef struct _getdns_rr_def {
|
typedef struct _getdns_rr_def {
|
||||||
const char *name;
|
const char *name;
|
||||||
const _getdns_rdata_def *rdata;
|
const _getdns_rdata_def *rdata;
|
||||||
int n_rdata_fields;
|
size_t n_rdata_fields;
|
||||||
} _getdns_rr_def;
|
} _getdns_rr_def;
|
||||||
|
|
||||||
const _getdns_rr_def *_getdns_rr_def_lookup(uint16_t rr_type);
|
const _getdns_rr_def *_getdns_rr_def_lookup(uint16_t rr_type);
|
||||||
|
|
|
@ -75,8 +75,8 @@ find_rrtype(_getdns_rr_iter *i)
|
||||||
|
|
||||||
/* Past the last RR in the pkt */
|
/* Past the last RR in the pkt */
|
||||||
if (i->pkt &&
|
if (i->pkt &&
|
||||||
(unsigned)(GLDNS_QDCOUNT(i->pkt) + GLDNS_ANCOUNT(i->pkt) +
|
(size_t)GLDNS_QDCOUNT(i->pkt) + GLDNS_ANCOUNT(i->pkt) +
|
||||||
GLDNS_NSCOUNT(i->pkt) + GLDNS_ARCOUNT(i->pkt)) <= i->n)
|
GLDNS_NSCOUNT(i->pkt) + GLDNS_ARCOUNT(i->pkt) <= i->n)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
for (pos = i->pos; pos + 4 < i->pkt_end; pos += *pos + 1)
|
for (pos = i->pos; pos + 4 < i->pkt_end; pos += *pos + 1)
|
||||||
|
|
|
@ -88,16 +88,16 @@ _getdns_rr_iter_section(_getdns_rr_iter *i)
|
||||||
{
|
{
|
||||||
return ! i->pkt ? (i->nxt - i->rr_type == 4 ? SECTION_QUESTION
|
return ! i->pkt ? (i->nxt - i->rr_type == 4 ? SECTION_QUESTION
|
||||||
: SECTION_ANSWER )
|
: SECTION_ANSWER )
|
||||||
: i->n < GLDNS_QDCOUNT(i->pkt) ? SECTION_QUESTION
|
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt) ? SECTION_QUESTION
|
||||||
: i->n < (unsigned)(GLDNS_QDCOUNT(i->pkt)
|
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt)
|
||||||
+ GLDNS_ANCOUNT(i->pkt)) ? SECTION_ANSWER
|
+ GLDNS_ANCOUNT(i->pkt) ? SECTION_ANSWER
|
||||||
: i->n < (unsigned)(GLDNS_QDCOUNT(i->pkt)
|
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt)
|
||||||
+ GLDNS_ANCOUNT(i->pkt)
|
+ GLDNS_ANCOUNT(i->pkt)
|
||||||
+ GLDNS_NSCOUNT(i->pkt)) ? SECTION_AUTHORITY
|
+ GLDNS_NSCOUNT(i->pkt) ? SECTION_AUTHORITY
|
||||||
: i->n < (unsigned)(GLDNS_QDCOUNT(i->pkt)
|
: i->n < (size_t)GLDNS_QDCOUNT(i->pkt)
|
||||||
+ GLDNS_ANCOUNT(i->pkt)
|
+ GLDNS_ANCOUNT(i->pkt)
|
||||||
+ GLDNS_NSCOUNT(i->pkt)
|
+ GLDNS_NSCOUNT(i->pkt)
|
||||||
+ GLDNS_ARCOUNT(i->pkt)) ? SECTION_ADDITIONAL
|
+ GLDNS_ARCOUNT(i->pkt) ? SECTION_ADDITIONAL
|
||||||
: SECTION_ANY;
|
: SECTION_ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
src/stub.c
11
src/stub.c
|
@ -379,6 +379,7 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport)
|
||||||
if (transport == GETDNS_TRANSPORT_TCP)
|
if (transport == GETDNS_TRANSPORT_TCP)
|
||||||
return fd;
|
return fd;
|
||||||
#elif USE_OSX_TCP_FASTOPEN
|
#elif USE_OSX_TCP_FASTOPEN
|
||||||
|
(void)transport;
|
||||||
sa_endpoints_t endpoints;
|
sa_endpoints_t endpoints;
|
||||||
endpoints.sae_srcif = 0;
|
endpoints.sae_srcif = 0;
|
||||||
endpoints.sae_srcaddr = NULL;
|
endpoints.sae_srcaddr = NULL;
|
||||||
|
@ -394,6 +395,8 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
|
#else
|
||||||
|
(void)transport;
|
||||||
#endif
|
#endif
|
||||||
if (connect(fd, (struct sockaddr *)&upstream->addr,
|
if (connect(fd, (struct sockaddr *)&upstream->addr,
|
||||||
upstream->addr_len) == -1) {
|
upstream->addr_len) == -1) {
|
||||||
|
@ -678,7 +681,7 @@ stub_tcp_read(int fd, getdns_tcp_state *tcp, struct mem_funcs *mf)
|
||||||
tcp->to_read = 2; /* Packet size */
|
tcp->to_read = 2; /* Packet size */
|
||||||
}
|
}
|
||||||
read = recv(fd, (void *)tcp->read_pos, tcp->to_read, 0);
|
read = recv(fd, (void *)tcp->read_pos, tcp->to_read, 0);
|
||||||
if (read == -1) {
|
if (read < 0) {
|
||||||
if (_getdns_EWOULDBLOCK)
|
if (_getdns_EWOULDBLOCK)
|
||||||
return STUB_TCP_WOULDBLOCK;
|
return STUB_TCP_WOULDBLOCK;
|
||||||
else
|
else
|
||||||
|
@ -687,7 +690,7 @@ stub_tcp_read(int fd, getdns_tcp_state *tcp, struct mem_funcs *mf)
|
||||||
/* Remote end closed the socket */
|
/* Remote end closed the socket */
|
||||||
/* TODO: Try to reconnect */
|
/* TODO: Try to reconnect */
|
||||||
return STUB_TCP_ERROR;
|
return STUB_TCP_ERROR;
|
||||||
} else if (read> tcp->to_read) {
|
} else if ((size_t)read > tcp->to_read) {
|
||||||
return STUB_TCP_ERROR;
|
return STUB_TCP_ERROR;
|
||||||
}
|
}
|
||||||
tcp->to_read -= read;
|
tcp->to_read -= read;
|
||||||
|
@ -795,12 +798,12 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq)
|
||||||
(struct sockaddr *)&(netreq->upstream->addr),
|
(struct sockaddr *)&(netreq->upstream->addr),
|
||||||
netreq->upstream->addr_len);
|
netreq->upstream->addr_len);
|
||||||
#endif
|
#endif
|
||||||
if ((written == -1 && (_getdns_EWOULDBLOCK ||
|
if ((written < 0 && (_getdns_EWOULDBLOCK ||
|
||||||
/* Add the error case where the connection is in progress which is when
|
/* Add the error case where the connection is in progress which is when
|
||||||
a cookie is not available (e.g. when doing the first request to an
|
a cookie is not available (e.g. when doing the first request to an
|
||||||
upstream). We must let the handshake complete since non-blocking. */
|
upstream). We must let the handshake complete since non-blocking. */
|
||||||
_getdns_EINPROGRESS)) ||
|
_getdns_EINPROGRESS)) ||
|
||||||
written < pkt_len + 2) {
|
(size_t)written < pkt_len + 2) {
|
||||||
|
|
||||||
/* We couldn't write the whole packet.
|
/* We couldn't write the whole packet.
|
||||||
* We have to return with STUB_TCP_AGAIN.
|
* We have to return with STUB_TCP_AGAIN.
|
||||||
|
|
|
@ -151,6 +151,7 @@ getdns_sync_cb(getdns_context *context, getdns_callback_type_t callback_type,
|
||||||
getdns_dict *response, void *userarg, getdns_transaction_t transaction_id)
|
getdns_dict *response, void *userarg, getdns_transaction_t transaction_id)
|
||||||
{
|
{
|
||||||
getdns_sync_data *data = (getdns_sync_data *)userarg;
|
getdns_sync_data *data = (getdns_sync_data *)userarg;
|
||||||
|
(void)context; (void)callback_type; (void)transaction_id;
|
||||||
|
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,8 @@ CHECK_EVENT_PROG=@CHECK_EVENT_PROG@
|
||||||
CHECK_EV_PROG=@CHECK_EV_PROG@
|
CHECK_EV_PROG=@CHECK_EV_PROG@
|
||||||
|
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
CFLAGS=-I$(srcdir)/.. -I$(srcdir) -I.. $(cflags) @CFLAGS@ @CPPFLAGS@
|
CFLAGS=-I$(srcdir)/.. -I$(srcdir) -I.. $(cflags) @CFLAGS@ @CPPFLAGS@ $(XTRA_CFLAGS)
|
||||||
|
WPEDANTICFLAG=@WPEDANTICFLAG@
|
||||||
LDFLAGS=-L.. @LDFLAGS@
|
LDFLAGS=-L.. @LDFLAGS@
|
||||||
LDLIBS=../libgetdns.la @LIBS@
|
LDLIBS=../libgetdns.la @LIBS@
|
||||||
CHECK_LIBS=@CHECK_LIBS@
|
CHECK_LIBS=@CHECK_LIBS@
|
||||||
|
@ -85,59 +86,59 @@ PROGRAMS=tests_dict tests_list tests_namespaces tests_stub_async tests_stub_sync
|
||||||
.SUFFIXES: .c .o .a .lo .h
|
.SUFFIXES: .c .o .a .lo .h
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||||
|
|
||||||
.c.lo:
|
.c.lo:
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $< -o $@
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: $(PROGRAMS)
|
all: $(PROGRAMS)
|
||||||
|
|
||||||
jsmn.lo:
|
jsmn.lo:
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -DJSMN_GETDNS -c $(srcdir)/jsmn/jsmn.c -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -DJSMN_GETDNS -c $(srcdir)/jsmn/jsmn.c -o $@
|
||||||
|
|
||||||
$(ALL_OBJS):
|
$(ALL_OBJS):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
$(NON_C99_OBJS):
|
$(NON_C99_OBJS):
|
||||||
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -c $(srcdir)/$(@:.lo=.c) -o $@
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) $(WPEDANTICFLAG) -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -c $(srcdir)/$(@:.lo=.c) -o $@
|
||||||
|
|
||||||
tests_dict: tests_dict.lo testmessages.lo
|
tests_dict: tests_dict.lo testmessages.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.lo testmessages.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_dict.lo testmessages.lo
|
||||||
|
|
||||||
tests_list: tests_list.lo testmessages.lo
|
tests_list: tests_list.lo testmessages.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.lo testmessages.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_list.lo testmessages.lo
|
||||||
|
|
||||||
tests_namespaces: tests_namespaces.lo
|
tests_namespaces: tests_namespaces.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_namespaces.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_namespaces.lo
|
||||||
|
|
||||||
tests_stub_async: tests_stub_async.lo testmessages.lo
|
tests_stub_async: tests_stub_async.lo testmessages.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.lo testmessages.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_async.lo testmessages.lo
|
||||||
|
|
||||||
tests_stub_sync: tests_stub_sync.lo
|
tests_stub_sync: tests_stub_sync.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ tests_stub_sync.lo
|
||||||
|
|
||||||
check_getdns_common: check_getdns_common.lo
|
check_getdns_common: check_getdns_common.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ check_getdns_common.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) -o $@ check_getdns_common.lo
|
||||||
|
|
||||||
check_getdns: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
check_getdns: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_selectloop.lo
|
||||||
|
|
||||||
check_getdns_event: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo ../libgetdns_ext_event.la
|
check_getdns_event: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo ../libgetdns_ext_event.la
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS)
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libevent.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_event.la $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS)
|
||||||
|
|
||||||
check_getdns_uv: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo ../libgetdns_ext_uv.la
|
check_getdns_uv: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo ../libgetdns_ext_uv.la
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS)
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libuv.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_uv.la $(EXTENSION_LIBUV_LDFLAGS) $(EXTENSION_LIBUV_EXT_LIBS)
|
||||||
|
|
||||||
check_getdns_ev: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo ../libgetdns_ext_ev.la
|
check_getdns_ev: check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo ../libgetdns_ext_ev.la
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_CFLAGS) $(CHECK_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS)
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ check_getdns.lo check_getdns_common.lo check_getdns_context_set_timeout.lo check_getdns_transport.lo check_getdns_libev.lo $(LDFLAGS) $(LDLIBS) $(CHECK_LIBS) ../libgetdns_ext_ev.la $(EXTENSION_LIBEV_LDFLAGS) $(EXTENSION_LIBEV_EXT_LIBS)
|
||||||
|
|
||||||
getdns_query: getdns_query.lo $(DECOMPOSED_OBJS)
|
getdns_query: getdns_query.lo $(DECOMPOSED_OBJS)
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ getdns_query.lo $(DECOMPOSED_OBJS) $(LDFLAGS) $(LDLIBS)
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ getdns_query.lo $(DECOMPOSED_OBJS) $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
scratchpad: scratchpad.lo
|
scratchpad: scratchpad.lo
|
||||||
$(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) -o $@ scratchpad.lo $(LDFLAGS) $(LDLIBS)
|
$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ scratchpad.lo $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
scratchpad.lo: scratchpad.c
|
scratchpad.lo: scratchpad.c
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char** argv)
|
main ()
|
||||||
{
|
{
|
||||||
int number_failed;
|
int number_failed;
|
||||||
SRunner *sr ;
|
SRunner *sr ;
|
||||||
|
|
|
@ -149,6 +149,7 @@
|
||||||
* rcode = 0
|
* rcode = 0
|
||||||
*/
|
*/
|
||||||
void verify_getdns_address_6(struct extracted_response *ex_response);
|
void verify_getdns_address_6(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_address_6 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -157,7 +158,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_address(context, "google.com", NULL,
|
ASSERT_RC(getdns_address(context, "google.com", NULL,
|
||||||
verify_getdns_address_6, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -183,6 +184,7 @@
|
||||||
* ancount = 1 (number of records in ANSWER section)
|
* ancount = 1 (number of records in ANSWER section)
|
||||||
*/
|
*/
|
||||||
void verify_getdns_address_7(struct extracted_response *ex_response);
|
void verify_getdns_address_7(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_address_7 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -191,7 +193,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_address(context, "localhost", NULL,
|
ASSERT_RC(getdns_address(context, "localhost", NULL,
|
||||||
verify_getdns_address_7, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -213,6 +215,7 @@
|
||||||
* rcode = 3 (NXDOMAIN)
|
* rcode = 3 (NXDOMAIN)
|
||||||
*/
|
*/
|
||||||
void verify_getdns_address_8(struct extracted_response *ex_response);
|
void verify_getdns_address_8(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_address_8 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -222,7 +225,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_address(context, "hostnamedoesntexist", NULL,
|
ASSERT_RC(getdns_address(context, "hostnamedoesntexist", NULL,
|
||||||
verify_getdns_address_8, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
* expect: GETDNS_RETURN_UNKNOWN_TRANSACTION
|
* expect: GETDNS_RETURN_UNKNOWN_TRANSACTION
|
||||||
*/
|
*/
|
||||||
void verify_getdns_cancel_callback(struct extracted_response *ex_response);
|
void verify_getdns_cancel_callback(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_cancel_callback };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -65,7 +66,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
verify_getdns_cancel_callback, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -86,6 +87,7 @@
|
||||||
* expect: GETDNS_RETURN_UNKNOWN_TRANSACTION
|
* expect: GETDNS_RETURN_UNKNOWN_TRANSACTION
|
||||||
*/
|
*/
|
||||||
void verify_getdns_cancel_callback(struct extracted_response *ex_response);
|
void verify_getdns_cancel_callback(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_cancel_callback };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -96,7 +98,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
verify_getdns_cancel_callback, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -133,7 +135,8 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
getdns_transaction_t transaction_id_array[10] = {};
|
getdns_transaction_t transaction_id_array[10]
|
||||||
|
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
int i;
|
int i;
|
||||||
int odd = 0;
|
int odd = 0;
|
||||||
int even = 0;
|
int even = 0;
|
||||||
|
@ -212,7 +215,8 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
getdns_transaction_t transaction_id_array[10] = {};
|
getdns_transaction_t transaction_id_array[10]
|
||||||
|
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
int i;
|
int i;
|
||||||
int odd = 0;
|
int odd = 0;
|
||||||
int even = 0;
|
int even = 0;
|
||||||
|
@ -295,7 +299,8 @@
|
||||||
struct getdns_bindata address_data = { 4, (void *)"\x08\x08\x08\x08" };
|
struct getdns_bindata address_data = { 4, (void *)"\x08\x08\x08\x08" };
|
||||||
struct getdns_dict *address = NULL;
|
struct getdns_dict *address = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
getdns_transaction_t transaction_id_array[10] = {};
|
getdns_transaction_t transaction_id_array[10]
|
||||||
|
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
int i;
|
int i;
|
||||||
int odd = 0;
|
int odd = 0;
|
||||||
int even = 0;
|
int even = 0;
|
||||||
|
@ -381,7 +386,8 @@
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
getdns_transaction_t transaction_id_array[10] = {};
|
getdns_transaction_t transaction_id_array[10]
|
||||||
|
= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
int i;
|
int i;
|
||||||
int odd = 0;
|
int odd = 0;
|
||||||
int even = 0;
|
int even = 0;
|
||||||
|
@ -451,6 +457,8 @@
|
||||||
void *userarg,
|
void *userarg,
|
||||||
getdns_transaction_t transaction_id)
|
getdns_transaction_t transaction_id)
|
||||||
{
|
{
|
||||||
|
(void)context; (void)response; (void)userarg;
|
||||||
|
|
||||||
callback_called++;
|
callback_called++;
|
||||||
|
|
||||||
if(callback_type == GETDNS_CALLBACK_CANCEL)
|
if(callback_type == GETDNS_CALLBACK_CANCEL)
|
||||||
|
@ -483,6 +491,7 @@
|
||||||
*/
|
*/
|
||||||
void verify_getdns_cancel_callback(struct extracted_response *ex_response)
|
void verify_getdns_cancel_callback(struct extracted_response *ex_response)
|
||||||
{
|
{
|
||||||
|
(void)ex_response;
|
||||||
/*
|
/*
|
||||||
* increment callback_called global to prove callback was called.
|
* increment callback_called global to prove callback was called.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -320,6 +320,7 @@ void destroy_callbackfn(struct getdns_context *context,
|
||||||
void *userarg,
|
void *userarg,
|
||||||
getdns_transaction_t transaction_id) {
|
getdns_transaction_t transaction_id) {
|
||||||
int* flag = (int*)userarg;
|
int* flag = (int*)userarg;
|
||||||
|
(void)callback_type; (void)transaction_id;
|
||||||
*flag = 1;
|
*flag = 1;
|
||||||
getdns_dict_destroy(response);
|
getdns_dict_destroy(response);
|
||||||
getdns_context_destroy(context);
|
getdns_context_destroy(context);
|
||||||
|
@ -338,7 +339,8 @@ void callbackfn(struct getdns_context *context,
|
||||||
getdns_transaction_t transaction_id)
|
getdns_transaction_t transaction_id)
|
||||||
{
|
{
|
||||||
typedef void (*fn_ptr)(struct extracted_response *ex_response);
|
typedef void (*fn_ptr)(struct extracted_response *ex_response);
|
||||||
fn_ptr fn = userarg;
|
fn_ptr fn = ((fn_cont *)userarg)->fn;
|
||||||
|
(void)context; (void)transaction_id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If userarg is NULL, either a negative test case
|
* If userarg is NULL, either a negative test case
|
||||||
|
@ -378,7 +380,7 @@ void callbackfn(struct getdns_context *context,
|
||||||
void update_callbackfn(struct getdns_context *context,
|
void update_callbackfn(struct getdns_context *context,
|
||||||
getdns_context_code_t changed_item)
|
getdns_context_code_t changed_item)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
ck_assert_msg(changed_item == expected_changed_item,
|
ck_assert_msg(changed_item == expected_changed_item,
|
||||||
"Expected changed_item == %d, got %d",
|
"Expected changed_item == %d, got %d",
|
||||||
changed_item, expected_changed_item);
|
changed_item, expected_changed_item);
|
||||||
|
|
|
@ -211,6 +211,10 @@
|
||||||
struct getdns_dict *response,
|
struct getdns_dict *response,
|
||||||
void *userarg,
|
void *userarg,
|
||||||
getdns_transaction_t transaction_id);
|
getdns_transaction_t transaction_id);
|
||||||
|
|
||||||
|
typedef struct fn_cont {
|
||||||
|
void (*fn)(struct extracted_response *ex_response);
|
||||||
|
} fn_cont;
|
||||||
/*
|
/*
|
||||||
* callbackfn is the callback function given to all
|
* callbackfn is the callback function given to all
|
||||||
* asynchronous query tests. It is expected to only
|
* asynchronous query tests. It is expected to only
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
* expect: callback should be called before getdns_context_destroy() returns
|
* expect: callback should be called before getdns_context_destroy() returns
|
||||||
*/
|
*/
|
||||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -78,7 +79,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -95,6 +96,7 @@
|
||||||
* expect: callback should be called before getdns_context_destroy() returns
|
* expect: callback should be called before getdns_context_destroy() returns
|
||||||
*/
|
*/
|
||||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -105,7 +107,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_address(context, "google.com", NULL,
|
ASSERT_RC(getdns_address(context, "google.com", NULL,
|
||||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -122,6 +124,7 @@
|
||||||
* expect: callback should be called before getdns_context_destroy() returns
|
* expect: callback should be called before getdns_context_destroy() returns
|
||||||
*/
|
*/
|
||||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||||
|
@ -141,7 +144,7 @@
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata");
|
GETDNS_RETURN_GOOD, "Return code from getdns_dict_set_bindata");
|
||||||
|
|
||||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_address()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -159,6 +162,7 @@
|
||||||
* expect: callback should be called before getdns_context_destroy() returns
|
* expect: callback should be called before getdns_context_destroy() returns
|
||||||
*/
|
*/
|
||||||
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
void verify_getdns_context_destroy(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_context_destroy };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
void* eventloop = NULL;
|
void* eventloop = NULL;
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -169,7 +173,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_service(context, "google.com", NULL,
|
ASSERT_RC(getdns_service(context, "google.com", NULL,
|
||||||
verify_getdns_context_destroy, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_service()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_service()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -267,6 +271,7 @@
|
||||||
|
|
||||||
void verify_getdns_context_destroy(struct extracted_response *ex_response)
|
void verify_getdns_context_destroy(struct extracted_response *ex_response)
|
||||||
{
|
{
|
||||||
|
(void)ex_response;
|
||||||
/*
|
/*
|
||||||
* Sleep for a second to make getdns_context_destroy() wait.
|
* Sleep for a second to make getdns_context_destroy() wait.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -243,6 +243,7 @@ void timeout_3_cb(struct getdns_context *context,
|
||||||
getdns_callback_type_t callback_type,
|
getdns_callback_type_t callback_type,
|
||||||
struct getdns_dict * response,
|
struct getdns_dict * response,
|
||||||
void *userarg, getdns_transaction_t transaction_id) {
|
void *userarg, getdns_transaction_t transaction_id) {
|
||||||
|
(void)response; (void)transaction_id;
|
||||||
timeout_thread_data *tdata = (timeout_thread_data*)userarg;
|
timeout_thread_data *tdata = (timeout_thread_data*)userarg;
|
||||||
tdata->num_callbacks++;
|
tdata->num_callbacks++;
|
||||||
if (callback_type == GETDNS_CALLBACK_TIMEOUT) {
|
if (callback_type == GETDNS_CALLBACK_TIMEOUT) {
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
struct getdns_list *answer = NULL;
|
struct getdns_list *answer = NULL;
|
||||||
char *keys[3] = { "ten", "eleven", "twelve" };
|
char *keys[3] = { "ten", "eleven", "twelve" };
|
||||||
uint32_t values[3] = { 10, 11, 12 };
|
uint32_t values[3] = { 10, 11, 12 };
|
||||||
int i;
|
size_t i;
|
||||||
size_t length;
|
size_t length;
|
||||||
struct getdns_bindata *key = NULL;
|
struct getdns_bindata *key = NULL;
|
||||||
char string_buffer[20] = "";
|
char string_buffer[20] = "";
|
||||||
|
|
|
@ -151,6 +151,7 @@
|
||||||
* ancount = 0 (number of records in ANSWER section)
|
* ancount = 0 (number of records in ANSWER section)
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_6(struct extracted_response *ex_response);
|
void verify_getdns_general_6(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_6 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -159,7 +160,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", 0, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", 0, NULL,
|
||||||
verify_getdns_general_6, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -184,6 +185,7 @@
|
||||||
* ancount = 0 (number of records in ANSWER section)
|
* ancount = 0 (number of records in ANSWER section)
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_7(struct extracted_response *ex_response);
|
void verify_getdns_general_7(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_7 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -192,7 +194,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", 65279, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", 65279, NULL,
|
||||||
verify_getdns_general_7, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -218,6 +220,7 @@
|
||||||
* and equals number of A records ("type": 1) in "answer" list
|
* and equals number of A records ("type": 1) in "answer" list
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_8(struct extracted_response *ex_response);
|
void verify_getdns_general_8(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_8 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -226,7 +229,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
verify_getdns_general_8, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -252,6 +255,7 @@
|
||||||
* and equals number of AAAA records ("type": 28) in "answer" list
|
* and equals number of AAAA records ("type": 28) in "answer" list
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_9(struct extracted_response *ex_response);
|
void verify_getdns_general_9(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_9 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -260,7 +264,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_AAAA, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_AAAA, NULL,
|
||||||
verify_getdns_general_9, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -287,6 +291,7 @@
|
||||||
* and SOA record ("type": 6) present in "authority" list
|
* and SOA record ("type": 6) present in "authority" list
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_10(struct extracted_response *ex_response);
|
void verify_getdns_general_10(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_10 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -296,7 +301,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_TXT, NULL,
|
ASSERT_RC(getdns_general(context, name, GETDNS_RRTYPE_TXT, NULL,
|
||||||
verify_getdns_general_10, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -322,6 +327,7 @@
|
||||||
* ancount = 0 (number of records in ANSWER section)
|
* ancount = 0 (number of records in ANSWER section)
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_11(struct extracted_response *ex_response);
|
void verify_getdns_general_11(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_11 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -330,7 +336,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "willem.getdnsapi.net", GETDNS_RRTYPE_MX, NULL,
|
ASSERT_RC(getdns_general(context, "willem.getdnsapi.net", GETDNS_RRTYPE_MX, NULL,
|
||||||
verify_getdns_general_11, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -356,6 +362,7 @@
|
||||||
* and equals number of A records ("type": 1) in "answer" list
|
* and equals number of A records ("type": 1) in "answer" list
|
||||||
*/
|
*/
|
||||||
void verify_getdns_general_12(struct extracted_response *ex_response);
|
void verify_getdns_general_12(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_general_12 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -364,7 +371,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
ASSERT_RC(getdns_general(context, "google.com", GETDNS_RRTYPE_A, NULL,
|
||||||
verify_getdns_general_12, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_general()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
|
|
@ -315,6 +315,7 @@
|
||||||
* expect: response with correct hostname
|
* expect: response with correct hostname
|
||||||
*/
|
*/
|
||||||
void verify_getdns_hostname_10(struct extracted_response *ex_response);
|
void verify_getdns_hostname_10(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_hostname_10 };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *address = NULL;
|
struct getdns_dict *address = NULL;
|
||||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||||
|
@ -333,7 +334,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||||
verify_getdns_hostname_10, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -356,6 +357,7 @@
|
||||||
* expect: response with no hostname
|
* expect: response with no hostname
|
||||||
*/
|
*/
|
||||||
void verify_getdns_hostname_11(struct extracted_response *ex_response);
|
void verify_getdns_hostname_11(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_hostname_11 };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *address = NULL;
|
struct getdns_dict *address = NULL;
|
||||||
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
struct getdns_bindata address_type = { 5, (void *)"IPv4" };
|
||||||
|
@ -374,7 +376,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||||
verify_getdns_hostname_11, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -398,6 +400,7 @@
|
||||||
* expect: response with correct hostname
|
* expect: response with correct hostname
|
||||||
*/
|
*/
|
||||||
void verify_getdns_hostname_12(struct extracted_response *ex_response);
|
void verify_getdns_hostname_12(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_hostname_12 };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *address = NULL;
|
struct getdns_dict *address = NULL;
|
||||||
struct getdns_bindata address_type = { 5, (void *)"IPv6" };
|
struct getdns_bindata address_type = { 5, (void *)"IPv6" };
|
||||||
|
@ -419,7 +422,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||||
verify_getdns_hostname_12, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
@ -442,6 +445,7 @@
|
||||||
* expect: response with no hostname
|
* expect: response with no hostname
|
||||||
*/
|
*/
|
||||||
void verify_getdns_hostname_13(struct extracted_response *ex_response);
|
void verify_getdns_hostname_13(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_hostname_13 };
|
||||||
struct getdns_context *context = NULL;
|
struct getdns_context *context = NULL;
|
||||||
struct getdns_dict *address = NULL;
|
struct getdns_dict *address = NULL;
|
||||||
struct getdns_bindata address_type = { 5, (void *)"IPv6" };
|
struct getdns_bindata address_type = { 5, (void *)"IPv6" };
|
||||||
|
@ -460,7 +464,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_hostname(context, address, NULL,
|
ASSERT_RC(getdns_hostname(context, address, NULL,
|
||||||
verify_getdns_hostname_13, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_hostname()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
||||||
struct ev_loop* loop = (struct ev_loop*) eventloop;
|
struct ev_loop* loop = (struct ev_loop*) eventloop;
|
||||||
|
(void)context;
|
||||||
ev_run(loop, 0);
|
ev_run(loop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
||||||
struct event_base* base = (struct event_base*) eventloop;
|
struct event_base* base = (struct event_base*) eventloop;
|
||||||
|
(void)context;
|
||||||
event_base_dispatch(base);
|
event_base_dispatch(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
||||||
uv_loop_t* loop = (uv_loop_t*) eventloop;
|
uv_loop_t* loop = (uv_loop_t*) eventloop;
|
||||||
|
(void)context;
|
||||||
uv_run(loop, UV_RUN_DEFAULT);
|
uv_run(loop, UV_RUN_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,11 @@
|
||||||
#include "getdns/getdns_extra.h"
|
#include "getdns/getdns_extra.h"
|
||||||
|
|
||||||
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
|
||||||
|
(void)eventloop;
|
||||||
getdns_context_run(context);
|
getdns_context_run(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* create_eventloop_impl(struct getdns_context* context) {
|
void* create_eventloop_impl(struct getdns_context* context) {
|
||||||
|
(void)context;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
* expect: NXDOMAIN response (with SOA record)
|
* expect: NXDOMAIN response (with SOA record)
|
||||||
*/
|
*/
|
||||||
void verify_getdns_service_7(struct extracted_response *ex_response);
|
void verify_getdns_service_7(struct extracted_response *ex_response);
|
||||||
|
fn_cont fn_ref = { verify_getdns_service_7 };
|
||||||
struct getdns_context *context = NULL; \
|
struct getdns_context *context = NULL; \
|
||||||
void* eventloop = NULL; \
|
void* eventloop = NULL; \
|
||||||
getdns_transaction_t transaction_id = 0;
|
getdns_transaction_t transaction_id = 0;
|
||||||
|
@ -157,7 +158,7 @@
|
||||||
EVENT_BASE_CREATE;
|
EVENT_BASE_CREATE;
|
||||||
|
|
||||||
ASSERT_RC(getdns_service(context, "nitinsinghit.com", NULL,
|
ASSERT_RC(getdns_service(context, "nitinsinghit.com", NULL,
|
||||||
verify_getdns_address_8, &transaction_id, callbackfn),
|
&fn_ref, &transaction_id, callbackfn),
|
||||||
GETDNS_RETURN_GOOD, "Return code from getdns_service()");
|
GETDNS_RETURN_GOOD, "Return code from getdns_service()");
|
||||||
|
|
||||||
RUN_EVENT_LOOP;
|
RUN_EVENT_LOOP;
|
||||||
|
|
|
@ -193,6 +193,8 @@ void transport_cb(struct getdns_context *context,
|
||||||
struct getdns_dict * response,
|
struct getdns_dict * response,
|
||||||
void *userarg, getdns_transaction_t transaction_id) {
|
void *userarg, getdns_transaction_t transaction_id) {
|
||||||
/* Don't really care about the answer*/
|
/* Don't really care about the answer*/
|
||||||
|
(void)context; (void)callback_type; (void)response;
|
||||||
|
(void)userarg; (void)transaction_id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,9 +101,9 @@ typedef struct tcp_connection {
|
||||||
getdns_eventloop_event event;
|
getdns_eventloop_event event;
|
||||||
|
|
||||||
uint8_t *read_buf;
|
uint8_t *read_buf;
|
||||||
size_t read_buf_len;
|
ssize_t read_buf_len;
|
||||||
uint8_t *read_pos;
|
uint8_t *read_pos;
|
||||||
size_t to_read;
|
ssize_t to_read;
|
||||||
|
|
||||||
tcp_to_write *to_write;
|
tcp_to_write *to_write;
|
||||||
size_t to_answer;
|
size_t to_answer;
|
||||||
|
@ -331,7 +331,7 @@ static void tcp_read_cb(void *userarg)
|
||||||
(void) loop->vmt->schedule(loop, conn->fd,
|
(void) loop->vmt->schedule(loop, conn->fd,
|
||||||
DOWNSTREAM_IDLE_TIMEOUT, &conn->event);
|
DOWNSTREAM_IDLE_TIMEOUT, &conn->event);
|
||||||
|
|
||||||
if ((bytes_read = read(conn->fd, conn->read_pos, conn->to_read)) == -1) {
|
if ((bytes_read = read(conn->fd, conn->read_pos, conn->to_read)) < 0) {
|
||||||
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||||
return; /* Come back to do the read later */
|
return; /* Come back to do the read later */
|
||||||
|
|
||||||
|
@ -705,9 +705,9 @@ static getdns_return_t add_listeners(listen_set *set)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (setsockopt(l->fd, SOL_SOCKET, SO_REUSEADDR,
|
if (setsockopt(l->fd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
&enable, sizeof(int)) < 0)
|
&enable, sizeof(int)) < 0) {
|
||||||
; /* Ignore */
|
; /* Ignore */
|
||||||
|
}
|
||||||
if (bind(l->fd, (struct sockaddr *)&l->addr,
|
if (bind(l->fd, (struct sockaddr *)&l->addr,
|
||||||
l->addr_len) == -1)
|
l->addr_len) == -1)
|
||||||
/* IO error */
|
/* IO error */
|
||||||
|
|
|
@ -122,7 +122,7 @@ static int get_rrclass(const char *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getdns_return_t
|
static getdns_return_t
|
||||||
fill_transport_list(getdns_context *context, char *transport_list_str,
|
fill_transport_list(char *transport_list_str,
|
||||||
getdns_transport_list_t *transports, size_t *transport_count)
|
getdns_transport_list_t *transports, size_t *transport_count)
|
||||||
{
|
{
|
||||||
size_t max_transports = *transport_count;
|
size_t max_transports = *transport_count;
|
||||||
|
@ -334,6 +334,7 @@ void callback(getdns_context *context, getdns_callback_type_t callback_type,
|
||||||
getdns_dict *response, void *userarg, getdns_transaction_t trans_id)
|
getdns_dict *response, void *userarg, getdns_transaction_t trans_id)
|
||||||
{
|
{
|
||||||
char *response_str;
|
char *response_str;
|
||||||
|
(void)context; (void)userarg;
|
||||||
|
|
||||||
/* This is a callback with data */;
|
/* This is a callback with data */;
|
||||||
if (response && !quiet && (response_str = json ?
|
if (response && !quiet && (response_str = json ?
|
||||||
|
@ -475,7 +476,8 @@ static void parse_config(const char *config_str)
|
||||||
getdns_return_t parse_args(int argc, char **argv)
|
getdns_return_t parse_args(int argc, char **argv)
|
||||||
{
|
{
|
||||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
getdns_return_t r = GETDNS_RETURN_GOOD;
|
||||||
size_t i, j, klass;
|
size_t j;
|
||||||
|
int i, klass;
|
||||||
char *arg, *c, *endptr;
|
char *arg, *c, *endptr;
|
||||||
int t, print_api_info = 0, print_trust_anchors = 0;
|
int t, print_api_info = 0, print_trust_anchors = 0;
|
||||||
getdns_list *upstream_list = NULL;
|
getdns_list *upstream_list = NULL;
|
||||||
|
@ -622,7 +624,7 @@ getdns_return_t parse_args(int argc, char **argv)
|
||||||
}
|
}
|
||||||
rewind(fh);
|
rewind(fh);
|
||||||
if (fread(config_file, 1, config_file_sz, fh)
|
if (fread(config_file, 1, config_file_sz, fh)
|
||||||
!= config_file_sz) {
|
!= (size_t)config_file_sz) {
|
||||||
fprintf(stderr, "An error occurred whil"
|
fprintf(stderr, "An error occurred whil"
|
||||||
"e reading \"%s\": %s\n",argv[i],
|
"e reading \"%s\": %s\n",argv[i],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -913,7 +915,7 @@ getdns_return_t parse_args(int argc, char **argv)
|
||||||
}
|
}
|
||||||
getdns_transport_list_t transports[10];
|
getdns_transport_list_t transports[10];
|
||||||
size_t transport_count = sizeof(transports);
|
size_t transport_count = sizeof(transports);
|
||||||
if ((r = fill_transport_list(context, argv[i], transports, &transport_count)) ||
|
if ((r = fill_transport_list(argv[i], transports, &transport_count)) ||
|
||||||
(r = getdns_context_set_dns_transport_list(context,
|
(r = getdns_context_set_dns_transport_list(context,
|
||||||
transport_count, transports))){
|
transport_count, transports))){
|
||||||
fprintf(stderr, "Could not set transports\n");
|
fprintf(stderr, "Could not set transports\n");
|
||||||
|
@ -983,13 +985,13 @@ next: ;
|
||||||
if (pubkey_pinset && upstream_count) {
|
if (pubkey_pinset && upstream_count) {
|
||||||
getdns_dict *upstream;
|
getdns_dict *upstream;
|
||||||
/* apply the accumulated pubkey pinset to all upstreams: */
|
/* apply the accumulated pubkey pinset to all upstreams: */
|
||||||
for (i = 0; i < upstream_count; i++) {
|
for (j = 0; j < upstream_count; j++) {
|
||||||
if (r = getdns_list_get_dict(upstream_list, i, &upstream), r) {
|
if (r = getdns_list_get_dict(upstream_list, j, &upstream), r) {
|
||||||
fprintf(stderr, "Failed to get upstream "PRIsz" when adding pinset\n", i);
|
fprintf(stderr, "Failed to get upstream "PRIsz" when adding pinset\n", j);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if (r = getdns_dict_set_list(upstream, "tls_pubkey_pinset", pubkey_pinset), r) {
|
if (r = getdns_dict_set_list(upstream, "tls_pubkey_pinset", pubkey_pinset), r) {
|
||||||
fprintf(stderr, "Failed to set pubkey pinset on upstream "PRIsz"\n", i);
|
fprintf(stderr, "Failed to set pubkey pinset on upstream "PRIsz"\n", j);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1282,6 +1284,9 @@ static void request_cb(
|
||||||
getdns_return_t r = GETDNS_RETURN_GOOD;
|
getdns_return_t r = GETDNS_RETURN_GOOD;
|
||||||
uint32_t n, rcode, dnssec_status;
|
uint32_t n, rcode, dnssec_status;
|
||||||
|
|
||||||
|
#if !defined(SERVER_DEBUG) || !SERVER_DEBUG
|
||||||
|
(void)transaction_id;
|
||||||
|
#endif
|
||||||
DEBUG_SERVER("reply for: %p %"PRIu64" %d (edns0: %d, do: %d, ad: %d,"
|
DEBUG_SERVER("reply for: %p %"PRIu64" %d (edns0: %d, do: %d, ad: %d,"
|
||||||
" cd: %d)\n", msg, transaction_id, (int)callback_type,
|
" cd: %d)\n", msg, transaction_id, (int)callback_type,
|
||||||
msg->has_edns0, msg->do_bit, msg->ad_bit, msg->cd_bit);
|
msg->has_edns0, msg->do_bit, msg->ad_bit, msg->cd_bit);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "list.h" /* For _getdns_list_create_from_mf() */
|
#include "list.h" /* For _getdns_list_create_from_mf() */
|
||||||
#include "dict.h" /* For _getdns_dict_create_from_mf() */
|
#include "dict.h" /* For _getdns_dict_create_from_mf() */
|
||||||
#include <stdlib.h> /* For bsearch */
|
#include <stdlib.h> /* For bsearch */
|
||||||
|
#include <ctype.h> /* For isspace */
|
||||||
|
|
||||||
static struct mem_funcs _getdns_plain_mem_funcs = {
|
static struct mem_funcs _getdns_plain_mem_funcs = {
|
||||||
MF_PLAIN, .mf.pln = { malloc, realloc, free }
|
MF_PLAIN, .mf.pln = { malloc, realloc, free }
|
||||||
|
@ -102,7 +103,7 @@ static int _gldns_b64_pton(char const *src, uint8_t *target, size_t targsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getdns_dict *
|
static getdns_dict *
|
||||||
_getdns_ipaddr_dict_mf(struct mem_funcs *mf, char *ipstr)
|
_getdns_ipaddr_dict_mf(struct mem_funcs *mf, const char *ipstr)
|
||||||
{
|
{
|
||||||
getdns_dict *r = _getdns_dict_create_with_mf(mf);
|
getdns_dict *r = _getdns_dict_create_with_mf(mf);
|
||||||
char *s = strchr(ipstr, '%'), *scope_id_str = "";
|
char *s = strchr(ipstr, '%'), *scope_id_str = "";
|
||||||
|
@ -223,7 +224,7 @@ static int _jsmn_get_ipdict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
char value_str[3072];
|
char value_str[3072];
|
||||||
int size = t->end - t->start;
|
int size = t->end - t->start;
|
||||||
|
|
||||||
if (size <= 0 || size >= sizeof(value_str))
|
if (size <= 0 || size >= (int)sizeof(value_str))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
(void) memcpy(value_str, js + t->start, size);
|
(void) memcpy(value_str, js + t->start, size);
|
||||||
|
@ -236,7 +237,8 @@ static int _jsmn_get_ipdict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
static int _jsmn_get_data(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
static int _jsmn_get_data(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
getdns_bindata **value)
|
getdns_bindata **value)
|
||||||
{
|
{
|
||||||
size_t i, j;
|
int i;
|
||||||
|
size_t j;
|
||||||
uint8_t h, l;
|
uint8_t h, l;
|
||||||
|
|
||||||
if ((t->end - t->start) < 4 || (t->end - t->start) % 2 == 1 ||
|
if ((t->end - t->start) < 4 || (t->end - t->start) % 2 == 1 ||
|
||||||
|
@ -272,13 +274,13 @@ static int _jsmn_get_data(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _jsmn_get_dname(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
static int _jsmn_get_dname(const char *js, jsmntok_t *t,
|
||||||
getdns_bindata **value)
|
getdns_bindata **value)
|
||||||
{
|
{
|
||||||
char value_str[1025];
|
char value_str[1025];
|
||||||
int size = t->end - t->start;
|
int size = t->end - t->start;
|
||||||
|
|
||||||
if (size <= 0 || size >= sizeof(value_str) || js[t->end - 1] != '.')
|
if (size <= 0 || size >= (int)sizeof(value_str) || js[t->end - 1] != '.')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
(void) memcpy(value_str, js + t->start, size);
|
(void) memcpy(value_str, js + t->start, size);
|
||||||
|
@ -294,7 +296,7 @@ static int _jsmn_get_ipv4(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
int size = t->end - t->start;
|
int size = t->end - t->start;
|
||||||
uint8_t buf[4];
|
uint8_t buf[4];
|
||||||
|
|
||||||
if (size <= 0 || size >= sizeof(value_str))
|
if (size <= 0 || size >= (int)sizeof(value_str))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
(void) memcpy(value_str, js + t->start, size);
|
(void) memcpy(value_str, js + t->start, size);
|
||||||
|
@ -324,7 +326,7 @@ static int _jsmn_get_ipv6(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
int size = t->end - t->start;
|
int size = t->end - t->start;
|
||||||
uint8_t buf[16];
|
uint8_t buf[16];
|
||||||
|
|
||||||
if (size <= 0 || size >= sizeof(value_str))
|
if (size <= 0 || size >= (int)sizeof(value_str))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
(void) memcpy(value_str, js + t->start, size);
|
(void) memcpy(value_str, js + t->start, size);
|
||||||
|
@ -347,14 +349,13 @@ static int _jsmn_get_ipv6(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _jsmn_get_int(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
static int _jsmn_get_int(const char *js, jsmntok_t *t, uint32_t *value)
|
||||||
uint32_t *value)
|
|
||||||
{
|
{
|
||||||
char value_str[11];
|
char value_str[11];
|
||||||
int size = t->end - t->start;
|
int size = t->end - t->start;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
if (size <= 0 || size >= sizeof(value_str))
|
if (size <= 0 || size >= (int)sizeof(value_str))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
(void) memcpy(value_str, js + t->start, size);
|
(void) memcpy(value_str, js + t->start, size);
|
||||||
|
@ -366,13 +367,12 @@ static int _jsmn_get_int(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
|
|
||||||
static int _getdns_get_const_name_info(const char *name, uint32_t *code);
|
static int _getdns_get_const_name_info(const char *name, uint32_t *code);
|
||||||
|
|
||||||
static int _jsmn_get_const(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
static int _jsmn_get_const(const char *js, jsmntok_t *t, uint32_t *value)
|
||||||
uint32_t *value)
|
|
||||||
{
|
{
|
||||||
char value_str[80];
|
char value_str[80];
|
||||||
int size = t->end - t->start;
|
int size = t->end - t->start;
|
||||||
|
|
||||||
if (size <= 0 || size >= sizeof(value_str))
|
if (size <= 0 || size >= (int)sizeof(value_str))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
(void) memcpy(value_str, js + t->start, size);
|
(void) memcpy(value_str, js + t->start, size);
|
||||||
|
@ -406,7 +406,8 @@ static int _jsmn_get_item(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
static int _jsmn_get_dict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
static int _jsmn_get_dict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
size_t count, getdns_dict *dict, getdns_return_t *r)
|
size_t count, getdns_dict *dict, getdns_return_t *r)
|
||||||
{
|
{
|
||||||
size_t i, j = 1;
|
int i;
|
||||||
|
size_t j = 1;
|
||||||
char key_spc[1024], *key = NULL;
|
char key_spc[1024], *key = NULL;
|
||||||
getdns_item child_item;
|
getdns_item child_item;
|
||||||
|
|
||||||
|
@ -426,7 +427,7 @@ static int _jsmn_get_dict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
*r = GETDNS_RETURN_GENERIC_ERROR; /* range error */
|
*r = GETDNS_RETURN_GENERIC_ERROR; /* range error */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (t[j].end - t[j].start < sizeof(key_spc))
|
if (t[j].end - t[j].start < (int)sizeof(key_spc))
|
||||||
key = key_spc;
|
key = key_spc;
|
||||||
|
|
||||||
else if (!(key = GETDNS_XMALLOC(
|
else if (!(key = GETDNS_XMALLOC(
|
||||||
|
@ -484,7 +485,8 @@ static int _jsmn_get_dict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
static int _jsmn_get_list(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
static int _jsmn_get_list(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
size_t count, getdns_list *list, getdns_return_t *r)
|
size_t count, getdns_list *list, getdns_return_t *r)
|
||||||
{
|
{
|
||||||
size_t i, j = 1, index = 0;
|
int i;
|
||||||
|
size_t j = 1, index = 0;
|
||||||
getdns_item child_item;
|
getdns_item child_item;
|
||||||
|
|
||||||
if (t->size <= 0)
|
if (t->size <= 0)
|
||||||
|
@ -563,13 +565,13 @@ static int _jsmn_get_item(struct mem_funcs *mf, const char *js, jsmntok_t *t,
|
||||||
*r = GETDNS_RETURN_GENERIC_ERROR;
|
*r = GETDNS_RETURN_GENERIC_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else if (_jsmn_get_int(mf, js, t, &item->data.n)
|
} else if (_jsmn_get_int(js, t, &item->data.n)
|
||||||
|| _jsmn_get_const(mf, js, t, &item->data.n)) {
|
|| _jsmn_get_const(js, t, &item->data.n)) {
|
||||||
|
|
||||||
item->dtype = t_int;
|
item->dtype = t_int;
|
||||||
}
|
}
|
||||||
else if (_jsmn_get_data(mf, js, t, &item->data.bindata)
|
else if (_jsmn_get_data(mf, js, t, &item->data.bindata)
|
||||||
|| _jsmn_get_dname(mf, js, t, &item->data.bindata)
|
|| _jsmn_get_dname(js, t, &item->data.bindata)
|
||||||
|| _jsmn_get_ipv4(mf, js, t, &item->data.bindata)
|
|| _jsmn_get_ipv4(mf, js, t, &item->data.bindata)
|
||||||
|| _jsmn_get_ipv6(mf, js, t, &item->data.bindata))
|
|| _jsmn_get_ipv6(mf, js, t, &item->data.bindata))
|
||||||
|
|
||||||
|
@ -645,6 +647,17 @@ getdns_str2dict(const char *str, getdns_dict **dict)
|
||||||
getdns_item item;
|
getdns_item item;
|
||||||
getdns_return_t r;
|
getdns_return_t r;
|
||||||
|
|
||||||
|
while (*str && isspace(*str))
|
||||||
|
str++;
|
||||||
|
|
||||||
|
if (*str != '{') {
|
||||||
|
getdns_dict *dict_r = _getdns_ipaddr_dict_mf(
|
||||||
|
&_getdns_plain_mem_funcs, str);
|
||||||
|
if (dict_r) {
|
||||||
|
*dict = dict_r;
|
||||||
|
return GETDNS_RETURN_GOOD;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((r = _getdns_str2item_mf(&_getdns_plain_mem_funcs, str, &item)))
|
if ((r = _getdns_str2item_mf(&_getdns_plain_mem_funcs, str, &item)))
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ tst_getnames(void)
|
||||||
size_t index;
|
size_t index;
|
||||||
size_t llen;
|
size_t llen;
|
||||||
uint32_t ansint;
|
uint32_t ansint;
|
||||||
int i;
|
size_t i;
|
||||||
getdns_return_t result;
|
getdns_return_t result;
|
||||||
getdns_data_type dtype;
|
getdns_data_type dtype;
|
||||||
struct getdns_dict *dict = NULL;
|
struct getdns_dict *dict = NULL;
|
||||||
|
@ -508,7 +508,7 @@ tst_create(void)
|
||||||
* runs unit tests against list management routines
|
* runs unit tests against list management routines
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main()
|
||||||
{
|
{
|
||||||
tstmsg_prog_begin("tests_dict");
|
tstmsg_prog_begin("tests_dict");
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ tst_create(void)
|
||||||
* runs unit tests against list management routines
|
* runs unit tests against list management routines
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main()
|
||||||
{
|
{
|
||||||
tstmsg_prog_begin("tests_list");
|
tstmsg_prog_begin("tests_list");
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@ this_callbackfn(struct getdns_context *this_context,
|
||||||
struct getdns_dict *this_response,
|
struct getdns_dict *this_response,
|
||||||
void *this_userarg, getdns_transaction_t this_transaction_id)
|
void *this_userarg, getdns_transaction_t this_transaction_id)
|
||||||
{
|
{
|
||||||
|
(void)this_context; (void)this_userarg;
|
||||||
|
|
||||||
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
|
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
|
||||||
char *res = getdns_pretty_print_dict(this_response);
|
char *res = getdns_pretty_print_dict(this_response);
|
||||||
fprintf(stdout, "%s\n", res);
|
fprintf(stdout, "%s\n", res);
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
cd "${BUILDDIR}/build"
|
cd "${BUILDDIR}/build"
|
||||||
make
|
make XTRA_CFLAGS='-Werror'
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
cd "${BUILDDIR}/build-stub-only"
|
cd "${BUILDDIR}/build-stub-only"
|
||||||
make
|
make XTRA_CFLAGS='-Werror'
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
rm -fr "${BUILDDIR}/build-event-loops"
|
rm -fr "${BUILDDIR}/build-event-loops"
|
||||||
mkdir "${BUILDDIR}/build-event-loops"
|
mkdir "${BUILDDIR}/build-event-loops"
|
||||||
cd "${BUILDDIR}/build-event-loops"
|
cd "${BUILDDIR}/build-event-loops"
|
||||||
"${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent --with-libev --with-libuv \
|
"${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev --with-libuv \
|
||||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent --with-libev \
|
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libev \
|
||||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent --with-libuv \
|
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent --with-libuv \
|
||||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libev --with-libuv \
|
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev --with-libuv \
|
||||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libevent \
|
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libevent \
|
||||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libev \
|
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libev \
|
||||||
|| "${SRCROOT}/configure" $* --enable-all-drafts --enable-all-debugging --with-getdns_query --with-libuv
|
|| "${SRCROOT}/configure" $* --enable-all-drafts --with-getdns_query --with-libuv
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
BaseName: 315-event-loops-compile
|
||||||
|
Version: 1.0
|
||||||
|
Description: Compile
|
||||||
|
CreationDate: do 8 dec 2016 23:38:18 CET
|
||||||
|
Maintainer: Willem Toorop
|
||||||
|
Category:
|
||||||
|
Component:
|
||||||
|
CmdDepends:
|
||||||
|
Depends: 300-event-loops-configure.tpkg
|
||||||
|
Help:
|
||||||
|
Pre: 315-event-loops-compile.pre
|
||||||
|
Post: 315-event-loops-compile.post
|
||||||
|
Test: 315-event-loops-compile.test
|
||||||
|
AuxFiles:
|
||||||
|
Passed:
|
||||||
|
Failure:
|
|
@ -0,0 +1,20 @@
|
||||||
|
# #-- 315-event-loops-compile.post --#
|
||||||
|
# source the master var file when it's there
|
||||||
|
if [ -f ../.tpkg.var.master ]
|
||||||
|
then
|
||||||
|
source ../.tpkg.var.master
|
||||||
|
else
|
||||||
|
(
|
||||||
|
cd ..
|
||||||
|
[ -f "${TPKG_SRCDIR}/setup-env.sh" ] \
|
||||||
|
&& sh "${TPKG_SRCDIR}/setup-env.sh"
|
||||||
|
) && source ../.tpkg.var.master
|
||||||
|
fi
|
||||||
|
# use .tpkg.var.test for in test variable passing
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
|
for f in `cat restore-srcdir-configure-settings`
|
||||||
|
do
|
||||||
|
mv "${SRCROOT}/${f}.build-event-loops" "${SRCROOT}/${f}"
|
||||||
|
done
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
# #-- 315-event-loops-compile.pre--#
|
||||||
|
# source the master var file when it's there
|
||||||
|
if [ -f ../.tpkg.var.master ]
|
||||||
|
then
|
||||||
|
source ../.tpkg.var.master
|
||||||
|
else
|
||||||
|
(
|
||||||
|
cd ..
|
||||||
|
[ -f "${TPKG_SRCDIR}/setup-env.sh" ] \
|
||||||
|
&& sh "${TPKG_SRCDIR}/setup-env.sh"
|
||||||
|
) && source ../.tpkg.var.master
|
||||||
|
fi
|
||||||
|
# use .tpkg.var.test for in test variable passing
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
|
echo "" > restore-srcdir-configure-settings
|
||||||
|
for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'`
|
||||||
|
do
|
||||||
|
if [ -f "${SRCROOT}/$f" ]
|
||||||
|
then
|
||||||
|
mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build-event-loops" && \
|
||||||
|
echo "$f" >> restore-srcdir-configure-settings
|
||||||
|
fi
|
||||||
|
done
|
|
@ -0,0 +1,8 @@
|
||||||
|
# #-- 315-event-loops-compile.test --#
|
||||||
|
# source the master var file when it's there
|
||||||
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||||
|
# use .tpkg.var.test for in test variable passing
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
|
cd "${BUILDDIR}/build-event-loops"
|
||||||
|
make XTRA_CFLAGS='-Werror'
|
|
@ -5,4 +5,5 @@
|
||||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
cd "${BUILDDIR}/build-event-loops"
|
cd "${BUILDDIR}/build-event-loops"
|
||||||
|
make clean
|
||||||
make
|
make
|
||||||
|
|
|
@ -110,7 +110,7 @@ struct getdns_upstream;
|
||||||
#define GETDNS_STR_KEY_NSCOUNT "nscount"
|
#define GETDNS_STR_KEY_NSCOUNT "nscount"
|
||||||
#define GETDNS_STR_KEY_ARCOUNT "arcount"
|
#define GETDNS_STR_KEY_ARCOUNT "arcount"
|
||||||
|
|
||||||
#define TIMEOUT_FOREVER ((int64_t)-1)
|
#define TIMEOUT_FOREVER ((uint64_t)0xFFFFFFFFFFFFFFFF)
|
||||||
#define ASSERT_UNREACHABLE 0
|
#define ASSERT_UNREACHABLE 0
|
||||||
|
|
||||||
#define GETDNS_TRANSPORTS_MAX 3
|
#define GETDNS_TRANSPORTS_MAX 3
|
||||||
|
@ -278,29 +278,29 @@ typedef struct getdns_dns_req {
|
||||||
getdns_append_name_t append_name;
|
getdns_append_name_t append_name;
|
||||||
const uint8_t *suffix;
|
const uint8_t *suffix;
|
||||||
size_t suffix_len;
|
size_t suffix_len;
|
||||||
int suffix_appended : 1;
|
unsigned suffix_appended : 1;
|
||||||
|
|
||||||
/* canceled flag */
|
/* canceled flag */
|
||||||
int canceled : 1;
|
unsigned canceled : 1;
|
||||||
|
|
||||||
/* request extensions */
|
/* request extensions */
|
||||||
int dnssec_return_status : 1;
|
unsigned dnssec_return_status : 1;
|
||||||
int dnssec_return_only_secure : 1;
|
unsigned dnssec_return_only_secure : 1;
|
||||||
int dnssec_return_all_statuses : 1;
|
unsigned dnssec_return_all_statuses : 1;
|
||||||
int dnssec_return_validation_chain : 1;
|
unsigned dnssec_return_validation_chain : 1;
|
||||||
int dnssec_return_full_validation_chain : 1;
|
unsigned dnssec_return_full_validation_chain : 1;
|
||||||
#ifdef DNSSEC_ROADBLOCK_AVOIDANCE
|
#ifdef DNSSEC_ROADBLOCK_AVOIDANCE
|
||||||
int dnssec_roadblock_avoidance : 1;
|
unsigned dnssec_roadblock_avoidance : 1;
|
||||||
int avoid_dnssec_roadblocks : 1;
|
unsigned avoid_dnssec_roadblocks : 1;
|
||||||
#endif
|
#endif
|
||||||
int edns_cookies : 1;
|
unsigned edns_cookies : 1;
|
||||||
int edns_client_subnet_private : 1;
|
unsigned edns_client_subnet_private : 1;
|
||||||
int return_call_reporting : 1;
|
unsigned return_call_reporting : 1;
|
||||||
int add_warning_for_bad_dns : 1;
|
unsigned add_warning_for_bad_dns : 1;
|
||||||
|
|
||||||
/* Internally used by return_validation_chain */
|
/* Internally used by return_validation_chain */
|
||||||
int dnssec_ok_checking_disabled : 1;
|
unsigned dnssec_ok_checking_disabled : 1;
|
||||||
int is_sync_request : 1;
|
unsigned is_sync_request : 1;
|
||||||
|
|
||||||
/* The validating and freed variables are used to make sure a single
|
/* The validating and freed variables are used to make sure a single
|
||||||
* code path is followed while processing a DNS request, even when
|
* code path is followed while processing a DNS request, even when
|
||||||
|
@ -310,7 +310,7 @@ typedef struct getdns_dns_req {
|
||||||
* validating is touched by _getdns_get_validation_chain only and
|
* validating is touched by _getdns_get_validation_chain only and
|
||||||
* freed is touched by _getdns_submit_netreq only
|
* freed is touched by _getdns_submit_netreq only
|
||||||
*/
|
*/
|
||||||
int validating : 1;
|
unsigned validating : 1;
|
||||||
int *freed;
|
int *freed;
|
||||||
|
|
||||||
uint16_t tls_query_padding_blocksize;
|
uint16_t tls_query_padding_blocksize;
|
||||||
|
|
|
@ -115,9 +115,9 @@ typedef struct my_event {
|
||||||
} my_event;
|
} my_event;
|
||||||
|
|
||||||
#define AS_UB_LOOP(x) \
|
#define AS_UB_LOOP(x) \
|
||||||
(((union {struct ub_event_base* a; _getdns_ub_loop* b;})x).b)
|
((_getdns_ub_loop *)(x))
|
||||||
#define AS_MY_EVENT(x) \
|
#define AS_MY_EVENT(x) \
|
||||||
(((union {struct ub_event* a; my_event* b;})x).b)
|
((my_event *)(x))
|
||||||
|
|
||||||
static void my_event_base_free(struct ub_event_base* base)
|
static void my_event_base_free(struct ub_event_base* base)
|
||||||
{
|
{
|
||||||
|
@ -353,6 +353,7 @@ static int my_timer_del(struct ub_event* ev)
|
||||||
|
|
||||||
static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
|
static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
|
||||||
{
|
{
|
||||||
|
(void)ub_ev; (void)tv;
|
||||||
/* Only unbound daaemon workers use signals */
|
/* Only unbound daaemon workers use signals */
|
||||||
DEBUG_SCHED("UB_LOOP ERROR: signal_add()\n");
|
DEBUG_SCHED("UB_LOOP ERROR: signal_add()\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -360,6 +361,7 @@ static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
|
||||||
|
|
||||||
static int my_signal_del(struct ub_event* ub_ev)
|
static int my_signal_del(struct ub_event* ub_ev)
|
||||||
{
|
{
|
||||||
|
(void)ub_ev;
|
||||||
/* Only unbound daaemon workers use signals */
|
/* Only unbound daaemon workers use signals */
|
||||||
DEBUG_SCHED("UB_LOOP ERROR: signal_del()\n");
|
DEBUG_SCHED("UB_LOOP ERROR: signal_del()\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -412,7 +414,7 @@ static struct ub_event* my_event_new(struct ub_event_base* base, int fd,
|
||||||
ev->added = 0;
|
ev->added = 0;
|
||||||
ev->fd = fd;
|
ev->fd = fd;
|
||||||
ev->bits = bits;
|
ev->bits = bits;
|
||||||
ev->timeout = (uint64_t)-1;
|
ev->timeout = TIMEOUT_FOREVER;
|
||||||
ev->cb = cb;
|
ev->cb = cb;
|
||||||
ev->arg = arg;
|
ev->arg = arg;
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
|
|
|
@ -890,7 +890,7 @@ static int _srv_cmp(const void *a, const void *b)
|
||||||
|
|
||||||
static void _rfc2782_sort(_srv_rr *start, _srv_rr *end)
|
static void _rfc2782_sort(_srv_rr *start, _srv_rr *end)
|
||||||
{
|
{
|
||||||
unsigned int running_sum, n;
|
uint32_t running_sum, n;
|
||||||
_srv_rr *i, *j, swap;
|
_srv_rr *i, *j, swap;
|
||||||
|
|
||||||
/* First move all SRVs with weight 0 to the beginning of the list */
|
/* First move all SRVs with weight 0 to the beginning of the list */
|
||||||
|
@ -1253,6 +1253,8 @@ getdns_return_t
|
||||||
getdns_apply_network_result(getdns_network_req* netreq,
|
getdns_apply_network_result(getdns_network_req* netreq,
|
||||||
int rcode, void *pkt, int pkt_len, int sec, char* why_bogus)
|
int rcode, void *pkt, int pkt_len, int sec, char* why_bogus)
|
||||||
{
|
{
|
||||||
|
(void)why_bogus;
|
||||||
|
|
||||||
netreq->dnssec_status = sec == 0 ? GETDNS_DNSSEC_INSECURE
|
netreq->dnssec_status = sec == 0 ? GETDNS_DNSSEC_INSECURE
|
||||||
: sec == 2 ? GETDNS_DNSSEC_SECURE
|
: sec == 2 ? GETDNS_DNSSEC_SECURE
|
||||||
: GETDNS_DNSSEC_BOGUS;
|
: GETDNS_DNSSEC_BOGUS;
|
||||||
|
|
Loading…
Reference in New Issue