commit 282cb7a08cb0d160323c10ce3171167d9e509284
parent e8a58b4d6712be493080f78f1a45a598893d8e92
Author: Colin Leroy <colin@colino.net>
Date: Fri, 17 Dec 2010 00:26:23 +0000
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!)
Diffstat:
13 files changed, 82 insertions(+), 22 deletions(-)
diff --git 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
diff --git a/PATCHSETS b/PATCHSETS
@@ -4079,3 +4079,4 @@
( 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
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=5
+EXTRA_VERSION=6
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
+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)
diff --git a/src/addressadd.c b/src/addressadd.c
@@ -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 ) {
- 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 ) );
diff --git a/src/addressbook.c b/src/addressbook.c
@@ -91,7 +91,9 @@
#include "expldifdlg.h"
#include "browseldap.h"
#include "addrcustomattr.h"
-
+#ifdef G_OS_WIN32
+#undef interface
+#endif
typedef enum
{
COL_SOURCES = 0,
diff --git a/src/addrindex.c b/src/addrindex.c
@@ -61,6 +61,10 @@
#include "ldaputil.h"
#endif
+#ifdef G_OS_WIN32
+#undef interface
+#endif
+
#define TAG_ADDRESS_INDEX "addressbook"
#define TAG_IF_ADDRESS_BOOK "book_list"
diff --git a/src/ldapquery.c b/src/ldapquery.c
@@ -30,7 +30,6 @@
#include <glib.h>
#include <sys/time.h>
#include <string.h>
-#include <lber.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 );
- 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 );
@@ -1011,8 +1007,6 @@ static void ldapqry_destroyer( void * ptr ) {
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");
diff --git a/src/ldapquery.h b/src/ldapquery.h
@@ -30,8 +30,14 @@
#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"
diff --git a/src/ldapserver.c b/src/ldapserver.c
@@ -30,8 +30,6 @@
#include <glib.h>
#include <sys/time.h>
#include <string.h>
-#include <ldap.h>
-#include <lber.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;
- int i = LDAP_OPT_X_TLS_ALLOW;
int rc;
+ int i;
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));
-
/* 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);
+#ifdef G_OS_UNIX
ldap_initialize(&ld, uri);
+#else
+ ld = ldap_sslinit(ctl->hostName, ctl->port, ctl->enableSSL);
+#endif
g_free(uri);
if (ld == NULL)
diff --git a/src/ldapserver.h b/src/ldapserver.h
@@ -27,7 +27,19 @@
#ifdef USE_LDAP
#include <glib.h>
+#ifdef G_OS_UNIX
#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"
diff --git a/src/ldapupdate.c b/src/ldapupdate.c
@@ -43,8 +43,6 @@
#include <glib/gi18n.h>
#include <sys/time.h>
#include <string.h>
-#include <ldap.h>
-#include <lber.h>
#include "ldapupdate.h"
#include "mgutils.h"
diff --git a/src/ldaputil.c b/src/ldaputil.c
@@ -30,10 +30,9 @@
#include <glib.h>
#include <string.h>
#include <sys/time.h>
-#include <ldap.h>
-#include <lber.h>
#include <errno.h>
#include "common/utils.h"
+#include "ldaputil.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");
+#ifdef G_OS_UNIX
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");
+#ifdef G_OS_UNIX
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");
diff --git a/src/ldaputil.h b/src/ldaputil.h
@@ -27,7 +27,17 @@
#ifdef USE_LDAP
#include <glib.h>
+#ifdef G_OS_UNIX
#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,