summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-04-11 01:03:36 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-04-13 16:06:30 +0200
commit6d075c9c2ba9c71223c51357751cbead87fb71d3 (patch)
tree6ff5d8aea8c7ea5dafa0f023a024e82df70b03d2
parentd42408a299f62cd01385215a0c6df96db05bf301 (diff)
m_ssl_openssl Avoid Applink on Windows by calling PEM_read_bio_DHparams() instead of PEM_read_DHparams()
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 9a54ff80b..91a3d7269 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -249,7 +249,11 @@ class ModuleSSLOpenSSL : public Module
ERR_print_errors_cb(error_callback, this);
}
+#ifdef _WIN32
+ BIO* dhpfile = BIO_new_file(dhfile.c_str(), "r");
+#else
FILE* dhpfile = fopen(dhfile.c_str(), "r");
+#endif
DH* ret;
if (dhpfile == NULL)
@@ -259,7 +263,12 @@ class ModuleSSLOpenSSL : public Module
}
else
{
+#ifdef _WIN32
+ ret = PEM_read_bio_DHparams(dhpfile, NULL, NULL, NULL);
+ BIO_free(dhpfile);
+#else
ret = PEM_read_DHparams(dhpfile, NULL, NULL, NULL);
+#endif
if ((SSL_CTX_set_tmp_dh(ctx, ret) < 0) || (SSL_CTX_set_tmp_dh(clictx, ret) < 0))
{
ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str());
@@ -268,7 +277,9 @@ class ModuleSSLOpenSSL : public Module
DH_free(ret);
}
+#ifndef _WIN32
fclose(dhpfile);
+#endif
}
void On005Numeric(std::string &output)