From de229f9fecb801cb4adfa61623eaed11b3a4f13e Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 5 Aug 2014 12:14:24 +0200 Subject: [PATCH] Exit early on ApiListener SSL errors refs #6682 --- lib/remote/apilistener.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index fd70b0c0b..3c7c11403 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -47,14 +47,14 @@ void ApiListener::OnConfigLoaded(void) cert = GetX509Certificate(GetCertPath()); } catch (std::exception&) { Log(LogCritical, "ApiListener", "Cannot get certificate from cert path: '" + GetCertPath() + "'."); - return; + Application::Exit(EXIT_FAILURE); } try { SetIdentity(GetCertificateCN(cert)); } catch (std::exception&) { Log(LogCritical, "ApiListener", "Cannot get certificate common name from cert path: '" + GetCertPath() + "'."); - return; + Application::Exit(EXIT_FAILURE); } Log(LogInformation, "ApiListener", "My API identity: " + GetIdentity()); @@ -63,7 +63,7 @@ void ApiListener::OnConfigLoaded(void) m_SSLContext = MakeSSLContext(GetCertPath(), GetKeyPath(), GetCaPath()); } catch (std::exception&) { Log(LogCritical, "ApiListener", "Cannot make SSL context for cert path: '" + GetCertPath() + "' key path: '" + GetKeyPath() + "' ca path: '" + GetCaPath() + "'."); - return; + Application::Exit(EXIT_FAILURE); } if (!GetCrlPath().IsEmpty()) { @@ -71,13 +71,13 @@ void ApiListener::OnConfigLoaded(void) AddCRLToSSLContext(m_SSLContext, GetCrlPath()); } catch (std::exception&) { Log(LogCritical, "ApiListener", "Cannot add certificate revocation list to SSL context for crl path: '" + GetCrlPath() + "'."); - return; + Application::Exit(EXIT_FAILURE); } } if (!Endpoint::GetByName(GetIdentity())) { Log(LogCritical, "ApiListener", "Endpoint object for '" + GetIdentity() + "' is missing."); - return; + Application::Exit(EXIT_FAILURE); } SyncZoneDirs(); -- 2.40.0