2010-12-17 [colin] 3.7.8cvs6
authorColin Leroy <colin@colino.net>
Fri, 17 Dec 2010 00:26:23 +0000 (00:26 +0000)
committerColin Leroy <colin@colino.net>
Fri, 17 Dec 2010 00:26:23 +0000 (00:26 +0000)
* src/addressadd.c
* src/addressbook.c
* src/addrindex.c
* src/ldapquery.c
* src/ldapquery.h
* src/ldapserver.c
* src/ldapserver.h
* src/ldapupdate.c
* src/ldaputil.c
* src/ldaputil.h
Windows build fixes (w32 LDAP completely untested!)

13 files changed:
ChangeLog
PATCHSETS
configure.ac
src/addressadd.c
src/addressbook.c
src/addrindex.c
src/ldapquery.c
src/ldapquery.h
src/ldapserver.c
src/ldapserver.h
src/ldapupdate.c
src/ldaputil.c
src/ldaputil.h

index ded67848d091f72afc57b015726d3f70d5ad8178..8dac12d148dfcc35178cc43f791454deb26037c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-17 [colin]     3.7.8cvs6
+
+       * src/addressadd.c
+       * src/addressbook.c
+       * src/addrindex.c
+       * src/ldapquery.c
+       * src/ldapquery.h
+       * src/ldapserver.c
+       * src/ldapserver.h
+       * src/ldapupdate.c
+       * src/ldaputil.c
+       * src/ldaputil.h
+               Windows build fixes (w32 LDAP completely untested!)
+
 2010-12-16 [colin]     3.7.8cvs5
 
        * src/addrindex.c
 2010-12-16 [colin]     3.7.8cvs5
 
        * src/addrindex.c
index d73656e662bf536cefa603c235e38486d9942943..7a4bc189fc82f8ebb7d680be5c143b901ccccb0b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.43.2.85 -r 1.43.2.86 src/prefs_matcher.c;  ) > 3.7.8cvs3.patchset
 ( cvs diff -u -r 1.5.2.40 -r 1.5.2.41 src/prefs_spelling.c;  cvs diff -u -r 1.9.2.49 -r 1.9.2.50 src/common/defs.h;  ) > 3.7.8cvs4.patchset
 ( cvs diff -u -r 1.28.2.44 -r 1.28.2.45 src/addrindex.c;  cvs diff -u -r 1.8.2.37 -r 1.8.2.38 src/editldap.c;  cvs diff -u -r 1.2.2.21 -r 1.2.2.22 src/ldapctrl.c;  cvs diff -u -r 1.3.2.34 -r 1.3.2.35 src/ldapquery.c;  cvs diff -u -r 1.4.2.18 -r 1.4.2.19 src/ldapserver.c;  cvs diff -u -r 1.2.2.11 -r 1.2.2.12 src/ldapserver.h;  cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/ldapupdate.c;  cvs diff -u -r 1.1.4.16 -r 1.1.4.17 src/ldaputil.c;  ) > 3.7.8cvs5.patchset
 ( cvs diff -u -r 1.43.2.85 -r 1.43.2.86 src/prefs_matcher.c;  ) > 3.7.8cvs3.patchset
 ( cvs diff -u -r 1.5.2.40 -r 1.5.2.41 src/prefs_spelling.c;  cvs diff -u -r 1.9.2.49 -r 1.9.2.50 src/common/defs.h;  ) > 3.7.8cvs4.patchset
 ( cvs diff -u -r 1.28.2.44 -r 1.28.2.45 src/addrindex.c;  cvs diff -u -r 1.8.2.37 -r 1.8.2.38 src/editldap.c;  cvs diff -u -r 1.2.2.21 -r 1.2.2.22 src/ldapctrl.c;  cvs diff -u -r 1.3.2.34 -r 1.3.2.35 src/ldapquery.c;  cvs diff -u -r 1.4.2.18 -r 1.4.2.19 src/ldapserver.c;  cvs diff -u -r 1.2.2.11 -r 1.2.2.12 src/ldapserver.h;  cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/ldapupdate.c;  cvs diff -u -r 1.1.4.16 -r 1.1.4.17 src/ldaputil.c;  ) > 3.7.8cvs5.patchset
+( cvs diff -u -r 1.9.2.30 -r 1.9.2.31 src/addressadd.c;  cvs diff -u -r 1.60.2.138 -r 1.60.2.139 src/addressbook.c;  cvs diff -u -r 1.28.2.45 -r 1.28.2.46 src/addrindex.c;  cvs diff -u -r 1.3.2.35 -r 1.3.2.36 src/ldapquery.c;  cvs diff -u -r 1.4.2.13 -r 1.4.2.14 src/ldapquery.h;  cvs diff -u -r 1.4.2.19 -r 1.4.2.20 src/ldapserver.c;  cvs diff -u -r 1.2.2.12 -r 1.2.2.13 src/ldapserver.h;  cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/ldapupdate.c;  cvs diff -u -r 1.1.4.17 -r 1.1.4.18 src/ldaputil.c;  cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/ldaputil.h;  ) > 3.7.8cvs6.patchset
index 8928365fe28ed6a641146af3ceab9406a6776865..12a35cb1c6c611f5108c06b031747ac0f4b801e8 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=5
+EXTRA_VERSION=6
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
@@ -666,6 +666,12 @@ elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then
        AC_MSG_RESULT(no - LDAP support needs pthread support)
 
        ac_cv_enable_ldap=no
        AC_MSG_RESULT(no - LDAP support needs pthread support)
 
        ac_cv_enable_ldap=no
+elif test x"$platform_win32" = xyes; then
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
+       AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
+       LDAP_LIBS="-lwldap32"
+       AC_SUBST(LDAP_LIBS)
 else
        AC_MSG_RESULT(yes)
 
 else
        AC_MSG_RESULT(yes)
 
index afd743892a9272320dbac04fd9c5455739d1eac0..13328b23bdf1d21ddfd72047e0a6ab50867ea66a 100644 (file)
@@ -332,10 +332,10 @@ static void addressadd_load_data( AddressIndex *addrIndex ) {
        gtk_cmclist_clear( GTK_CMCLIST( tree ) );
        list = addrindex_get_interface_list( addrIndex );
        while( list ) {
        gtk_cmclist_clear( GTK_CMCLIST( tree ) );
        list = addrindex_get_interface_list( addrIndex );
        while( list ) {
-               AddressInterface *interface = list->data;
-               if( interface->type == ADDR_IF_BOOK || 
-                               interface->type == ADDR_IF_LDAP ) {
-                       nodeDS = interface->listSource;
+               AddressInterface *ainterface = list->data;
+               if( ainterface->type == ADDR_IF_BOOK || 
+                               ainterface->type == ADDR_IF_LDAP ) {
+                       nodeDS = ainterface->listSource;
                        while( nodeDS ) {
                                ds = nodeDS->data;
                                dsName = g_strdup( addrindex_ds_get_name( ds ) );
                        while( nodeDS ) {
                                ds = nodeDS->data;
                                dsName = g_strdup( addrindex_ds_get_name( ds ) );
index f608e7984646668aaf2595f6c04f4d079f896da8..0dd13f39c28d1f9c531e3137b84fd5559eb9b370 100644 (file)
@@ -91,7 +91,9 @@
 #include "expldifdlg.h"
 #include "browseldap.h"
 #include "addrcustomattr.h"
 #include "expldifdlg.h"
 #include "browseldap.h"
 #include "addrcustomattr.h"
-
+#ifdef G_OS_WIN32
+#undef interface
+#endif
 typedef enum
 {
        COL_SOURCES     = 0,
 typedef enum
 {
        COL_SOURCES     = 0,
index 953051f23401ff6ad4c1d3664898e6c3f77a9c3e..bb3ca7207b5e1ab1df4479e1c817d7b557991f8b 100644 (file)
 #include "ldaputil.h"
 #endif
 
 #include "ldaputil.h"
 #endif
 
+#ifdef G_OS_WIN32
+#undef interface
+#endif
+
 #define TAG_ADDRESS_INDEX    "addressbook"
 
 #define TAG_IF_ADDRESS_BOOK  "book_list"
 #define TAG_ADDRESS_INDEX    "addressbook"
 
 #define TAG_IF_ADDRESS_BOOK  "book_list"
index 4e78a7e719d18c96f46e7a6e5df680c79402d03c..2af3efe6981e5990585822fc9614e52be5949dd4 100644 (file)
@@ -30,7 +30,6 @@
 #include <glib.h>
 #include <sys/time.h>
 #include <string.h>
 #include <glib.h>
 #include <sys/time.h>
 #include <string.h>
-#include <lber.h>
 
 #include "defs.h"
 #include "ldaputil.h"
 
 #include "defs.h"
 #include "ldaputil.h"
@@ -992,9 +991,6 @@ static void ldapqry_destroyer( void * ptr ) {
        qry = ( LdapQuery * ) ptr;
        cm_return_if_fail( qry != NULL );
 
        qry = ( LdapQuery * ) ptr;
        cm_return_if_fail( qry != NULL );
 
-       debug_print("ldapqry_destroyer::%d::%s\n", (int) pthread_self(),
-                       ADDRQUERY_NAME(qry)?ADDRQUERY_NAME(qry):"null");
-
        /* Perform any destruction here */
        if( qry->control != NULL ) {
                ldapctl_free( qry->control );
        /* Perform any destruction here */
        if( qry->control != NULL ) {
                ldapctl_free( qry->control );
@@ -1011,8 +1007,6 @@ static void ldapqry_destroyer( void * ptr ) {
 void ldapqry_cancel( LdapQuery *qry ) {
        cm_return_if_fail( qry != NULL );
 
 void ldapqry_cancel( LdapQuery *qry ) {
        cm_return_if_fail( qry != NULL );
 
-       debug_print("cancelling::%d::%s\n", (int) pthread_self(),
-                       ADDRQUERY_NAME(qry)?ADDRQUERY_NAME(qry):"null");
        if( ldapqry_get_busy_flag( qry ) ) {
                if( qry->thread ) {
                        debug_print("calling pthread_cancel\n");
        if( ldapqry_get_busy_flag( qry ) ) {
                if( qry->thread ) {
                        debug_print("calling pthread_cancel\n");
index 76821230abc262ee003f8c5cf6259890f00b7fd7..1af0abf5e83d8f23234c234292eabfde32533f5f 100644 (file)
 #include <stdio.h>
 #include <sys/time.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <sys/time.h>
 #include <pthread.h>
-#include <ldap.h>
 
 
+#ifdef G_OS_UNIX
+#include <ldap.h>
+#include <lber.h>
+#else
+#include <windows.h>
+#include <winldap.h>
+#endif
 #include "addrquery.h"
 #include "ldapctrl.h"
 #include "addritem.h"
 #include "addrquery.h"
 #include "ldapctrl.h"
 #include "addritem.h"
index 86d5ad86f6857f5b3e2378f516a6f5733ad563a3..670cbab4e2f7ac1d9d5b5aa2960a6a9aaed2074a 100644 (file)
@@ -30,8 +30,6 @@
 #include <glib.h>
 #include <sys/time.h>
 #include <string.h>
 #include <glib.h>
 #include <sys/time.h>
 #include <string.h>
-#include <ldap.h>
-#include <lber.h>
 
 #include "mgutils.h"
 #include "addritem.h"
 
 #include "mgutils.h"
 #include "addritem.h"
@@ -719,17 +717,21 @@ gint ldapsvr_read_data( LdapServer *server )
 void ldapsrv_set_options (gint secs, LDAP *ld)
 {
        static struct timeval timeout;
 void ldapsrv_set_options (gint secs, LDAP *ld)
 {
        static struct timeval timeout;
-       int i = LDAP_OPT_X_TLS_ALLOW;
        int rc;
        int rc;
+       int i;
        timeout.tv_sec = secs;
        timeout.tv_usec = 0;
        timeout.tv_sec = secs;
        timeout.tv_usec = 0;
+#ifdef G_OS_UNIX
+       i = LDAP_OPT_X_TLS_ALLOW;
        rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
        debug_print("cert %s\n", ldap_err2string(rc));
        rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
        debug_print("cert %s\n", ldap_err2string(rc));
-       
        /* can crash old libldaps... */
        rc = ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeout);
        debug_print("tm %s\n", ldap_err2string(rc));
        /* can crash old libldaps... */
        rc = ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeout);
        debug_print("tm %s\n", ldap_err2string(rc));
-
+#else
+       rc = ldap_set_option(NULL, LDAP_OPT_TIMELIMIT, &secs);
+       debug_print("tm %s\n", ldap_err2string(rc));
+#endif
 }
 
 /**
 }
 
 /**
@@ -750,7 +752,11 @@ LDAP *ldapsvr_connect(LdapControl *ctl) {
        uri = g_strdup_printf("ldap%s://%s:%d",
                                ctl->enableSSL?"s":"",
                                ctl->hostName, ctl->port);
        uri = g_strdup_printf("ldap%s://%s:%d",
                                ctl->enableSSL?"s":"",
                                ctl->hostName, ctl->port);
+#ifdef G_OS_UNIX
        ldap_initialize(&ld, uri);
        ldap_initialize(&ld, uri);
+#else
+       ld = ldap_sslinit(ctl->hostName, ctl->port, ctl->enableSSL);
+#endif
        g_free(uri);
 
        if (ld == NULL)
        g_free(uri);
 
        if (ld == NULL)
index 665ec82510e87c62e59b4902c54b3bfc29ce8c36..b1ce2293f18f8e04fd6c85f025d87afd33af5fda 100644 (file)
 #ifdef USE_LDAP
 
 #include <glib.h>
 #ifdef USE_LDAP
 
 #include <glib.h>
+#ifdef G_OS_UNIX
 #include <ldap.h>
 #include <ldap.h>
+#else
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <windows.h>
+#include <winldap.h>
+#include <winber.h>
+#endif
 
 #include "ldapctrl.h"
 #include "addritem.h"
 
 #include "ldapctrl.h"
 #include "addritem.h"
index 397a95a892c1f0789629ac85c3b4b22cb64d0823..5d42fb09e0c694b471ec32b7e256daa98c994a9b 100644 (file)
@@ -43,8 +43,6 @@
 #include <glib/gi18n.h>
 #include <sys/time.h>
 #include <string.h>
 #include <glib/gi18n.h>
 #include <sys/time.h>
 #include <string.h>
-#include <ldap.h>
-#include <lber.h>
 
 #include "ldapupdate.h"
 #include "mgutils.h"
 
 #include "ldapupdate.h"
 #include "mgutils.h"
index 2dc77cfe897ac14fb999816a1e787db10171081b..9c74f07c98484f0b27bea9b6c06a8ce984768450 100644 (file)
 #include <glib.h>
 #include <string.h>
 #include <sys/time.h>
 #include <glib.h>
 #include <string.h>
 #include <sys/time.h>
-#include <ldap.h>
-#include <lber.h>
 #include <errno.h>
 #include "common/utils.h"
 #include <errno.h>
 #include "common/utils.h"
+#include "ldaputil.h"
 #include "ldapserver.h"
 #include "ldapctrl.h"
 
 #include "ldapserver.h"
 #include "ldapctrl.h"
 
@@ -208,8 +207,12 @@ int claws_ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *pa
        }
 
        debug_print("binding: DN->%s\n", dn?dn:"null");
        }
 
        debug_print("binding: DN->%s\n", dn?dn:"null");
+#ifdef G_OS_UNIX
        return ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &cred,
                NULL, NULL, NULL );
        return ldap_sasl_bind_s( ld, dn, LDAP_SASL_SIMPLE, &cred,
                NULL, NULL, NULL );
+#else
+       return ldap_simple_bind_s(ld, dn, passwd);
+#endif
 }
 
 /**
 }
 
 /**
@@ -253,7 +256,11 @@ GList *ldaputil_read_basedn(
        if (baseDN)
                debug_print("Using LDAP v3\n");
 
        if (baseDN)
                debug_print("Using LDAP v3\n");
 
+#ifdef G_OS_UNIX
        if( baseDN == NULL && !LDAP_API_ERROR(rc) ) {
        if( baseDN == NULL && !LDAP_API_ERROR(rc) ) {
+#else
+       if( baseDN == NULL) {
+#endif
                baseDN = ldaputil_test_v2( ld, tov );
                if (baseDN)
                        debug_print("Using LDAP v2\n");
                baseDN = ldaputil_test_v2( ld, tov );
                if (baseDN)
                        debug_print("Using LDAP v2\n");
index 15733bec31cd97ee55426295ab1829f9da0906c6..db6ed9977b97e27e8371fe6f79c041e8a9eb765f 100644 (file)
 #ifdef USE_LDAP
 
 #include <glib.h>
 #ifdef USE_LDAP
 
 #include <glib.h>
+#ifdef G_OS_UNIX
 #include <ldap.h>
 #include <ldap.h>
+#include <lber.h>
+#else
+#include <windows.h>
+#include <winldap.h>
+#define LDAP_CONST const
+#define ldap_unbind_ext(ld,x,y) ldap_unbind_s(ld)
+#define LDAP_ADMINLIMIT_EXCEEDED LDAP_ADMIN_LIMIT_EXCEEDED
+#define timeval l_timeval
+#endif
 /* Function Prototypes */
 GList *ldaputil_read_basedn    ( const gchar *host, const gint port,
                                  const gchar *bindDN, const gchar *bindPW,
 /* Function Prototypes */
 GList *ldaputil_read_basedn    ( const gchar *host, const gint port,
                                  const gchar *bindDN, const gchar *bindPW,