diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-09-17 17:38:54 -0400 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-09-23 22:58:28 +0200 |
commit | c14c7e16839b6cfe32527f2b01a9a1507e3d419e (patch) | |
tree | 519980c3d1e09f7e29ae6002d30d0126f1b4a8c4 /src/common/dns_utils.cpp | |
parent | Simplewallet should now resolve urls to addresses (diff) | |
download | monero-c14c7e16839b6cfe32527f2b01a9a1507e3d419e.tar.xz |
change to allow (at least a bit) for multiple TXT records
Diffstat (limited to 'src/common/dns_utils.cpp')
-rw-r--r-- | src/common/dns_utils.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index 2ad98ca27..6755a30b2 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -89,7 +89,7 @@ std::vector<std::string> DNSResolver::get_ipv4(const std::string& url) { if (result.ptr->havedata) { - for (int i=0; result.ptr->data[i] != NULL; i++) + for (size_t i=0; result.ptr->data[i] != NULL; i++) { char as_str[INET_ADDRSTRLEN]; @@ -115,7 +115,7 @@ std::vector<std::string> DNSResolver::get_ipv6(const std::string& url) { if (result.ptr->havedata) { - for (int i=0; result.ptr->data[i] != NULL; i++) + for (size_t i=0; result.ptr->data[i] != NULL; i++) { char as_str[INET6_ADDRSTRLEN]; @@ -131,19 +131,24 @@ std::vector<std::string> DNSResolver::get_ipv6(const std::string& url) return retval; } -std::string DNSResolver::get_txt_record(const std::string& url) +std::vector<std::string> DNSResolver::get_txt_record(const std::string& url) { ub_result_ptr result; + std::vector<std::string> records; // call DNS resolver, blocking. if return value not zero, something went wrong if (!ub_resolve(m_data->m_ub_context, url.c_str(), LDNS_RR_TYPE_TXT, LDNS_RR_CLASS_IN, &(result.ptr))) { if (result.ptr->havedata) { - return std::string(result.ptr->data[0]); + for (size_t i=0; result.ptr->data[i] != NULL; i++) + { + records.push_back(result.ptr->data[i]); + } } } - return std::string(); + + return records; } DNSResolver& DNSResolver::instance() |