summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-16 08:35:23 +0000
committerspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-16 08:35:23 +0000
commitc773dc8d0c9ab4873aa850bd31f14685bdfb6c07 (patch)
tree98488f4dee6b4855b04919e92a54cbdda1d164ef /src
parent42105f07dd1ac0e04e28077754b6245a80d55597 (diff)
Made m_ssl_gnutls throw an exception when unable to load the certificate (since SSL won't work at all without one)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7441 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 5b1197915..fd8b12d32 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -211,9 +211,11 @@ class ModuleSSLGnuTLS : public Module
if((ret = gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret));
- // Guessing on the return value of this, manual doesn't say :|
if((ret = gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 certificate and key files '%s' and '%s': %s", certfile.c_str(), keyfile.c_str(), gnutls_strerror(ret));
+ {
+ // If this fails, no SSL port will work. At all. So, do the smart thing - throw a ModuleException
+ throw ModuleException("Unable to load GnuTLS server certificate: " + std::string(gnutls_strerror(ret)));
+ }
// This may be on a large (once a day or week) timer eventually.
GenerateDHParams();