]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_openssl.cpp
Fix various rline bugs, implement /stats R, and fix the issue where you get no error...
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_openssl.cpp
index 4368c8d471b42f24c03d59b331a21ba1058764e9..092dc05777efc5a34db7f5caa77a81d66171eeba 100644 (file)
@@ -152,6 +152,9 @@ class ModuleSSLOpenSSL : public Module
                ctx = SSL_CTX_new( SSLv23_server_method() );
                clictx = SSL_CTX_new( SSLv23_client_method() );
 
+               SSL_CTX_set_mode(ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+               SSL_CTX_set_mode(clictx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+
                SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify);
                SSL_CTX_set_verify(clictx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify);
 
@@ -164,10 +167,10 @@ class ModuleSSLOpenSSL : public Module
 
        virtual void OnHookUserIO(User* user, const std::string &targetip)
        {
-               if (!user->io && isin(targetip,user->GetPort(), listenports))
+               if (!user->GetIOHook() && isin(targetip,user->GetPort(), listenports))
                {
                        /* Hook the user with our module */
-                       user->io = this;
+                       user->AddIOHook(this);
                }
        }
 
@@ -318,11 +321,12 @@ class ModuleSSLOpenSSL : public Module
                {
                        User* user = (User*)item;
 
-                       if (user->GetExt("ssl", dummy) && IS_LOCAL(user) && user->io == this)
+                       if (user->GetIOHook() == this)
                        {
                                // User is using SSL, they're a local user, and they're using one of *our* SSL ports.
                                // Potentially there could be multiple SSL modules loaded at once on different ports.
                                ServerInstance->Users->QuitUser(user, "SSL module unloading");
+                               user->DelIOHook();
                        }
                        if (user->GetExt("ssl_cert", dummy))
                        {
@@ -331,8 +335,6 @@ class ModuleSSLOpenSSL : public Module
                                delete tofree;
                                user->Shrink("ssl_cert");
                        }
-
-                       user->io = NULL;
                }
        }
 
@@ -351,7 +353,7 @@ class ModuleSSLOpenSSL : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
 
 
@@ -367,7 +369,7 @@ class ModuleSSLOpenSSL : public Module
                        const char* ret = "OK";
                        try
                        {
-                               ret = ServerInstance->Config->AddIOHook((Module*)this, (BufferedSocket*)ISR->Sock) ? "OK" : NULL;
+                               ret = ISR->Sock->AddIOHook((Module*)this) ? "OK" : NULL;
                        }
                        catch (ModuleException &e)
                        {
@@ -378,7 +380,7 @@ class ModuleSSLOpenSSL : public Module
                }
                else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
                {
-                       return ServerInstance->Config->DelIOHook((BufferedSocket*)ISR->Sock) ? "OK" : NULL;
+                       return ISR->Sock->DelIOHook() ? "OK" : NULL;
                }
                else if (strcmp("IS_HSDONE", request->GetId()) == 0)
                {
@@ -685,7 +687,7 @@ class ModuleSSLOpenSSL : public Module
                        return;
 
                // Bugfix, only send this numeric for *our* SSL users
-               if (dest->GetExt("ssl", dummy) || ((IS_LOCAL(dest) && dest->io == this)))
+               if (dest->GetExt("ssl", dummy) || ((IS_LOCAL(dest) && dest->GetIOHook() == this)))
                {
                        ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
                }