From 2c2432245f40377ee31c21e42d34a473f09601fe Mon Sep 17 00:00:00 2001 From: Jeffrey Ryan Date: Mon, 21 Nov 2022 15:54:23 -0600 Subject: DNSResolver: fix not handling hostnames without dot characters [release] Unrelated, but similar code-wise to #8643. There is a check in `DNSResolver` which automatically fails to resolve hostnames which do not contain the `.` character. This PR removes that check. --- src/common/dns_utils.cpp | 15 --------------- src/common/dns_utils.h | 9 --------- 2 files changed, 24 deletions(-) (limited to 'src') diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index 7bb1781d4..44e4258d9 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -327,11 +327,6 @@ std::vector DNSResolver::get_record(const std::string& url, int rec dnssec_available = false; dnssec_valid = false; - if (!check_address_syntax(url.c_str())) - { - return addresses; - } - // destructor takes care of cleanup ub_result_ptr result; @@ -414,16 +409,6 @@ DNSResolver DNSResolver::create() return DNSResolver(); } -bool DNSResolver::check_address_syntax(const char *addr) const -{ - // if string doesn't contain a dot, we won't consider it a url for now. - if (strchr(addr,'.') == NULL) - { - return false; - } - return true; -} - namespace dns_utils { diff --git a/src/common/dns_utils.h b/src/common/dns_utils.h index f9507b42a..81079ba30 100644 --- a/src/common/dns_utils.h +++ b/src/common/dns_utils.h @@ -159,15 +159,6 @@ private: // TODO: modify this to accommodate DNSSEC std::vector get_record(const std::string& url, int record_type, boost::optional (*reader)(const char *,size_t), bool& dnssec_available, bool& dnssec_valid); - /** - * @brief Checks a string to see if it looks like a URL - * - * @param addr the string to be checked - * - * @return true if it looks enough like a URL, false if not - */ - bool check_address_syntax(const char *addr) const; - DNSResolverData *m_data; }; // class DNSResolver -- cgit v1.2.3