summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-13 14:32:18 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-13 14:32:18 +0000
commitda983dcea72b9089d49d8f11726a418606d1ec5f (patch)
tree31e4c1f958c4a6c37e49ca8e9d80bce119b4daba
parent2d043de488ea65807b51b35a4436bbbf570ca29c (diff)
Remove magic path resolution from certificate files
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11868 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp25
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp25
2 files changed, 8 insertions, 42 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index fd572492a..e3e533cfd 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -197,10 +197,6 @@ class ModuleSSLGnuTLS : public Module
ConfigReader Conf;
- std::string confdir(ServerInstance->ConfigFileName);
- // +1 so we the path ends with a /
- confdir = confdir.substr(0, confdir.find_last_of('/') + 1);
-
cafile = Conf.ReadValue("gnutls", "cafile", 0);
crlfile = Conf.ReadValue("gnutls", "crlfile", 0);
certfile = Conf.ReadValue("gnutls", "certfile", 0);
@@ -209,33 +205,20 @@ class ModuleSSLGnuTLS : public Module
// Set all the default values needed.
if (cafile.empty())
- cafile = "ca.pem";
+ cafile = "conf/ca.pem";
if (crlfile.empty())
- crlfile = "crl.pem";
+ crlfile = "conf/crl.pem";
if (certfile.empty())
- certfile = "cert.pem";
+ certfile = "conf/cert.pem";
if (keyfile.empty())
- keyfile = "key.pem";
+ keyfile = "conf/key.pem";
if((dh_bits != 768) && (dh_bits != 1024) && (dh_bits != 2048) && (dh_bits != 3072) && (dh_bits != 4096))
dh_bits = 1024;
- // Prepend relative paths with the path to the config directory.
- if ((cafile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(cafile)))
- cafile = confdir + cafile;
-
- if ((crlfile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(crlfile)))
- crlfile = confdir + crlfile;
-
- if ((certfile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(certfile)))
- certfile = confdir + certfile;
-
- if ((keyfile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(keyfile)))
- keyfile = confdir + keyfile;
-
int ret;
if (cred_alloc)
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index a348726e7..235012746 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -171,10 +171,6 @@ class ModuleSSLOpenSSL : public Module
ConfigReader Conf;
- std::string confdir(ServerInstance->ConfigFileName);
- // +1 so we the path ends with a /
- confdir = confdir.substr(0, confdir.find_last_of('/') + 1);
-
cafile = Conf.ReadValue("openssl", "cafile", 0);
certfile = Conf.ReadValue("openssl", "certfile", 0);
keyfile = Conf.ReadValue("openssl", "keyfile", 0);
@@ -182,29 +178,16 @@ class ModuleSSLOpenSSL : public Module
// Set all the default values needed.
if (cafile.empty())
- cafile = "ca.pem";
+ cafile = "conf/ca.pem";
if (certfile.empty())
- certfile = "cert.pem";
+ certfile = "conf/cert.pem";
if (keyfile.empty())
- keyfile = "key.pem";
+ keyfile = "conf/key.pem";
if (dhfile.empty())
- dhfile = "dhparams.pem";
-
- // Prepend relative paths with the path to the config directory.
- if ((cafile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(cafile)))
- cafile = confdir + cafile;
-
- if ((certfile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(certfile)))
- certfile = confdir + certfile;
-
- if ((keyfile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(keyfile)))
- keyfile = confdir + keyfile;
-
- if ((dhfile[0] != '/') && (!ServerInstance->Config->StartsWithWindowsDriveLetter(dhfile)))
- dhfile = confdir + dhfile;
+ dhfile = "conf/dhparams.pem";
/* Load our keys and certificates
* NOTE: OpenSSL's error logging API sucks, don't blame us for this clusterfuck.