Remove magic path resolution from certificate files

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11868 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
danieldg 2009-10-13 14:32:18 +00:00
parent 2d043de488
commit da983dcea7
2 changed files with 8 additions and 42 deletions

View File

@ -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)

View File

@ -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.