Skip to content
Snippets Groups Projects
Commit a475c87f authored by Tristan Matthews's avatar Tristan Matthews
Browse files

tls: fix impossible conditional

hostname.c_str() can never == 0

Refs #44716
parent 6348fd9c
Branches
No related tags found
No related merge requests found
......@@ -196,15 +196,13 @@ bool SecurityEvaluator::verifyHostnameCertificate(const std::string& certificate
SecurityEvaluator::HostnameValidationResult
SecurityEvaluator::validateHostname(const std::string& hostname, const X509 *server_cert)
{
HostnameValidationResult result;
if (hostname.c_str() == nullptr || (server_cert == nullptr)) {
DEBUG("hostname.c_str() == nullptr || (server_cert == nullptr)");
if (hostname.empty() or server_cert == nullptr) {
DEBUG("hostname empty or server_cert is NULL");
return Error;
}
// First try the Subject Alternative Names extension
result = matchSubjectAltName(hostname, server_cert);
HostnameValidationResult result = matchSubjectAltName(hostname, server_cert);
if (result == NoSANPresent) {
// Extension was not found: try the Common Name
result = matchCommonName(hostname, server_cert);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment