mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-12-09 21:45:25 +00:00
fixed SF# 3325324
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// X509Certificate.cpp
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLCore
|
// Package: SSLCore
|
||||||
@@ -167,7 +167,8 @@ bool X509Certificate::containsWildcards(const std::string& commonName)
|
|||||||
bool X509Certificate::matchByAlias(const std::string& alias, const HostEntry& heData)
|
bool X509Certificate::matchByAlias(const std::string& alias, const HostEntry& heData)
|
||||||
{
|
{
|
||||||
// fix wildcards
|
// 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, "?", ".?");
|
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);
|
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;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user