From 88dccdd5f04e9244323de0eb197590ab8e7292fd Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Apr 2014 21:46:19 -0400 Subject: Change Windows libraries to be dynamically linked --- src/modules/extra/m_ldapauth.cpp | 4 ++-- src/modules/extra/m_ldapoper.cpp | 4 ++-- src/modules/extra/m_mysql.cpp | 4 +--- src/modules/extra/m_ssl_gnutls.cpp | 24 ++++++++++++++++-------- src/modules/extra/m_ssl_openssl.cpp | 9 ++------- 5 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 5b3f1e7cc..6c765fb2e 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -31,8 +31,8 @@ #include #ifdef _WIN32 -# pragma comment(lib, "ldap.lib") -# pragma comment(lib, "lber.lib") +# pragma comment(lib, "libldap.lib") +# pragma comment(lib, "liblber.lib") #endif /* $ModDesc: Allow/Deny connections based upon answer from LDAP server */ diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 53896878c..1f46361d4 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -28,8 +28,8 @@ #include #ifdef _WIN32 -# pragma comment(lib, "ldap.lib") -# pragma comment(lib, "lber.lib") +# pragma comment(lib, "libldap.lib") +# pragma comment(lib, "liblber.lib") #endif /* $ModDesc: Adds the ability to authenticate opers via LDAP */ diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 22cf5f3f4..01b1553b0 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -28,9 +28,7 @@ #include "sql.h" #ifdef _WIN32 -# pragma comment(lib, "mysqlclient.lib") -# pragma comment(lib, "advapi32.lib") -# pragma comment(linker, "/NODEFAULTLIB:LIBCMT") +# pragma comment(lib, "libmysql.lib") #endif /* VERSION 3 API: With nonblocking (threaded) requests */ diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 1f1297ef9..03673d7a0 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -22,21 +22,16 @@ #include "inspircd.h" +#ifndef _WIN32 #include +#endif #include #include #include "ssl.h" #include "m_cap.h" #ifdef _WIN32 -# pragma comment(lib, "libgnutls.lib") -# pragma comment(lib, "libgcrypt.lib") -# pragma comment(lib, "libgpg-error.lib") -# pragma comment(lib, "user32.lib") -# pragma comment(lib, "advapi32.lib") -# pragma comment(lib, "libgcc.lib") -# pragma comment(lib, "libmingwex.lib") -# pragma comment(lib, "gdi32.lib") +# pragma comment(lib, "libgnutls-28.lib") #endif /* $ModDesc: Provides SSL support for clients */ @@ -60,6 +55,13 @@ typedef gnutls_certificate_credentials_t gnutls_certificate_credentials; typedef gnutls_dh_params_t gnutls_dh_params; #endif +#if (defined(_WIN32) && (GNUTLS_VERSION_MAJOR > 2 || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR >= 12))) +# define GNUTLS_HAS_RND +# include +#else +# include +#endif + enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED }; static std::vector x509_certs; @@ -89,7 +91,11 @@ class RandGen : public HandlerBase2 RandGen() {} void Call(char* buffer, size_t len) { +#ifdef GNUTLS_HAS_RND + gnutls_rnd(GNUTLS_RND_RANDOM, buffer, len); +#else gcry_randomize(buffer, len, GCRY_STRONG_RANDOM); +#endif } }; @@ -250,7 +256,9 @@ class ModuleSSLGnuTLS : public Module ModuleSSLGnuTLS() : starttls(this), capHandler(this, "tls"), iohook(this, "ssl/gnutls", SERVICE_IOHOOK) { +#ifndef GNUTLS_HAS_RND gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif sessions = new issl_session[ServerInstance->SE->GetMaxFds()]; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 91a3d7269..60c90988a 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -36,13 +36,8 @@ #include "ssl.h" #ifdef _WIN32 -# pragma comment(lib, "libcrypto.lib") -# pragma comment(lib, "libssl.lib") -# pragma comment(lib, "user32.lib") -# pragma comment(lib, "advapi32.lib") -# pragma comment(lib, "libgcc.lib") -# pragma comment(lib, "libmingwex.lib") -# pragma comment(lib, "gdi32.lib") +# pragma comment(lib, "ssleay32.lib") +# pragma comment(lib, "libeay32.lib") # undef MAX_DESCRIPTORS # define MAX_DESCRIPTORS 10000 #endif -- cgit v1.2.3