[evolution-data-server] Use OpenLDAP in Win32 builds as well



commit 0387e9c7b425ea96fbd6c838d84db3bf67780420
Author: Milan Crha <mcrha redhat com>
Date:   Sun Jun 1 21:02:43 2014 +0200

    Use OpenLDAP in Win32 builds as well
    
    Even it's another dependency, it should provide more code consistency.

 addressbook/backends/ldap/e-book-backend-ldap.c |   70 -----------------------
 configure.ac                                    |   70 +++++++++-------------
 2 files changed, 29 insertions(+), 111 deletions(-)
---
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index a2b2a05..c7775ab 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -32,7 +32,6 @@
 
 #include <glib.h>
 
-#ifndef G_OS_WIN32
 #ifdef DEBUG
 #define LDAP_DEBUG
 #define LDAP_DEBUG_ADD
@@ -42,63 +41,9 @@
 #ifdef DEBUG
 #undef LDAP_DEBUG
 #endif
-#else
-#include <windows.h>
-#include <winldap.h>
-#define LDAP_RES_RENAME LDAP_RES_MODRDN
-#include <winber.h>
-#include "openldap-extract.h"
-
-/* map between the WinLDAP API and OpenLDAP API */
-#  ifndef ldap_msgtype
-#    define ldap_msgtype(m) ((m)->lm_msgtype)
-#  endif
-
-#  ifndef ldap_first_message
-#    define ldap_first_message ldap_first_entry
-#  endif
-
-#  ifndef ldap_next_message
-#    define ldap_next_message ldap_next_entry
-#  endif
-
-#  ifndef LDAP_RES_MODDN
-#    define LDAP_RES_MODDN LDAP_RES_MODRDN
-#  endif
-
-#  ifdef ldap_compare_ext
-#    undef ldap_compare_ext
-#  endif
-#  ifdef ldap_search_ext
-#    undef ldap_search_ext
-#  endif
-
-#  ifdef UNICODE
-#    define ldap_compare_ext(ld,dn,a,v,sc,cc,msg) \
-        ldap_compare_extW (ld,dn,a,0,v,sc,cc,msg)
-#    define ldap_search_ext(ld,base,scope,f,a,o,sc,cc,(t),s,msg) \
-        ldap_search_extW (ld,base,scope,f,a,o,sc,cc,((PLDAP_TIMEVAL) t) ? ((PLDAP_TIMEVAL) t)->tv_sec : 
0,s,msg)
-# if defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)
-#    define ldap_start_tls_s(ld,sc,cc) \
-        ldap_start_tls_sW (ld,0,0,sc,cc)
-# endif
-#  else /* !UNICODE */
-#    define ldap_compare_ext(ld,dn,a,v,sc,cc,msg) \
-        ldap_compare_extA (ld,dn,a,0,v,sc,cc,msg)
-#    define ldap_search_ext(ld,base,scope,f,a,o,sc,cc,t,s,msg) \
-        ldap_search_extA (ld,base,scope,f,a,o,sc,cc,((PLDAP_TIMEVAL) t) ? ((PLDAP_TIMEVAL) t)->tv_sec : 
0,s,msg)
-# if defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)
-#    define ldap_start_tls_s(ld,sc,cc) \
-        ldap_start_tls_sA (ld,0,0,sc,cc)
-# endif
-#  endif /* UNICODE */
-
-#endif
 
 #define d(x)
 
-#ifndef G_OS_WIN32
-
 #if LDAP_VENDOR_VERSION > 20000
 #define OPENLDAP2
 #else
@@ -115,8 +60,6 @@
 #include "openldap-extract.h"
 #endif
 
-#endif
-
 #include <sys/time.h>
 
 #include <glib/gi18n-lib.h>
@@ -913,20 +856,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl,
                                ldap_set_option (blpriv->ldap, LDAP_OPT_RECONNECT, LDAP_OPT_ON );
                        }
 #else
-#ifdef _WIN32
-                       typedef ULONG (*PFN_ldap_start_tls_s)(PLDAP,PLDAPControl *,PLDAPControl *);
-                       PFN_ldap_start_tls_s pldap_start_tls_s =
-                       (PFN_ldap_start_tls_s) GetProcAddress (GetModuleHandle ("wldap32.dll"), 
"ldap_start_tls_s");
-                       if (!pldap_start_tls_s)
-                               (PFN_ldap_start_tls_s) GetProcAddress (GetModuleHandle ("wldap32.dll"), 
"ldap_start_tls_sA");
-
-                       if (!pldap_start_tls_s)
-                               ldap_error = LDAP_NOT_SUPPORTED;
-                       else
-                               ldap_error = pldap_start_tls_s (blpriv->ldap, NULL, NULL);
-#else /* !defined(_WIN32) */
                        ldap_error = ldap_start_tls_s (blpriv->ldap, NULL, NULL);
-#endif /* _WIN32 */
 #endif
                        if (ldap_error != LDAP_SUCCESS) {
                                g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", 
ldap_error);
diff --git a/configure.ac b/configure.ac
index 309a7bb..1fd2e4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1376,57 +1376,45 @@ EVO_PURIFY_SUPPORT
 dnl ******************************
 dnl LDAP support.
 dnl ******************************
-if test "x$os_win32" != "xyes"; then
-       EVO_LDAP_CHECK(no)
-       case $with_openldap in
+EVO_LDAP_CHECK(no)
+case $with_openldap in
+no)
+       msg_ldap="no"
+;;
+*)
+       case $with_static_ldap in
+       yes)
+               msg_ldap="$with_openldap (static)"
+               ;;
+       *)
+               msg_ldap="$with_openldap (dynamic)"
+               ;;
+       esac
+esac
+
+dnl SunLDAP support, but if OpenLDAP support, skip check SunLDAP.
+if test "x$with_openldap" = "xno" ; then
+       EVO_SUNLDAP_CHECK(no)
+       case $with_sunldap in
        no)
                msg_ldap="no"
-       ;;
+               ;;
        *)
-               case $with_static_ldap in
+               case $with_static_sunldap in
                yes)
-                       msg_ldap="$with_openldap (static)"
+                       msg_ldap="$with_sunldap (static)"
                        ;;
                *)
-                       msg_ldap="$with_openldap (dynamic)"
+                       msg_ldap="$with_sunldap (dynamic)"
                        ;;
-               esac
        esac
-
-dnl SunLDAP support, but if OpenLDAP support, skip check SunLDAP.
-       if test "x$with_openldap" = "xno" ; then
-               EVO_SUNLDAP_CHECK(no)
-               case $with_sunldap in
-               no)
-                       msg_ldap="no"
-                       ;;
-               *)
-                       case $with_static_sunldap in
-                       yes)
-                               msg_ldap="$with_sunldap (static)"
-                               ;;
-                       *)
-                               msg_ldap="$with_sunldap (dynamic)"
-                               ;;
-               esac
-       esac
-       else
-               with_sunldap="no"
-       fi
-       AM_CONDITIONAL(SUNLDAP, [test "$with_sunldap" != no])
-
-       LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
+esac
 else
-       dnl Win32 LDAP support
-       LDAP_CFLAGS="-DLDAP_DEPRECATED"
-       LDAP_LIBS="-lwldap32"
-       AC_SUBST(LDAP_CFLAGS)
-       AC_SUBST(LDAP_LIBS)
-       AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
-       AM_CONDITIONAL(ENABLE_LDAP, true)
-       AM_CONDITIONAL(SUNLDAP, false)
-       msg_ldap="yes"
+       with_sunldap="no"
 fi
+AM_CONDITIONAL(SUNLDAP, [test "$with_sunldap" != no])
+
+LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
 
 dnl ******************************
 dnl Utility macro to set compiler flags for a specific lib.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]