]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_openssl.cpp
Increment serverstats::Collisions when a collision is handled, not when a module...
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_openssl.cpp
index 53a01724be9b6924ce6d6488edce3e567a515ba8..0ce36ed803ac19bb870dd988d45b632ea81d1d1f 100644 (file)
@@ -44,8 +44,6 @@
 # pragma comment(lib, "libgcc.lib")
 # pragma comment(lib, "libmingwex.lib")
 # pragma comment(lib, "gdi32.lib")
-# undef MAX_DESCRIPTORS
-# define MAX_DESCRIPTORS 10000
 #endif
 
 /* $CompileFlags: pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") -Wno-pedantic */
@@ -109,6 +107,9 @@ namespace OpenSSL
                {
                        SSL_CTX_set_mode(ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
                        SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify);
+
+                       const unsigned char session_id[] = "inspircd";
+                       SSL_CTX_set_session_id_context(ctx, session_id, sizeof(session_id) - 1);
                }
 
                ~Context()
@@ -352,8 +353,11 @@ class OpenSSLIOHook : public SSLIOHook
                        certinfo->trusted = false;
                }
 
-               certinfo->dn = X509_NAME_oneline(X509_get_subject_name(cert),0,0);
-               certinfo->issuer = X509_NAME_oneline(X509_get_issuer_name(cert),0,0);
+               char buf[512];
+               X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
+               certinfo->dn = buf;
+               X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));
+               certinfo->issuer = buf;
 
                if (!X509_digest(cert, profile->GetDigest(), md, &n))
                {
@@ -573,7 +577,6 @@ class ModuleSSLOpenSSL : public Module
 {
        typedef std::vector<reference<OpenSSLIOHookProvider> > ProfileList;
 
-       std::string sslports;
        ProfileList profiles;
 
        void ReadProfiles()
@@ -640,45 +643,6 @@ class ModuleSSLOpenSSL : public Module
                ReadProfiles();
        }
 
-       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
-       {
-               sslports.clear();
-
-               ConfigTag* Conf = ServerInstance->Config->ConfValue("openssl");
-
-               if (Conf->getBool("showports", true))
-               {
-                       sslports = Conf->getString("advertisedports");
-                       if (!sslports.empty())
-                               return;
-
-                       for (size_t i = 0; i < ServerInstance->ports.size(); i++)
-                       {
-                               ListenSocket* port = ServerInstance->ports[i];
-                               if (port->bind_tag->getString("ssl") != "openssl")
-                                       continue;
-
-                               const std::string& portid = port->bind_desc;
-                               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Enabling SSL for port %s", portid.c_str());
-
-                               if (port->bind_tag->getString("type", "clients") == "clients" && port->bind_addr != "127.0.0.1")
-                               {
-                                       /*
-                                        * Found an SSL port for clients that is not bound to 127.0.0.1 and handled by us, display
-                                        * the IP:port in ISUPPORT.
-                                        *
-                                        * We used to advertise all ports seperated by a ';' char that matched the above criteria,
-                                        * but this resulted in too long ISUPPORT lines if there were lots of ports to be displayed.
-                                        * To solve this by default we now only display the first IP:port found and let the user
-                                        * configure the exact value for the 005 token, if necessary.
-                                        */
-                                       sslports = portid;
-                                       break;
-                               }
-                       }
-               }
-       }
-
        void OnModuleRehash(User* user, const std::string &param) CXX11_OVERRIDE
        {
                if (param != "ssl")
@@ -694,12 +658,6 @@ class ModuleSSLOpenSSL : public Module
                }
        }
 
-       void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
-       {
-               if (!sslports.empty())
-                       tokens["SSL"] = sslports;
-       }
-
        void OnUserConnect(LocalUser* user) CXX11_OVERRIDE
        {
                IOHook* hook = user->eh.GetIOHook();