]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_openssl.cpp
[Taros] Add m_sakick.so
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_openssl.cpp
index d234cb6e5779581ac83b77172e379b9fc463dbf0..b5a2741f9b41846fee190bddf4feec4eb4a4d9ad 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
  */
 
 #include "inspircd.h"
-
 #include <openssl/ssl.h>
 #include <openssl/err.h>
-
-#include "configreader.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
-
-#include "socket.h"
-#include "hashcomp.h"
-
 #include "transport.h"
 
 #ifdef WINDOWS
@@ -204,13 +194,13 @@ class ModuleSSLOpenSSL : public Module
                                                for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
                                                        if ((ServerInstance->Config->ports[i]->GetPort() == portno) && (ServerInstance->Config->ports[i]->GetIP() == addr))
                                                                ServerInstance->Config->ports[i]->SetDescription("ssl");
-                                               ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %ld", portno);
+                                               ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %ld", portno);
 
                                                sslports.append((addr.empty() ? "*" : addr)).append(":").append(ConvToStr(portno)).append(";");
                                        }
                                        catch (ModuleException &e)
                                        {
-                                               ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
+                                               ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %ld: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
                                        }
                                }
                        }
@@ -326,7 +316,7 @@ class ModuleSSLOpenSSL : public Module
                                // 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()
+                               user->DelIOHook();
                        }
                        if (user->GetExt("ssl_cert", dummy))
                        {
@@ -687,7 +677,7 @@ class ModuleSSLOpenSSL : public Module
                        return;
 
                // Bugfix, only send this numeric for *our* SSL users
-               if (dest->GetExt("ssl", dummy) || ((IS_LOCAL(dest) && dest->GetIOHook() == this)))
+               if (dest->GetExt("ssl", dummy))
                {
                        ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
                }
@@ -785,7 +775,7 @@ class ModuleSSLOpenSSL : public Module
        {
                // This occurs AFTER OnUserConnect so we can be sure the
                // protocol module has propagated the NICK message.
-               if ((user->GetExt("ssl", dummy)) && (IS_LOCAL(user)))
+               if ((user->GetIOHook() == this) && (IS_LOCAL(user)))
                {
                        // Tell whatever protocol module we're using that we need to inform other servers of this metadata NOW.
                        ServerInstance->PI->SendMetaData(user, TYPE_USER, "SSL", "on");
@@ -808,7 +798,7 @@ class ModuleSSLOpenSSL : public Module
 
        virtual void OnBufferFlushed(User* user)
        {
-               if (user->GetExt("ssl"))
+               if (user->GetIOHook() == this)
                {
                        issl_session* session = &sessions[user->GetFd()];
                        if (session && session->outbuf.size())
@@ -881,7 +871,7 @@ class ModuleSSLOpenSSL : public Module
                        certinfo->data.insert(std::make_pair("fingerprint",irc::hex(md, n)));
                }
 
-               if ((ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(cert), time(NULL)) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), time(NULL)) == 0))
+               if ((ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(cert), ServerInstance->Time()) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), ServerInstance->Time()) == 0))
                {
                        certinfo->data.insert(std::make_pair("error","Not activated, or expired certificate"));
                }
@@ -892,7 +882,7 @@ class ModuleSSLOpenSSL : public Module
        void Prioritize()
        {
                Module* server = ServerInstance->Modules->Find("m_spanningtree.so");
-               ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIO_AFTER, &server);
+               ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_AFTER, &server);
        }
 
 };