Added prompt to ask user if they want a missing pem file auto generated

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@202 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-04-28 23:42:28 +00:00
parent e233decc2d
commit 51f22e4287
+30 -5
View File
@@ -502,13 +502,38 @@ bool CZNC::ParseConfig(const string& sConfigFile) {
CUtils::PrintStatus(false, "SSL is not enabled");
return false;
}
#endif
#else
string sPemFile = GetPemLocation();
if ((m_bSSL) && (!CFile::Exists(GetPemLocation()))) {
CUtils::PrintStatus(false, "Unable to locate pem file: [" + GetPemLocation() + "]");
return false;
if ((m_bSSL) && (!CFile::Exists(sPemFile))) {
CUtils::PrintStatus(false, "Unable to locate pem file: [" + sPemFile + "]");
if (CUtils::GetBoolInput("Would you like to create a new pem file")) {
CUtils::PrintAction("Writing Pem file [" + sPemFile + "]");
if (CFile::Exists(sPemFile)) {
CUtils::PrintStatus(false, "File already exists");
return false;
}
FILE *f = fopen(sPemFile.c_str(), "w");
if (!f) {
CUtils::PrintStatus(false, "Unable to open");
return false;
}
CUtils::GenerateCert(f, false);
fclose(f);
CUtils::PrintStatus(true);
} else {
return false;
}
CUtils::PrintAction("Resuming");
}
#endif
if (!Listen()) {
CUtils::PrintStatus(false);
return false;