]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Only read the SSL profiles if they're actually specified.
authorSadie Powell <sadie@witchery.services>
Tue, 21 Apr 2020 01:20:12 +0000 (02:20 +0100)
committerSadie Powell <sadie@witchery.services>
Tue, 21 Apr 2020 01:20:12 +0000 (02:20 +0100)
src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_mbedtls.cpp
src/modules/extra/m_ssl_openssl.cpp

index df8daf4e3b818054fe7985e21d8dd642ae8cb95e..d62500f3c1e34fc610c893bd713b934a02e516a4 100644 (file)
@@ -1312,33 +1312,35 @@ class ModuleSSLGnuTLS : public Module
                                throw ModuleException("Error while initializing the default TLS (SSL) profile - " + ex.GetReason());
                        }
                }
-
-               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "You have defined an <sslprofile> tag; you should use this in place of \"gnutls\" when configuring TLS (SSL) connections in <bind:ssl> or <link:ssl>");
-               for (ConfigIter i = tags.first; i != tags.second; ++i)
+               else
                {
-                       ConfigTag* tag = i->second;
-                       if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls"))
-                               continue;
-
-                       std::string name = tag->getString("name");
-                       if (name.empty())
+                       ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "You have defined an <sslprofile> tag; you should use this in place of \"gnutls\" when configuring TLS (SSL) connections in <bind:ssl> or <link:ssl>");
+                       for (ConfigIter i = tags.first; i != tags.second; ++i)
                        {
-                               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation());
-                               continue;
-                       }
+                               ConfigTag* tag = i->second;
+                               if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls"))
+                                       continue;
 
-                       reference<GnuTLSIOHookProvider> prov;
-                       try
-                       {
-                               GnuTLS::Profile::Config profileconfig(name, tag);
-                               prov = new GnuTLSIOHookProvider(this, profileconfig);
-                       }
-                       catch (CoreException& ex)
-                       {
-                               throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason());
-                       }
+                               std::string name = tag->getString("name");
+                               if (name.empty())
+                               {
+                                       ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation());
+                                       continue;
+                               }
 
-                       newprofiles.push_back(prov);
+                               reference<GnuTLSIOHookProvider> prov;
+                               try
+                               {
+                                       GnuTLS::Profile::Config profileconfig(name, tag);
+                                       prov = new GnuTLSIOHookProvider(this, profileconfig);
+                               }
+                               catch (CoreException& ex)
+                               {
+                                       throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason());
+                               }
+
+                               newprofiles.push_back(prov);
+                       }
                }
 
                // New profiles are ok, begin using them
index 1666c470053f417fea353a2bc77a06d0e7808a6e..048ab6819bcb106e55f977f634433f22529716b1 100644 (file)
@@ -886,33 +886,35 @@ class ModuleSSLmbedTLS : public Module
                                throw ModuleException("Error while initializing the default TLS (SSL) profile - " + ex.GetReason());
                        }
                }
-
-               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "You have defined an <sslprofile> tag; you should use this in place of \"mbedtls\" when configuring TLS (SSL) connections in <bind:ssl> or <link:ssl>");
-               for (ConfigIter i = tags.first; i != tags.second; ++i)
+               else
                {
-                       ConfigTag* tag = i->second;
-                       if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls"))
-                               continue;
-
-                       std::string name = tag->getString("name");
-                       if (name.empty())
+                       ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "You have defined an <sslprofile> tag; you should use this in place of \"mbedtls\" when configuring TLS (SSL) connections in <bind:ssl> or <link:ssl>");
+                       for (ConfigIter i = tags.first; i != tags.second; ++i)
                        {
-                               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation());
-                               continue;
-                       }
+                               ConfigTag* tag = i->second;
+                               if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls"))
+                                       continue;
 
-                       reference<mbedTLSIOHookProvider> prov;
-                       try
-                       {
-                               mbedTLS::Profile::Config profileconfig(name, tag, ctr_drbg);
-                               prov = new mbedTLSIOHookProvider(this, profileconfig);
-                       }
-                       catch (CoreException& ex)
-                       {
-                               throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason());
-                       }
+                               std::string name = tag->getString("name");
+                               if (name.empty())
+                               {
+                                       ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation());
+                                       continue;
+                               }
 
-                       newprofiles.push_back(prov);
+                               reference<mbedTLSIOHookProvider> prov;
+                               try
+                               {
+                                       mbedTLS::Profile::Config profileconfig(name, tag, ctr_drbg);
+                                       prov = new mbedTLSIOHookProvider(this, profileconfig);
+                               }
+                               catch (CoreException& ex)
+                               {
+                                       throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason());
+                               }
+
+                               newprofiles.push_back(prov);
+                       }
                }
 
                // New profiles are ok, begin using them
index f75d9b4858bfdf28e30ff079d8411fc8f0641f2b..626baddc260a1d70edf0654322b8cfdaea543236 100644 (file)
@@ -990,32 +990,34 @@ class ModuleSSLOpenSSL : public Module
                                throw ModuleException("Error while initializing the default TLS (SSL) profile - " + ex.GetReason());
                        }
                }
-
-               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "You have defined an <sslprofile> tag; you should use this in place of \"openssl\" when configuring TLS (SSL) connections in <bind:ssl> or <link:ssl>");
-               for (ConfigIter i = tags.first; i != tags.second; ++i)
+               else
                {
-                       ConfigTag* tag = i->second;
-                       if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl"))
-                               continue;
-
-                       std::string name = tag->getString("name");
-                       if (name.empty())
+                       ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "You have defined an <sslprofile> tag; you should use this in place of \"openssl\" when configuring TLS (SSL) connections in <bind:ssl> or <link:ssl>");
+                       for (ConfigIter i = tags.first; i != tags.second; ++i)
                        {
-                               ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation());
-                               continue;
-                       }
+                               ConfigTag* tag = i->second;
+                               if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl"))
+                                       continue;
 
-                       reference<OpenSSLIOHookProvider> prov;
-                       try
-                       {
-                               prov = new OpenSSLIOHookProvider(this, name, tag);
-                       }
-                       catch (CoreException& ex)
-                       {
-                               throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason());
-                       }
+                               std::string name = tag->getString("name");
+                               if (name.empty())
+                               {
+                                       ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation());
+                                       continue;
+                               }
+
+                               reference<OpenSSLIOHookProvider> prov;
+                               try
+                               {
+                                       prov = new OpenSSLIOHookProvider(this, name, tag);
+                               }
+                               catch (CoreException& ex)
+                               {
+                                       throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason());
+                               }
 
-                       newprofiles.push_back(prov);
+                               newprofiles.push_back(prov);
+                       }
                }
 
                for (ProfileList::iterator i = profiles.begin(); i != profiles.end(); ++i)