diff --git a/daemon/src/sip/security_evaluator.cpp b/daemon/src/sip/security_evaluator.cpp index 7524208b1ea884ebbc3b40badbd277cae560cdb5..ea55f51654c8471edd1469613f7fe3dd057b8cfd 100644 --- a/daemon/src/sip/security_evaluator.cpp +++ b/daemon/src/sip/security_evaluator.cpp @@ -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);