diff options
Diffstat (limited to 'src/common/dns_utils.cpp')
-rw-r--r-- | src/common/dns_utils.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index 346761e74..8c4038568 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -31,6 +31,10 @@ #include <sstream> #include <unbound.h> +#include <stdlib.h> +#include "include_base_utils.h" +using namespace epee; + namespace tools { @@ -118,9 +122,11 @@ DNSResolver::~DNSResolver() } } -std::vector<std::string> DNSResolver::get_ipv4(const std::string& url) +std::vector<std::string> DNSResolver::get_ipv4(const std::string& url, bool& dnssec_available, bool& dnssec_valid) { std::vector<std::string> addresses; + dnssec_available = false; + dnssec_valid = false; char urlC[1000]; // waaaay too big, but just in case... strncpy(urlC, url.c_str(), 999); @@ -148,9 +154,11 @@ std::vector<std::string> DNSResolver::get_ipv4(const std::string& url) return addresses; } -std::vector<std::string> DNSResolver::get_ipv6(const std::string& url) +std::vector<std::string> DNSResolver::get_ipv6(const std::string& url, bool& dnssec_available, bool& dnssec_valid) { std::vector<std::string> addresses; + dnssec_available = false; + dnssec_valid = false; char urlC[1000]; // waaaay too big, but just in case... strncpy(urlC, url.c_str(), 999); @@ -178,9 +186,11 @@ std::vector<std::string> DNSResolver::get_ipv6(const std::string& url) return addresses; } -std::vector<std::string> DNSResolver::get_txt_record(const std::string& url) +std::vector<std::string> DNSResolver::get_txt_record(const std::string& url, bool& dnssec_available, bool& dnssec_valid) { std::vector<std::string> records; + dnssec_available = false; + dnssec_valid = false; char urlC[1000]; // waaaay too big, but just in case... strncpy(urlC, url.c_str(), 999); @@ -200,7 +210,11 @@ std::vector<std::string> DNSResolver::get_txt_record(const std::string& url) { for (size_t i=0; result.ptr->data[i] != NULL; i++) { - records.push_back(result.ptr->data[i]); + // plz fix this, but this does NOT work and spills over into parts of memory it shouldn't: records.push_back(result.ptr->data[i]); + char *restxt; + restxt = (char*) calloc(result.ptr->len[i]+1, 1); + memcpy(restxt, result.ptr->data[i]+1, result.ptr->len[i]-1); + records.push_back(restxt); } } } |