fixed SF# 3325324

This commit is contained in:
Guenter Obiltschnig
2011-07-01 11:51:14 +00:00
parent fb1a609fb5
commit 191860aa7e

View File

@@ -1,7 +1,7 @@
//
// X509Certificate.cpp
//
// $Id: //poco/1.4/NetSSL_OpenSSL/src/X509Certificate.cpp#1 $
// $Id: //poco/1.4/NetSSL_OpenSSL/src/X509Certificate.cpp#2 $
//
// Library: NetSSL_OpenSSL
// Package: SSLCore
@@ -167,7 +167,8 @@ bool X509Certificate::containsWildcards(const std::string& commonName)
bool X509Certificate::matchByAlias(const std::string& alias, const HostEntry& heData)
{
// fix wildcards
std::string aliasRep = Poco::replace(alias, "*", ".*");
std::string aliasRep = Poco::replace(alias, ".", "\\.");
Poco::replaceInPlace(aliasRep, "*", ".*");
Poco::replaceInPlace(aliasRep, "..*", ".*");
Poco::replaceInPlace(aliasRep, "?", ".?");
Poco::replaceInPlace(aliasRep, "..?", ".?");
@@ -181,6 +182,12 @@ bool X509Certificate::matchByAlias(const std::string& alias, const HostEntry& he
{
found = expr.match(*it);
}
// Handle the case where the list of aliases is empty.
if (aliases.empty())
{
// Compare the host name against the wildcard host name in the certificate.
found = expr.match(heData.name());
}
return found;
}