]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: fix BoringSSL symbol conflicts with LDAP and Schannel
authorViktor Szakats <commit@vsz.me>
Thu, 14 Jul 2022 07:14:22 +0000 (07:14 +0000)
committerViktor Szakats <commit@vsz.me>
Thu, 14 Jul 2022 07:14:22 +0000 (07:14 +0000)
Same issue as here [1], but this time when building curl with BoringSSL
for Windows with LDAP(S) or Schannel support enabled.

Apply the same fix [2] for these source files as well.

This can also be fixed by moving `#include "urldata.h"` _before_
including `winldap.h` and `schnlsp.h` respectively. This seems like
a cleaner fix, though I'm not sure why it works and if it has any
downside.

[1] https://github.com/curl/curl/issues/5669
[2] https://github.com/curl/curl/commit/fbe07c6829ba8c5793c84c2856526e19e9029ab9

Co-authored-by: Jay Satiro
Closes #9110

lib/ldap.c
lib/vtls/schannel.h

index 51a32dc964f8c2bcf1b4ada0a1e5f63e3c79f0fa..410dc72e8af3b7348d272cd1236ce2439b02a287 100644 (file)
  * OpenLDAP library versions, USE_OPENLDAP shall not be defined.
  */
 
+/* Wincrypt must be included before anything that could include OpenSSL. */
+#if defined(USE_WIN32_CRYPTO)
+#include <wincrypt.h>
+/* Undefine wincrypt conflicting symbols for BoringSSL. */
+#undef X509_NAME
+#undef X509_EXTENSIONS
+#undef PKCS7_ISSUER_AND_SERIAL
+#undef PKCS7_SIGNER_INFO
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+#endif
+
 #ifdef USE_WIN32_LDAP           /* Use Windows LDAP implementation. */
 # include <winldap.h>
 # ifndef LDAP_VENDOR_NAME
index 0b4c4d934431d0c89fcde953b462bb2a7127baf4..05323c7a7e75438149c2b1f2110e4cddddccd283 100644 (file)
 
 #ifdef USE_SCHANNEL
 
+/* Wincrypt must be included before anything that could include OpenSSL. */
+#if defined(USE_WIN32_CRYPTO)
+#include <wincrypt.h>
+/* Undefine wincrypt conflicting symbols for BoringSSL. */
+#undef X509_NAME
+#undef X509_EXTENSIONS
+#undef PKCS7_ISSUER_AND_SERIAL
+#undef PKCS7_SIGNER_INFO
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+#endif
+
 #include <schnlsp.h>
 #include <schannel.h>
 #include "curl_sspi.h"