From 68d92dacec4680cc20ad7a06d1ec271cadc98348 Mon Sep 17 00:00:00 2001 From: Melinda Shore Date: Thu, 16 Apr 2015 13:38:45 -0800 Subject: [PATCH] Added provisional support for TLS transport --- context.c | 4 ++++ getdns.c | 4 ++++ setup.py | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/context.c b/context.c index 14f9903..c8e2e17 100644 --- a/context.c +++ b/context.c @@ -141,7 +141,11 @@ context_set_dns_transport(getdns_context *context, PyObject *py_value) return -1; } if ((value < GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP) || +#if defined(WITH_TLS) + (value > GETDNS_TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN)) { +#else (value > GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN)) { +#endif PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } diff --git a/getdns.c b/getdns.c index 3a2894d..ef73c93 100644 --- a/getdns.c +++ b/getdns.c @@ -329,6 +329,10 @@ initgetdns(void) PyModule_AddIntConstant(g, "TRANSPORT_UDP_ONLY", 541); PyModule_AddIntConstant(g, "TRANSPORT_TCP_ONLY", 542); PyModule_AddIntConstant(g, "TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN", 543); +#if defined(WITH_TLS) + PyModule_AddIntConstant(g, "TRANSPORT_TLS_ONLY_KEEP_CONNECTIONS_OPEN", 544); + PyModule_AddIntConstant(g, "TRANSPORT_TLS_FIRST_AND_FALL_BACK_TO_TCP_KEEP_CONNECTIONS_OPEN", 545); +#endif /* * suffix appending methods diff --git a/setup.py b/setup.py index e069598..bcb8e88 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,10 @@ CFLAGS.append('-DWITH_EDNS_COOKIES') sys.argv.remove('--with-edns-cookies') +if '--with-tls' in sys.argv: + CFLAGS.append('-DWITH_TLS') + sys.argv.remove('--with-tls') + getdns_module = Extension('getdns', include_dirs = [ '/usr/local/include', ], libraries = [ 'ldns', 'getdns', 'getdns_ext_event', 'event' ],