From a557a74615774b228dae14cf83a92ec26e2b03b5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 23 Apr 2013 17:04:56 +0200 Subject: [PATCH] Allow building gpgkeys_ldap with the 32 bit mingw-w64 toolchain. * keyserver/gpgkeys_ldap.c (my_ldap_start_tls_s): Define macro depending on compiler version. (main): Use new macro. -- It seems that the LDAP keyserver helper if build with the old mingw32 toolchain never worked correctly for LDAPS. The prototype there for ldap_start_tls_s is plainly wrong for Windows. However, the fix here has special support so not to break building with the old compiler. --- keyserver/gpgkeys_ldap.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c index bd8523466..9f99b28e9 100644 --- a/keyserver/gpgkeys_ldap.c +++ b/keyserver/gpgkeys_ldap.c @@ -61,6 +61,21 @@ #include "util.h" #endif + +#if HAVE_W32_SYSTEM +# if !defined(__MINGW64_VERSION_MAJOR) || !defined(__MINGW32_MAJOR_VERSION) + /* This is mingw32 with bogus ldap definitions; i.e. Unix style + LDAP definitions. */ +# define my_ldap_start_tls_s(a,b,c) ldap_start_tls_sA ((a),(b),(c)) +# else + /* Standard Microsoft or mingw64. */ +# define my_ldap_start_tls_s(a,b,c) ldap_start_tls_sA ((a),NULL,NULL,(b),(c)) +# endif +#else /*!W32*/ +# define my_ldap_start_tls_s(a,b,c) ldap_start_tls_s ((a),(b),(c)) +#endif /*!W32*/ + + extern char *optarg; extern int optind; @@ -2189,7 +2204,7 @@ main(int argc,char *argv[]) #endif if(err==LDAP_SUCCESS) - err=ldap_start_tls_s(ldap,NULL,NULL); + err = my_ldap_start_tls_s (ldap, NULL, NULL); if(err!=LDAP_SUCCESS) {