diff --git a/znc.cpp b/znc.cpp index 40c432b5..dcb1e331 100644 --- a/znc.cpp +++ b/znc.cpp @@ -94,7 +94,7 @@ int CZNC::Loop() { #ifdef HAVE_LIBSSL if (pServer->IsSSL()) { bSSL = true; - pIRCSock->SetPemLocation(GetCurPath() + "/znc.pem"); + pIRCSock->SetPemLocation(GetPemLocation()); } #endif if (!m_Manager.Connect(pServer->GetName(), pServer->GetPort(), sSockName, 20, bSSL, pUser->GetVHost(), pIRCSock)) { @@ -170,7 +170,7 @@ bool CZNC::Listen() { #ifdef HAVE_LIBSSL if (IsSSL()) { bSSL = true; - pUserSock->SetPemLocation(GetCurPath() + "/znc.pem"); + pUserSock->SetPemLocation(GetPemLocation()); } #endif return m_Manager.ListenAll(m_uListenPort, "_LISTENER", bSSL, SOMAXCONN, pUserSock); @@ -450,8 +450,8 @@ bool CZNC::ParseConfig(const string& sConfigFile) { } #endif - if ((m_bSSL) && (!CFile::Exists(GetCurPath() + "/znc.pem"))) { - cerr << "Unable to locate pem file: [" << GetCurPath() << "/znc.pem]" << endl; + if ((m_bSSL) && (!CFile::Exists(GetPemLocation()))) { + cerr << "Unable to locate pem file: [" << GetPemLocation() << "]" << endl; return false; } diff --git a/znc.h b/znc.h index f0312b27..76cf2aca 100644 --- a/znc.h +++ b/znc.h @@ -34,6 +34,7 @@ public: const string& GetHomePath() const { if (!CFile::Exists(m_sHomePath)) { CUtils::MakeDir(m_sHomePath); } return m_sHomePath; } const string& GetZNCPath() const { if (!CFile::Exists(m_sZNCPath)) { CUtils::MakeDir(m_sZNCPath); } return m_sZNCPath; } const string& GetDataPath() const { if (!CFile::Exists(m_sDataPath)) { CUtils::MakeDir(m_sDataPath); } return m_sDataPath; } + string GetPemLocation() const { return GetZNCPath() + "/znc.pem"; } bool IsSSL() const { #ifdef HAVE_LIBSSL