]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_gnutls.cpp
Better error message for erroring on loading server cert - give certfile/keyfile...
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_gnutls.cpp
index d7be8b12b4949f7c8fc9e12f0c1964e3dc3d21bb..adbd48fb64dcf44ebb74c8a63dde347d7a3ce6bc 100644 (file)
  */
 
 #include "inspircd.h"
-
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
-
-#include "inspircd_config.h"
-#include "configreader.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
-#include "socket.h"
-#include "hashcomp.h"
 #include "transport.h"
 #include "m_cap.h"
 
@@ -55,6 +46,11 @@ bool isin(const std::string &host, int port, const std::vector<std::string> &por
 class issl_session : public classbase
 {
 public:
+       issl_session()
+       {
+               sess = NULL;
+       }
+
        gnutls_session_t sess;
        issl_status status;
        std::string outbuf;
@@ -266,7 +262,7 @@ class ModuleSSLGnuTLS : public Module
                if((ret = gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
                {
                        // If this fails, no SSL port will work. At all. So, do the smart thing - throw a ModuleException
-                       throw ModuleException("Unable to load GnuTLS server certificate: " + std::string(gnutls_strerror(ret)));
+                       throw ModuleException("Unable to load GnuTLS server certificate (" + std::string(certfile) + ", key: " + keyfile + "): " + std::string(gnutls_strerror(ret)));
                }
 
                // This may be on a large (once a day or week) timer eventually.
@@ -920,20 +916,6 @@ class ModuleSSLGnuTLS : public Module
        void OnEvent(Event* ev)
        {
                GenericCapHandler(ev, "tls", "tls");
-               if (ev->GetEventID() == "cap_req")
-               {
-                       /* GenericCapHandler() Extends("tls") a user if it does
-                        * CAP REQ tls. Check if this was done.
-                        */
-                       CapData *data = (CapData *) ev->GetData();
-                       if (data->user->Shrink("tls"))
-                       {
-                               /* Not in our spec?!?! */
-                               data->user->AddIOHook(this);
-                               OnRawSocketAccept(data->user->GetFd(), data->user->GetIPString(),
-                                               data->user->GetPort());
-                       }
-               }
        }
 
        void Prioritize()