diff options
| author | 2020-06-16 02:43:23 +0100 | |
|---|---|---|
| committer | 2020-06-16 02:46:39 +0100 | |
| commit | 63c6305c4d415cae2d36453cd781e6eb280847d6 (patch) | |
| tree | c8fdf354e2afebc4b962370e1c7724fa0bf829c2 /src/modules | |
| parent | Merge branch 'insp3' into master. (diff) | |
Remove compat for the v2 <gnutls> and <openssl> tags.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 56 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_mbedtls.cpp | 56 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 55 |
3 files changed, 57 insertions, 110 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 81d08d373..8f117a802 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -1127,52 +1127,34 @@ class ModuleSSLGnuTLS : public Module ProfileList newprofiles; ConfigTagList tags = ServerInstance->Config->ConfTags("sslprofile"); - if (tags.first == tags.second) + if (tags.first != tags.second) + throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!"); + + for (ConfigIter i = tags.first; i != tags.second; ++i) { - // No <sslprofile> tags found, create a profile named "gnutls" from settings in the <gnutls> block - const std::string defname = "gnutls"; - ConfigTag* tag = ServerInstance->Config->ConfValue(defname); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found; using settings from the <gnutls> tag"); + 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, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); + continue; + } + + reference<GnuTLSIOHookProvider> prov; try { - GnuTLS::Profile::Config profileconfig(defname, tag); - newprofiles.push_back(new GnuTLSIOHookProvider(this, profileconfig)); + GnuTLS::Profile::Config profileconfig(name, tag); + prov = new GnuTLSIOHookProvider(this, profileconfig); } catch (CoreException& ex) { - throw ModuleException("Error while initializing the default TLS (SSL) profile - " + ex.GetReason()); + throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason()); } - } - else - { - 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) - { - 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, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); - 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()); - } - - newprofiles.push_back(prov); - } + newprofiles.push_back(prov); } // New profiles are ok, begin using them diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index aa9ace195..2c923ded8 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -870,52 +870,34 @@ class ModuleSSLmbedTLS : public Module ProfileList newprofiles; ConfigTagList tags = ServerInstance->Config->ConfTags("sslprofile"); - if (tags.first == tags.second) + if (tags.first != tags.second) + throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!"); + + for (ConfigIter i = tags.first; i != tags.second; ++i) { - // No <sslprofile> tags found, create a profile named "mbedtls" from settings in the <mbedtls> block - const std::string defname = "mbedtls"; - ConfigTag* tag = ServerInstance->Config->ConfValue(defname); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found; using settings from the <mbedtls> tag"); + 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, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); + continue; + } + + reference<mbedTLSIOHookProvider> prov; try { - mbedTLS::Profile::Config profileconfig(defname, tag, ctr_drbg); - newprofiles.push_back(new mbedTLSIOHookProvider(this, profileconfig)); + mbedTLS::Profile::Config profileconfig(name, tag, ctr_drbg); + prov = new mbedTLSIOHookProvider(this, profileconfig); } catch (CoreException& ex) { - throw ModuleException("Error while initializing the default TLS (SSL) profile - " + ex.GetReason()); + throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason()); } - } - else - { - 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) - { - 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, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); - 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()); - } - - newprofiles.push_back(prov); - } + newprofiles.push_back(prov); } // New profiles are ok, begin using them diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 780938c3d..63c2bd999 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -906,50 +906,33 @@ class ModuleSSLOpenSSL : public Module { ProfileList newprofiles; ConfigTagList tags = ServerInstance->Config->ConfTags("sslprofile"); - if (tags.first == tags.second) + if (tags.first != tags.second) + throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!"); + + for (ConfigIter i = tags.first; i != tags.second; ++i) { - // Create a default profile named "openssl" - const std::string defname = "openssl"; - ConfigTag* tag = ServerInstance->Config->ConfValue(defname); - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "No <sslprofile> tags found, using settings from the <openssl> tag"); + ConfigTag* tag = i->second; + if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl")) + continue; - try + std::string name = tag->getString("name"); + if (name.empty()) { - newprofiles.push_back(new OpenSSLIOHookProvider(this, defname, tag)); + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Ignoring <sslprofile> tag without name at " + tag->getTagLocation()); + continue; } - catch (OpenSSL::Exception& ex) + + reference<OpenSSLIOHookProvider> prov; + try { - throw ModuleException("Error while initializing the default TLS (SSL) profile - " + ex.GetReason()); + prov = new OpenSSLIOHookProvider(this, name, tag); } - } - else - { - 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) + catch (CoreException& ex) { - 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, "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); + throw ModuleException("Error while initializing TLS (SSL) profile \"" + name + "\" at " + tag->getTagLocation() + " - " + ex.GetReason()); } + + newprofiles.push_back(prov); } for (ProfileList::iterator i = profiles.begin(); i != profiles.end(); ++i) |
