diff options
Diffstat (limited to 'Swiften/JID/JID.cpp')
| -rw-r--r-- | Swiften/JID/JID.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp index 5c6ea9d..a584b79 100644 --- a/Swiften/JID/JID.cpp +++ b/Swiften/JID/JID.cpp @@ -123,20 +123,22 @@ void JID::nameprepAndSetComponents(const std::string& node, const std::string& d auto inner = std::string(domain.begin() + 1, domain.end() - 1); auto hostAddress = HostAddress::fromString(inner); if (hostAddress && hostAddress->isValid()) { setComponents(node, domain, resource); return; } } const auto isAnyOfNonNumericAndNotDot = std::any_of(std::begin(domain), std::end(domain), [](char c) {return !::isdigit(c) && c != '.'; }); + const auto isDomainAllNumeric = std::all_of(std::begin(domain), std::end(domain), [](char c) {return ::isdigit(c) ; }); - if (!isAnyOfNonNumericAndNotDot) { + //Prevent Windows validating non-dotted integers as OK if it can unpack them + if (!isAnyOfNonNumericAndNotDot && !isDomainAllNumeric) { auto hostAddress = HostAddress::fromString(domain); if (hostAddress && hostAddress->isValid()) { setComponents(node, domain, resource); return; } } if (!isAnyOfNonNumericAndNotDot || !idnConverter->getIDNAEncoded(domain)) { valid_ = false; |
Swift