]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove magic path resolution from certificate files
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 13 Oct 2009 14:32:18 +0000 (14:32 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 13 Oct 2009 14:32:18 +0000 (14:32 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11868 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_openssl.cpp

index fd572492a3f4875277855b71dd3b7730cc1e83ac..e3e533cfd912efa48217e66e6d03e2ec876488ce 100644 (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)
index a348726e78dd65f1e0e89796b1faa19df422209c..23501274608f5b40a48517982170f793b202d15b 100644 (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.