From b03f495b2b15d17a30c07f489ac3cb1cd3f1d153 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 24 Apr 2009 16:47:49 +0000 Subject: [PATCH] Remove znc --encrypt-pem ZNC can't read encrypted pem files, so it's kinda pointless that it can generate those... git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1495 726aef4b-f618-498e-8847-2d620e286838 --- Utils.cpp | 4 ++-- Utils.h | 2 +- main.cpp | 16 ++-------------- man/znc.1 | 3 --- znc.cpp | 4 ++-- znc.h | 2 +- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index fcf12272..7204c70f 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -36,7 +36,7 @@ CUtils::CUtils() {} CUtils::~CUtils() {} #ifdef HAVE_LIBSSL -void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) { +void CUtils::GenerateCert(FILE *pOut, const CString& sHost) { EVP_PKEY *pKey = NULL; X509 *pCert = NULL; X509_NAME *pName = NULL; @@ -52,7 +52,7 @@ void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey, const CString& sHost) { return; } - PEM_write_RSAPrivateKey(pOut, pRSA, (bEncPrivKey ? EVP_des_ede3_cbc() : NULL), NULL, 0, NULL, NULL); + PEM_write_RSAPrivateKey(pOut, pRSA, NULL, NULL, 0, NULL, NULL); if (!(pCert = X509_new())) { EVP_PKEY_free(pKey); diff --git a/Utils.h b/Utils.h index f26e1ef2..de344941 100644 --- a/Utils.h +++ b/Utils.h @@ -77,7 +77,7 @@ public: return iTime; } #ifdef HAVE_LIBSSL - static void GenerateCert(FILE *pOut, bool bEncPrivKey = false, const CString& sHost = ""); + static void GenerateCert(FILE *pOut, const CString& sHost = ""); #endif /* HAVE_LIBSSL */ private: diff --git a/main.cpp b/main.cpp index 1149b607..a77cd2f7 100644 --- a/main.cpp +++ b/main.cpp @@ -20,7 +20,6 @@ static const struct option g_LongOpts[] = { { "makepass", no_argument, 0, 's' }, #ifdef HAVE_LIBSSL { "makepem", no_argument, 0, 'p' }, - { "encrypt-pem", no_argument, 0, 'e' }, #endif /* HAVE_LIBSSL */ { "datadir", required_argument, 0, 'd' }, { 0, 0, 0, 0 } @@ -39,7 +38,6 @@ static void GenerateHelp(const char *appname) { CUtils::PrintMessage("\t-s, --makepass Generates a password for use in config"); #ifdef HAVE_LIBSSL CUtils::PrintMessage("\t-p, --makepem Generates a pemfile for use with SSL"); - CUtils::PrintMessage("\t-e, --encrypt-pem when used along with --makepem, encrypts the private key in the pemfile"); #endif /* HAVE_LIBSSL */ CUtils::PrintMessage("\t-d, --datadir Set a different znc repository (default is ~/.znc)"); } @@ -88,9 +86,8 @@ int main(int argc, char** argv) { #endif #ifdef HAVE_LIBSSL bool bMakePem = false; - bool bEncPem = false; - while ((iArg = getopt_long(argc, argv, "hvnrcsped:Df", g_LongOpts, &iOptIndex)) != -1) { + while ((iArg = getopt_long(argc, argv, "hvnrcspd:Df", g_LongOpts, &iOptIndex)) != -1) { #else while ((iArg = getopt_long(argc, argv, "hvnrcsd:Df", g_LongOpts, &iOptIndex)) != -1) { #endif /* HAVE_LIBSSL */ @@ -117,9 +114,6 @@ int main(int argc, char** argv) { case 'p': bMakePem = true; break; - case 'e': - bEncPem = true; - break; #endif /* HAVE_LIBSSL */ case 'd': sDataDir = CString(optarg); @@ -147,17 +141,11 @@ int main(int argc, char** argv) { #ifdef HAVE_LIBSSL if (bMakePem) { - pZNC->WritePemFile(bEncPem); + pZNC->WritePemFile(); delete pZNC; return 0; } - - if (bEncPem && !bMakePem) { - CUtils::PrintError("--encrypt-pem should be used along with --makepem."); - delete pZNC; - return 1; - } #endif /* HAVE_LIBSSL */ if (bMakePass) { diff --git a/man/znc.1 b/man/znc.1 index c36c1737..54287482 100644 --- a/man/znc.1 +++ b/man/znc.1 @@ -79,9 +79,6 @@ This is the server certificate .B znc uses. You need this for SSL. -.TP -.BR \-e ", " \-\-encrypt-pem -Just ignore this :). .SH FILES .TP .I /usr/local/share/znc/ diff --git a/znc.cpp b/znc.cpp index b1c3bcf3..3a2bd3b0 100644 --- a/znc.cpp +++ b/znc.cpp @@ -331,7 +331,7 @@ bool CZNC::DeletePidFile() { return false; } -bool CZNC::WritePemFile(bool bEncPem) { +bool CZNC::WritePemFile() { #ifndef HAVE_LIBSSL CUtils::PrintError("ZNC was not compiled with ssl support."); return false; @@ -359,7 +359,7 @@ bool CZNC::WritePemFile(bool bEncPem) { return false; } - CUtils::GenerateCert(f, bEncPem, sHost); + CUtils::GenerateCert(f, sHost); fclose(f); CUtils::PrintStatus(true); diff --git a/znc.h b/znc.h index cf4cd33c..791a8c84 100644 --- a/znc.h +++ b/znc.h @@ -153,7 +153,7 @@ public: CString GetModPath() const; CString GetPemLocation() const { return GetZNCPath() + "/znc.pem"; } const CString& GetConfigFile() const { return m_sConfigFile; } - bool WritePemFile(bool bEncPem = false); + bool WritePemFile(); const CString& GetISpoofFile() const { return m_sISpoofFile; } const CString& GetISpoofFormat() const { return m_sISpoofFormat; } const VCString& GetVHosts() const { return m_vsVHosts; }