From 6d075c9c2ba9c71223c51357751cbead87fb71d3 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 11 Apr 2014 01:03:36 +0200 Subject: m_ssl_openssl Avoid Applink on Windows by calling PEM_read_bio_DHparams() instead of PEM_read_DHparams() --- src/modules/extra/m_ssl_openssl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) -- cgit v1.2.3