From 788f1415e17b90b3d97ede2867de320cb3933019 Mon Sep 17 00:00:00 2001 From: imaginos Date: Sun, 3 Apr 2005 20:59:25 +0000 Subject: [PATCH] adjust to coding style, wrap initssl with defs git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@89 726aef4b-f618-498e-8847-2d620e286838 --- Utils.cpp | 3 +-- main.cpp | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index d4a27042..0bef348e 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -40,8 +40,7 @@ char *strcasestr(const char *big, const char *little) #endif /* __sun */ #ifdef HAVE_LIBSSL -void CUtils::GenerateCert( FILE *pOut, bool bEncPrivKey ) -{ +void CUtils::GenerateCert( FILE *pOut, bool bEncPrivKey ) { RSA *pRSA = RSA_generate_key( 1024, 17, NULL, NULL ); PEM_write_RSAPrivateKey( pOut, pRSA, ( bEncPrivKey ? EVP_des_ede3_cbc() : NULL ), NULL, 0, NULL, NULL ); diff --git a/main.cpp b/main.cpp index 1f393d7e..7ac0fe52 100644 --- a/main.cpp +++ b/main.cpp @@ -46,22 +46,22 @@ void die(int sig) { int main(int argc, char** argv) { string sConfig; +#ifdef HAVE_LIBSSL // initialize ssl, allow client to have compression enabled if desired InitSSL( CT_ZLIB ); +#endif /* HAVE_LIBSSL */ + int iArg, iOptIndex = -1; #ifdef HAVE_LIBSSL bool bMakePem = false; bool bEncPem = false; #endif /* HAVE_LIBSSL */ bool bMakePass = false; - while( ( iArg = getopt_long( argc, argv, "h", g_LongOpts, &iOptIndex ) != -1 ) ) - { - switch( iArg ) - { + while( ( iArg = getopt_long( argc, argv, "h", g_LongOpts, &iOptIndex ) != -1 ) ) { + switch( iArg ) { case 1: { // long options - if ( iOptIndex >= 0 ) - { + if ( iOptIndex >= 0 ) { string sOption = Lower( g_LongOpts[iOptIndex].name ); if ( sOption == "makepass" ) bMakePass = true; @@ -71,14 +71,11 @@ int main(int argc, char** argv) { else if ( sOption == "encrypt-pem" ) bEncPem = true; #endif /* HAVE_LIBSSL */ - else if ( sOption == "help" ) - { + else if ( sOption == "help" ) { GenerateHelp( argv[0] ); return( 0 ); } - } - else - { + } else { GenerateHelp( argv[0] ); return( 1 ); } @@ -99,11 +96,9 @@ int main(int argc, char** argv) { sConfig = argv[optind]; #ifdef HAVE_LIBSSL - if ( bMakePem ) - { + if ( bMakePem ) { FILE *f = fopen( "znc.pem", "w" ); - if ( !f ) - { + if ( !f ) { cerr << "Unable to open znc.pem!" << endl; return( 1 ); } @@ -112,8 +107,7 @@ int main(int argc, char** argv) { return( 0 ); } #endif /* HAVE_LIBSSL */ - if ( bMakePass ) - { + if ( bMakePass ) { char* pass = getpass( "Enter Password: " ); int iLen = strlen(pass); cout << "Use this in the section of your config:" << endl << endl << "Pass = " << CMD5(pass, iLen) << " -" << endl << endl;