]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_openssl.cpp
Fix for small display issue, when both ssl modules are loaded, both output a 'is...
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_openssl.cpp
index 6bd75b824dbdc6ac94ea6f9274044bde9cfc8ee2..7bb707d2c4a1f1a48486c786de8c3c0bb2f76546 100644 (file)
@@ -114,6 +114,8 @@ class ModuleSSLOpenSSL : public Module
        // std::string crlfile;
        std::string dhfile;
 
+       int clientactive;
+
  public:
 
        InspIRCd* PublicInstance;
@@ -156,6 +158,7 @@ class ModuleSSLOpenSSL : public Module
                }
 
                listenports.clear();
+               clientactive = 0;
 
                for (int i = 0; i < Conf->Enumerate("bind"); i++)
                {
@@ -168,17 +171,25 @@ class ModuleSSLOpenSSL : public Module
                                long portno = -1;
                                while ((portno = portrange.GetToken()))
                                {
-                                       if (ServerInstance->Config->AddIOHook(portno, this))
+                                       clientactive++;
+                                       try
                                        {
-                                               listenports.push_back(portno);
-                                               for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++)
-                                                       if (ServerInstance->Config->ports[i] == portno)
-                                                               ServerInstance->Config->openSockfd[i]->SetDescription("ssl");
-                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno);
+                                               if (ServerInstance->Config->AddIOHook(portno, this))
+                                               {
+                                                       listenports.push_back(portno);
+                                                               for (unsigned int i = 0; i < ServerInstance->stats->BoundPortCount; i++)
+                                                               if (ServerInstance->Config->ports[i] == portno)
+                                                                       ServerInstance->Config->openSockfd[i]->SetDescription("ssl");
+                                                       ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno);
+                                               }
+                                               else
+                                               {
+                                                       ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+                                               }
                                        }
-                                       else
+                                       catch (ModuleException &e)
                                        {
-                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+                                               ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another SSL or similar module loaded?", portno, e.GetReason());
                                        }
                                }
                        }
@@ -619,6 +630,9 @@ class ModuleSSLOpenSSL : public Module
        // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
        virtual void OnWhois(userrec* source, userrec* dest)
        {
+               if (!clientactive)
+                       return;
+
                // Bugfix, only send this numeric for *our* SSL users
                if (dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) &&  isin(dest->GetPort(), listenports)))
                {