]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: fix enabling LDAPS on Windows
authorViktor Szakats <commit@vsz.me>
Sun, 5 Mar 2023 19:55:14 +0000 (19:55 +0000)
committerViktor Szakats <commit@vsz.me>
Sun, 5 Mar 2023 19:55:14 +0000 (19:55 +0000)
Before this patch, enabling LDAPS required a manual C flag:
https://github.com/curl/curl-for-win/blob/c1cfc31cfc04f24f7a4f946564d6f0e1b4d7dd36/curl-cmake.sh#L105

Fix this and enable LDAPS automatically when using `wldap32` (and
when not explicitly disabled). This matches autotools and `Makefile.mk`
behavior. Also remove issue from KNOWN_BUGS.

Add workaround for MSVS 2010 warning triggered by LDAPS now enabled
in more CI tests:
`ldap.c(360): warning C4306: 'type cast' : conversion from 'int' to 'void *' of greater size`
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/46408284/job/v8mwl9yfbmoeqwlr#L312

Reported-by: JackBoosY on github
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Fixes #6284
Closes #10674

CMakeLists.txt
docs/KNOWN_BUGS
lib/ldap.c

index be0e5f8d7c98bfb9a8cbae56226e520e1d73dcac..74361998c43be8468bfa6fc7cd1a3895a5cca7c0 100644 (file)
@@ -571,6 +571,8 @@ if(NOT CURL_DISABLE_LDAP)
       check_library_exists_concat("wldap32" cldap_open HAVE_WLDAP32)
       if(NOT HAVE_WLDAP32)
         set(USE_WIN32_LDAP OFF)
+      elseif(NOT CURL_DISABLE_LDAPS)
+        set(HAVE_LDAP_SSL ON)
       endif()
     endif()
   endif()
index 3b35ad9a66940ea59ef9f317f33878244ff0762a..754ac0348121267f35559e69fb33c7cbd1bbf247 100644 (file)
@@ -109,7 +109,6 @@ problems may have been fixed or changed somewhat since this was written.
  15.8 libcurl.pc uses absolute library paths
  15.10 libpsl is not supported
  15.11 ExternalProject_Add does not set CURL_CA_PATH
- 15.12 cannot enable LDAPS on Windows
  15.13 CMake build with MIT Kerberos does not work
 
  16. Applications
@@ -694,10 +693,6 @@ problems may have been fixed or changed somewhat since this was written.
 
  See https://github.com/curl/curl/issues/6313
 
-15.12 cannot enable LDAPS on Windows
-
- See https://github.com/curl/curl/issues/6284
-
 15.13 CMake build with MIT Kerberos does not work
 
  Minimum CMake version was bumped in curl 7.71.0 (#5358) Since CMake 3.2
index 5e53f4c511510e02f5a531680ef3f7cc53c00267..595e4b3b3bda1faf5a7a4856a9a5f5de43e57980 100644 (file)
@@ -140,6 +140,14 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp);
 #define ldap_err2string ldap_err2stringA
 #endif
 
+#if defined(USE_WIN32_LDAP) && defined(_MSC_VER) && (_MSC_VER <= 1600)
+/* Workaround for warning:
+   'type cast' : conversion from 'int' to 'void *' of greater size */
+#undef LDAP_OPT_ON
+#undef LDAP_OPT_OFF
+#define LDAP_OPT_ON   ((void *)(size_t)1)
+#define LDAP_OPT_OFF  ((void *)(size_t)0)
+#endif
 
 static CURLcode ldap_do(struct Curl_easy *data, bool *done);