diff options
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_ldap.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 29 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 24 |
4 files changed, 37 insertions, 24 deletions
diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index 4666a86a2..9f8d68427 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -23,8 +23,8 @@ #include <ldap.h> #ifdef _WIN32 -# pragma comment(lib, "ldap.lib") -# pragma comment(lib, "lber.lib") +# pragma comment(lib, "libldap.lib") +# pragma comment(lib, "liblber.lib") #endif /* $LinkerFlags: -lldap */ diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index fd1a83112..1002a98ba 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -28,9 +28,7 @@ #include "modules/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 718bdd1ea..e6efb9771 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -47,14 +47,7 @@ #endif #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 /* $CompileFlags: pkgconfincludes("gnutls","/gnutls/gnutls.h","") eval("print `libgcrypt-config --cflags | tr -d \r` if `pkg-config --modversion gnutls 2>/dev/null | tr -d \r` lt '2.12'") */ @@ -693,11 +686,23 @@ class GnuTLSIOHook : public SSLIOHook goto info_done_dealloc; } - gnutls_x509_crt_get_dn(cert, str, &name_size); - certinfo->dn = str; + if (gnutls_x509_crt_get_dn(cert, str, &name_size) == 0) + { + std::string& dn = certinfo->dn; + dn = str; + // Make sure there are no chars in the string that we consider invalid + if (dn.find_first_of("\r\n") != std::string::npos) + dn.clear(); + } - gnutls_x509_crt_get_issuer_dn(cert, str, &name_size); - certinfo->issuer = str; + name_size = sizeof(str); + if (gnutls_x509_crt_get_issuer_dn(cert, str, &name_size) == 0) + { + std::string& issuer = certinfo->issuer; + issuer = str; + if (issuer.find_first_of("\r\n") != std::string::npos) + issuer.clear(); + } if ((ret = gnutls_x509_crt_get_fingerprint(cert, profile->GetHash(), digest, &digest_size)) < 0) { diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 9101ecd55..afead64d8 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -35,13 +35,8 @@ #include <openssl/err.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") #endif /* $CompileFlags: pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") */ @@ -74,12 +69,21 @@ namespace OpenSSL public: DHParams(const std::string& filename) { +#ifdef _WIN32 + BIO* dhpfile = BIO_new_file(filename.c_str(), "r"); +#else FILE* dhpfile = fopen(filename.c_str(), "r"); +#endif if (dhpfile == NULL) throw Exception("Couldn't open DH file " + filename + ": " + strerror(errno)); +#ifdef _WIN32 + dh = PEM_read_bio_DHparams(dhpfile, NULL, NULL, NULL); + BIO_free(dhpfile); +#else dh = PEM_read_DHparams(dhpfile, NULL, NULL, NULL); fclose(dhpfile); +#endif if (!dh) throw Exception("Couldn't read DH params from file " + filename); } @@ -357,8 +361,14 @@ class OpenSSLIOHook : public SSLIOHook char buf[512]; X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf)); certinfo->dn = buf; + // Make sure there are no chars in the string that we consider invalid + if (certinfo->dn.find_first_of("\r\n") != std::string::npos) + certinfo->dn.clear(); + X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)); certinfo->issuer = buf; + if (certinfo->issuer.find_first_of("\r\n") != std::string::npos) + certinfo->issuer.clear(); if (!X509_digest(cert, profile->GetDigest(), md, &n)) { |