mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'features/yaml' of https://github.com/banburybill/getdns into features/yaml
This commit is contained in:
commit
8fab939d2c
|
@ -8,6 +8,7 @@ addons:
|
||||||
packages:
|
packages:
|
||||||
- libunbound-dev
|
- libunbound-dev
|
||||||
- libidn11-dev
|
- libidn11-dev
|
||||||
|
- libyaml-dev
|
||||||
- check
|
- check
|
||||||
- libevent-dev
|
- libevent-dev
|
||||||
- libev-dev
|
- libev-dev
|
||||||
|
|
|
@ -72,6 +72,7 @@ External dependencies are linked outside the getdns API build tree (we rely on c
|
||||||
* [libunbound from NLnet Labs](https://unbound.net/) version 1.4.16 or later.
|
* [libunbound from NLnet Labs](https://unbound.net/) version 1.4.16 or later.
|
||||||
* [libidn from the FSF](https://www.gnu.org/software/libidn/) version 1. (Note that the libidn version means the conversions between A-labels and U-labels may permit conversion of formally invalid labels under IDNA2008.)
|
* [libidn from the FSF](https://www.gnu.org/software/libidn/) version 1. (Note that the libidn version means the conversions between A-labels and U-labels may permit conversion of formally invalid labels under IDNA2008.)
|
||||||
* [libssl and libcrypto from the OpenSSL Project](https://www.openssl.org/) version 0.9.7 or later. (Note: version 1.0.1 or later is required for TLS support, version 1.0.2 or later is required for TLS hostname authentication)
|
* [libssl and libcrypto from the OpenSSL Project](https://www.openssl.org/) version 0.9.7 or later. (Note: version 1.0.1 or later is required for TLS support, version 1.0.2 or later is required for TLS hostname authentication)
|
||||||
|
* [libyaml](http://pyyaml.org/wiki/LibYAML) version 0.1.6 or later.
|
||||||
* Doxygen is used to generate documentation; while this is not technically necessary for the build it makes things a lot more pleasant.
|
* Doxygen is used to generate documentation; while this is not technically necessary for the build it makes things a lot more pleasant.
|
||||||
|
|
||||||
For example, to build on a recent version of Ubuntu, you would need the following packages:
|
For example, to build on a recent version of Ubuntu, you would need the following packages:
|
||||||
|
@ -99,6 +100,7 @@ Note: If you only want to build stubby, then use the `--with-stubby` option when
|
||||||
|
|
||||||
* getdns can be configured for stub resolution mode only with the `--enable-stub-only` option to configure. This removes the dependency on `libunbound`.
|
* getdns can be configured for stub resolution mode only with the `--enable-stub-only` option to configure. This removes the dependency on `libunbound`.
|
||||||
* Currently getdns only offers two helper functions to deal with IDN: `getdns_convert_ulabel_to_alabel` and `getdns_convert_alabel_to_ulabel`. If you do not need these functions, getdns can be configured to compile without them with the `--without-libidn` option to configure.
|
* Currently getdns only offers two helper functions to deal with IDN: `getdns_convert_ulabel_to_alabel` and `getdns_convert_alabel_to_ulabel`. If you do not need these functions, getdns can be configured to compile without them with the `--without-libidn` option to configure.
|
||||||
|
* getdns can be configured to not support YAML configuration with the `--disable-yaml-config` option to configure. This removes the dependency on `libyaml`.
|
||||||
* When both `--enable-stub-only` and `--without-libidn` options are used, getdns has only one dependency left, which is OpenSSL.
|
* When both `--enable-stub-only` and `--without-libidn` options are used, getdns has only one dependency left, which is OpenSSL.
|
||||||
|
|
||||||
## Extensions and Event loop dependencies
|
## Extensions and Event loop dependencies
|
||||||
|
|
|
@ -1821,8 +1821,8 @@ getdns_yaml2dict(const char *str, getdns_dict **dict)
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
#else /* USE_YAML_CONFIG */
|
#else /* USE_YAML_CONFIG */
|
||||||
str = str;
|
(void) str;
|
||||||
dict = dict;
|
(void) dict;
|
||||||
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
||||||
#endif /* USE_YAML_CONFIG */
|
#endif /* USE_YAML_CONFIG */
|
||||||
}
|
}
|
||||||
|
@ -1845,8 +1845,8 @@ getdns_yaml2list(const char *str, getdns_list **list)
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
#else /* USE_YAML_CONFIG */
|
#else /* USE_YAML_CONFIG */
|
||||||
str = str;
|
(void) str;
|
||||||
list = list;
|
(void) list;
|
||||||
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
||||||
#endif /* USE_YAML_CONFIG */
|
#endif /* USE_YAML_CONFIG */
|
||||||
}
|
}
|
||||||
|
@ -1869,8 +1869,8 @@ getdns_yaml2bindata(const char *str, getdns_bindata **bindata)
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
#else /* USE_YAML_CONFIG */
|
#else /* USE_YAML_CONFIG */
|
||||||
str = str;
|
(void) str;
|
||||||
bindata = bindata;
|
(void) bindata;
|
||||||
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
||||||
#endif /* USE_YAML_CONFIG */
|
#endif /* USE_YAML_CONFIG */
|
||||||
}
|
}
|
||||||
|
@ -1893,8 +1893,8 @@ getdns_yaml2int(const char *str, uint32_t *value)
|
||||||
return GETDNS_RETURN_GENERIC_ERROR;
|
return GETDNS_RETURN_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
#else /* USE_YAML_CONFIG */
|
#else /* USE_YAML_CONFIG */
|
||||||
str = str;
|
(void) str;
|
||||||
value = value;
|
(void) value;
|
||||||
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
return GETDNS_RETURN_NOT_IMPLEMENTED;
|
||||||
#endif /* USE_YAML_CONFIG */
|
#endif /* USE_YAML_CONFIG */
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
builddir = @BUILDDIR@
|
||||||
|
testname = @TPKG_NAME@
|
||||||
|
LIBTOOL = $(builddir)/libtool
|
||||||
|
|
||||||
|
CFLAGS=-I$(builddir)/src
|
||||||
|
LDLIBS=$(builddir)/src/libgetdns.la
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o .a .lo .h
|
||||||
|
|
||||||
|
.c.lo:
|
||||||
|
$(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(testname): $(testname).lo
|
||||||
|
$(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <getdns/getdns.h>
|
||||||
|
#include <getdns/getdns_extra.h>
|
||||||
|
|
||||||
|
int main(int ac, char *av[])
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
char *buf = NULL;
|
||||||
|
size_t len;
|
||||||
|
ssize_t bytes_read;
|
||||||
|
|
||||||
|
f = fopen(av[1], "r");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Could not open %s", av[1]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes_read = getdelim(&buf, &len, '\0', f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
if (bytes_read == -1) {
|
||||||
|
fprintf(stderr, "Could not read %s", av[1]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = realloc(buf, bytes_read + 1);
|
||||||
|
if (!buf) {
|
||||||
|
fprintf(stderr, "Could not grow buffer");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
buf[bytes_read] = '\0';
|
||||||
|
|
||||||
|
getdns_dict *dict = NULL;
|
||||||
|
getdns_return_t r;
|
||||||
|
|
||||||
|
if (!(dict = getdns_dict_create())) {
|
||||||
|
fprintf(stderr, "Could not create dict");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
r = getdns_yaml2dict(buf, &dict);
|
||||||
|
if (r) {
|
||||||
|
fprintf(stderr, "Error setting dict data: %s", getdns_get_errorstr_by_id(r));
|
||||||
|
getdns_dict_destroy(dict);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *dict_str = getdns_pretty_print_dict(dict);
|
||||||
|
if (!dict_str) {
|
||||||
|
fprintf(stderr, "Could not convert dict to string");
|
||||||
|
getdns_dict_destroy(dict);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s\n", dict_str);
|
||||||
|
free(dict_str);
|
||||||
|
getdns_dict_destroy(dict);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
BaseName: 255-yaml-config
|
||||||
|
Version: 1.0
|
||||||
|
Description: Test YAML configuration
|
||||||
|
CreationDate: Wed 13 Sep 2017 12:42:32 BST
|
||||||
|
Maintainer: Jim Hague
|
||||||
|
Category:
|
||||||
|
Component:
|
||||||
|
CmdDepends:
|
||||||
|
Depends: 200-stub-only-compile.tpkg
|
||||||
|
Help:
|
||||||
|
Pre: 255-yaml-config.pre
|
||||||
|
Post:
|
||||||
|
Test: 255-yaml-config.test
|
||||||
|
AuxFiles:
|
||||||
|
Passed:
|
||||||
|
Failure:
|
|
@ -0,0 +1,80 @@
|
||||||
|
{
|
||||||
|
"dnssec_return_status": 1000,
|
||||||
|
"upstream_recursive_servers":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 145.100.185.15>,
|
||||||
|
"tls_auth_name": <bindata of "dnsovertls.sinodun.com">,
|
||||||
|
"tls_pubkey_pinset":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"digest": <bindata of "sha256">,
|
||||||
|
"value": <bindata of 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 145.100.185.16>,
|
||||||
|
"tls_auth_name": <bindata of "dnsovertls1.sinodun.com">,
|
||||||
|
"tls_pubkey_pinset":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"digest": <bindata of "sha256">,
|
||||||
|
"value": <bindata of cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 185.49.141.37>,
|
||||||
|
"tls_auth_name": <bindata of "getdnsapi.net">,
|
||||||
|
"tls_pubkey_pinset":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"digest": <bindata of "sha256">,
|
||||||
|
"value": <bindata of foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 184.105.193.78>,
|
||||||
|
"tls_auth_name": <bindata of "unicast.censurfridns.dk">
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 2001:610:1:40ba:145:100:185:15>,
|
||||||
|
"tls_auth_name": <bindata of "dnsovertls.sinodun.com">,
|
||||||
|
"tls_pubkey_pinset":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"digest": <bindata of "sha256">,
|
||||||
|
"value": <bindata of 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 2001:610:1:40ba:145:100:185:16>,
|
||||||
|
"tls_auth_name": <bindata of "dnsovertls1.sinodun.com">,
|
||||||
|
"tls_pubkey_pinset":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"digest": <bindata of "sha256">,
|
||||||
|
"value": <bindata of cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 2a04:b900:0:100::38>,
|
||||||
|
"tls_auth_name": <bindata of "getdnsapi.net">,
|
||||||
|
"tls_pubkey_pinset":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"digest": <bindata of "sha256">,
|
||||||
|
"value": <bindata of foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address_data": <bindata for 2620:ff:c000:0:1:0:64:25>,
|
||||||
|
"tls_auth_name": <bindata of "unicast.censurfridns.dk">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
upstream_recursive_servers:
|
||||||
|
# IPv4 addresses
|
||||||
|
# The Surfnet/Sinodun servers
|
||||||
|
- address_data: 145.100.185.15
|
||||||
|
tls_auth_name: "dnsovertls.sinodun.com"
|
||||||
|
tls_pubkey_pinset:
|
||||||
|
- digest: "sha256"
|
||||||
|
value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
|
||||||
|
- address_data: 145.100.185.16
|
||||||
|
tls_auth_name: "dnsovertls1.sinodun.com"
|
||||||
|
tls_pubkey_pinset:
|
||||||
|
- digest: "sha256"
|
||||||
|
value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
|
||||||
|
# The getdnsapi.net server
|
||||||
|
- address_data: 185.49.141.37
|
||||||
|
tls_auth_name: "getdnsapi.net"
|
||||||
|
tls_pubkey_pinset:
|
||||||
|
- digest: "sha256"
|
||||||
|
value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
|
||||||
|
# The uncensored DNS servers (no SPKI available)
|
||||||
|
- address_data: 184.105.193.78
|
||||||
|
tls_auth_name: "unicast.censurfridns.dk"
|
||||||
|
# IPv6 addresses
|
||||||
|
# The Surfnet/Sinodun servers
|
||||||
|
- address_data: 2001:610:1:40ba:145:100:185:15
|
||||||
|
tls_auth_name: "dnsovertls.sinodun.com"
|
||||||
|
tls_pubkey_pinset:
|
||||||
|
- digest: "sha256"
|
||||||
|
value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
|
||||||
|
- address_data: 2001:610:1:40ba:145:100:185:16
|
||||||
|
tls_auth_name: "dnsovertls1.sinodun.com"
|
||||||
|
tls_pubkey_pinset:
|
||||||
|
- digest: "sha256"
|
||||||
|
value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
|
||||||
|
# The getdnsapi.net server
|
||||||
|
- address_data: 2a04:b900:0:100::38
|
||||||
|
tls_auth_name: "getdnsapi.net"
|
||||||
|
tls_pubkey_pinset:
|
||||||
|
- digest: "sha256"
|
||||||
|
value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
|
||||||
|
# The uncensored DNS server (no SPKI available)
|
||||||
|
- address_data: 2620:ff:c000:0:1::64:25
|
||||||
|
tls_auth_name: "unicast.censurfridns.dk"
|
||||||
|
|
||||||
|
# Require DNSSEC validation. For releases earlier than 1.2 a trust anchor must
|
||||||
|
# be configured configured manually. This can be done with unbound-anchor.
|
||||||
|
dnssec_return_status: GETDNS_EXTENSION_TRUE
|
|
@ -0,0 +1,14 @@
|
||||||
|
# #-- 255-yaml-config.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
|
||||||
|
|
||||||
|
(
|
||||||
|
grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile"
|
||||||
|
grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile"
|
||||||
|
|
||||||
|
BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'`
|
||||||
|
sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \
|
||||||
|
-e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile"
|
||||||
|
) > Makefile
|
|
@ -0,0 +1,7 @@
|
||||||
|
# #-- 255-yaml-config.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
|
||||||
|
|
||||||
|
make && "./${TPKG_NAME}" 255-yaml-config.input | tee out && diff out "${TPKG_NAME}.good"
|
|
@ -858,9 +858,10 @@ echo "--------------- Test Output ------------------" | write_result result.$dsc
|
||||||
pre
|
pre
|
||||||
|
|
||||||
out "[log] Executing test"
|
out "[log] Executing test"
|
||||||
|
( ${SHELL} $dsc_test ${TPKG_ARGS} 2>&1 ) > result.$dsc_basename.tmp
|
||||||
( ${SHELL} $dsc_test ${TPKG_ARGS} 2>&1 ) | write_result result.$dsc_basename
|
|
||||||
test_result=$?
|
test_result=$?
|
||||||
|
write_result result.$dsc_basename < result.$dsc_basename.tmp
|
||||||
|
rm -f result.$dsc_basename.tmp
|
||||||
epoch # would like to run after post, but that is not possible :-(
|
epoch # would like to run after post, but that is not possible :-(
|
||||||
if [ $test_result -ne 0 ]; then
|
if [ $test_result -ne 0 ]; then
|
||||||
err "[warning] Test executed with errors: $test_result."
|
err "[warning] Test executed with errors: $test_result."
|
||||||
|
|
Loading…
Reference in New Issue