Fix non-default location of znc.pem when upgrading configs from pre-1.7.

New options SSLDHParamFile and SSLKeyFile were pointing at the default
location instead of the same as SSLCertFile.

Thanks to @xelra for the report.
This commit is contained in:
Alexey Sokolov
2018-03-15 22:14:00 +00:00
parent 9791d2c18e
commit 5d603b0932
+8 -7
View File
@@ -381,8 +381,7 @@ void CZNC::InitDirs(const CString& sArgvPath, const CString& sDataDir) {
m_sZNCPath = sDataDir;
}
m_sSSLCertFile = m_sSSLKeyFile = m_sSSLDHParamFile =
m_sZNCPath + "/znc.pem";
m_sSSLCertFile = m_sZNCPath + "/znc.pem";
}
CString CZNC::GetConfPath(bool bAllowMkDir) const {
@@ -430,11 +429,13 @@ CString CZNC::GetPemLocation() const {
}
CString CZNC::GetKeyLocation() const {
return CDir::ChangeDir("", m_sSSLKeyFile);
return CDir::ChangeDir(
"", m_sSSLKeyFile.empty() ? m_sSSLCertFile : m_sSSLKeyFile);
}
CString CZNC::GetDHParamLocation() const {
return CDir::ChangeDir("", m_sSSLDHParamFile);
return CDir::ChangeDir(
"", m_sSSLDHParamFile.empty() ? m_sSSLCertFile : m_sSSLDHParamFile);
}
CString CZNC::ExpandConfigPath(const CString& sConfigFile, bool bAllowMkDir) {
@@ -487,9 +488,9 @@ bool CZNC::WriteConfig() {
CConfig config;
config.AddKeyValuePair("AnonIPLimit", CString(m_uiAnonIPLimit));
config.AddKeyValuePair("MaxBufferSize", CString(m_uiMaxBufferSize));
config.AddKeyValuePair("SSLCertFile", CString(m_sSSLCertFile));
config.AddKeyValuePair("SSLKeyFile", CString(m_sSSLKeyFile));
config.AddKeyValuePair("SSLDHParamFile", CString(m_sSSLDHParamFile));
config.AddKeyValuePair("SSLCertFile", CString(GetPemLocation()));
config.AddKeyValuePair("SSLKeyFile", CString(GetKeyLocation()));
config.AddKeyValuePair("SSLDHParamFile", CString(GetDHParamLocation()));
config.AddKeyValuePair("ProtectWebSessions",
CString(m_bProtectWebSessions));
config.AddKeyValuePair("HideVersion", CString(m_bHideVersion));