mirror of https://github.com/getdnsapi/getdns.git
Some tests imply TLS. Explicitly make sure these always go over TLS.
This commit is contained in:
parent
77a5a15cdf
commit
cb7af33488
|
@ -786,15 +786,16 @@ static exit_value_t test_qname_minimisation(const struct test_info_s *test_info,
|
||||||
static struct test_funcs_s
|
static struct test_funcs_s
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
bool implies_tls;
|
||||||
exit_value_t (*func)(const struct test_info_s *test_info, char **av);
|
exit_value_t (*func)(const struct test_info_s *test_info, char **av);
|
||||||
} TESTS[] =
|
} TESTS[] =
|
||||||
{
|
{
|
||||||
{ "lookup", test_lookup },
|
{ "lookup", false, test_lookup },
|
||||||
{ "rtt", test_rtt },
|
{ "rtt", false, test_rtt },
|
||||||
{ "auth", test_authenticate },
|
{ "auth", true, test_authenticate },
|
||||||
{ "cert-valid", test_certificate_valid },
|
{ "cert-valid", true, test_certificate_valid },
|
||||||
{ "qname-min", test_qname_minimisation },
|
{ "qname-min", false, test_qname_minimisation },
|
||||||
{ NULL, NULL }
|
{ NULL, false, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int ATTR_UNUSED(ac), char *av[])
|
int main(int ATTR_UNUSED(ac), char *av[])
|
||||||
|
@ -955,17 +956,6 @@ int main(int ATTR_UNUSED(ac), char *av[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set other context parameters. */
|
/* Set other context parameters. */
|
||||||
if (use_tls) {
|
|
||||||
getdns_transport_list_t t[] = { GETDNS_TRANSPORT_TLS };
|
|
||||||
if ((ret = getdns_context_set_dns_transport_list(test_info.context, 1, t)) != GETDNS_RETURN_GOOD) {
|
|
||||||
fprintf(test_info.errout,
|
|
||||||
"Unable to set TLS transport: %s (%d)\n",
|
|
||||||
getdns_get_errorstr_by_id(ret),
|
|
||||||
ret);
|
|
||||||
exit(EXIT_UNKNOWN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strict_usage_profile) {
|
if (strict_usage_profile) {
|
||||||
ret = getdns_context_set_tls_authentication(test_info.context, GETDNS_AUTHENTICATION_REQUIRED);
|
ret = getdns_context_set_tls_authentication(test_info.context, GETDNS_AUTHENTICATION_REQUIRED);
|
||||||
if (ret != GETDNS_RETURN_GOOD) {
|
if (ret != GETDNS_RETURN_GOOD) {
|
||||||
|
@ -984,10 +974,28 @@ int main(int ATTR_UNUSED(ac), char *av[])
|
||||||
usage();
|
usage();
|
||||||
++av;
|
++av;
|
||||||
|
|
||||||
for (const struct test_funcs_s *f = TESTS;
|
const struct test_funcs_s *f;
|
||||||
f->name != NULL;
|
for (f = TESTS; f->name != NULL; ++f) {
|
||||||
++f) {
|
if (strcmp(testname, f->name) == 0)
|
||||||
if (strcmp(testname, f->name) == 0) {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f->name == NULL) {
|
||||||
|
fprintf(test_info.errout, "Unknown test %s\n", testname);
|
||||||
|
exit(EXIT_UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (use_tls || f->implies_tls) {
|
||||||
|
getdns_transport_list_t t[] = { GETDNS_TRANSPORT_TLS };
|
||||||
|
if ((ret = getdns_context_set_dns_transport_list(test_info.context, 1, t)) != GETDNS_RETURN_GOOD) {
|
||||||
|
fprintf(test_info.errout,
|
||||||
|
"Unable to set TLS transport: %s (%d)\n",
|
||||||
|
getdns_get_errorstr_by_id(ret),
|
||||||
|
ret);
|
||||||
|
exit(EXIT_UNKNOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exit_value_t xit = f->func(&test_info, av);
|
exit_value_t xit = f->func(&test_info, av);
|
||||||
switch(xit) {
|
switch(xit) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -1010,7 +1018,3 @@ int main(int ATTR_UNUSED(ac), char *av[])
|
||||||
fputc('\n', test_info.errout);
|
fputc('\n', test_info.errout);
|
||||||
exit(xit);
|
exit(xit);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fprintf(test_info.errout, "Unknown test %s\n", testname);
|
|
||||||
exit(EXIT_UNKNOWN);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue