]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_openssl.cpp
Replace OnRehash() with ReadConfig() that is called on boot, on module load and on...
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_openssl.cpp
index a0043b7aa57c0e1b0465ecca0944b70a47769806..0957b5912f16c7a444b01f01e455b211b64eac84 100644 (file)
 # define MAX_DESCRIPTORS 10000
 #endif
 
-/* $LinkerFlags: if("USE_FREEBSD_BASE_SSL") -lssl -lcrypto */
-/* $CompileFlags: if(!"USE_FREEBSD_BASE_SSL") pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") */
-/* $LinkerFlags: if(!"USE_FREEBSD_BASE_SSL") rpath("pkg-config --libs openssl") pkgconflibs("openssl","/libssl.so","-lssl -lcrypto -ldl") */
-
-/* $NoPedantic */
-
+/* $CompileFlags: pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") -Wno-pedantic */
+/* $LinkerFlags: rpath("pkg-config --libs openssl") pkgconflibs("openssl","/libssl.so","-lssl -lcrypto") */
 
 enum issl_status { ISSL_NONE, ISSL_HANDSHAKING, ISSL_OPEN };
 
@@ -188,7 +184,7 @@ class OpenSSLIOHook : public SSLIOHook
 
                certinfo->invalid = (SSL_get_verify_result(session->sess) != X509_V_OK);
 
-               if (SelfSigned)
+               if (!SelfSigned)
                {
                        certinfo->unknownsigner = false;
                        certinfo->trusted = true;
@@ -494,8 +490,6 @@ class ModuleSSLOpenSSL : public Module
        {
                // Needs the flag as it ignores a plain /rehash
                OnModuleRehash(NULL,"ssl");
-               Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnHookIO, I_OnUserConnect };
-               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
                ServerInstance->Modules->AddService(iohook);
        }
 
@@ -508,7 +502,7 @@ class ModuleSSLOpenSSL : public Module
                }
        }
 
-       void OnRehash(User* user) CXX11_OVERRIDE
+       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                sslports.clear();
 
@@ -556,14 +550,13 @@ class ModuleSSLOpenSSL : public Module
                std::string certfile;
                std::string cafile;
                std::string dhfile;
-               OnRehash(user);
 
                ConfigTag* conf = ServerInstance->Config->ConfValue("openssl");
 
-               cafile   = conf->getString("cafile", CONFIG_PATH "/ca.pem");
-               certfile = conf->getString("certfile", CONFIG_PATH "/cert.pem");
-               keyfile  = conf->getString("keyfile", CONFIG_PATH "/key.pem");
-               dhfile   = conf->getString("dhfile", CONFIG_PATH "/dhparams.pem");
+               cafile   = ServerInstance->Config->Paths.PrependConfig(conf->getString("cafile", "ca.pem"));
+               certfile = ServerInstance->Config->Paths.PrependConfig(conf->getString("certfile", "cert.pem"));
+               keyfile  = ServerInstance->Config->Paths.PrependConfig(conf->getString("keyfile", "key.pem"));
+               dhfile   = ServerInstance->Config->Paths.PrependConfig(conf->getString("dhfile", "dhparams.pem"));
                std::string hash = conf->getString("hash", "md5");
 
                iohook.digest = EVP_get_digestbyname(hash.c_str());