aboutsummaryrefslogtreecommitdiff
path: root/src/common/dns_utils.cpp
diff options
context:
space:
mode:
authorrfree2monero <rfreemonero@op.pl>2015-04-01 19:00:45 +0200
committerrfree2monero <rfreemonero@op.pl>2015-04-01 19:00:45 +0200
commitc511abf0058b8c1d020255faaad418b0ffd2eb26 (patch)
tree26c4cd88d16e79d5dc59fb3bfc43d399fb2239a3 /src/common/dns_utils.cpp
parentMerge remote-tracking branch 'monero-official/master' into network-1.6-work1 (diff)
downloadmonero-c511abf0058b8c1d020255faaad418b0ffd2eb26.tar.xz
remerged; commands JSON. logging upgrade. doxygen
Diffstat (limited to '')
-rw-r--r--src/common/dns_utils.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp
index 4ab93cce8..38b880231 100644
--- a/src/common/dns_utils.cpp
+++ b/src/common/dns_utils.cpp
@@ -168,7 +168,24 @@ DNSResolver::DNSResolver() : m_data(new DNSResolverData())
ub_ctx_resolvconf(m_data->m_ub_context, &empty_string);
ub_ctx_hosts(m_data->m_ub_context, &empty_string);
- ub_ctx_add_ta(m_data->m_ub_context, ::get_builtin_ds());
+ #ifdef DEVELOPER_LIBUNBOUND_OLD
+ #warning "Using the work around for old libunbound"
+ { // work around for bug https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=515 needed for it to compile on e.g. Debian 7
+ char * ds_copy = NULL; // this will be the writable copy of string that bugged version of libunbound requires
+ try {
+ char * ds_copy = strdup( ::get_builtin_ds() );
+ ub_ctx_add_ta(m_data->m_ub_context, ds_copy);
+ } catch(...) { // probably not needed but to work correctly in every case...
+ if (ds_copy) { free(ds_copy); ds_copy=NULL; } // for the strdup
+ throw ;
+ }
+ if (ds_copy) { free(ds_copy); ds_copy=NULL; } // for the strdup
+ }
+ #else
+ // normal version for fixed libunbound
+ ub_ctx_add_ta(m_data->m_ub_context, ::get_builtin_ds() );
+ #endif
+
}
DNSResolver::~DNSResolver()