[Commits] ldap-plugin.c 1.11 1.12
miras at claws-mail.org
miras at claws-mail.org
Wed Nov 30 03:12:20 CET 2011
Update of /home/claws-mail/contacts/plugins/ldap
In directory claws-mail:/tmp/cvs-serv1114/plugins/ldap
Modified Files:
ldap-plugin.c
Log Message:
2011-11-30 [mir] 0.6.0cvs32
* plugins/ldap/ldap-plugin.c
* src/dbus/dbus-service.c
Ensure LDAP connection is always closed after
every call since concurrent connections can
give TLS problems.
Index: ldap-plugin.c
===================================================================
RCS file: /home/claws-mail/contacts/plugins/ldap/ldap-plugin.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ldap-plugin.c 28 Nov 2011 21:45:27 -0000 1.11
+++ ldap-plugin.c 30 Nov 2011 02:12:18 -0000 1.12
@@ -463,7 +463,7 @@
else
timeOut.tv_sec = TIMEOUT;
- rc = ldap_set_option( NULL, LDAP_OPT_PROTOCOL_VERSION, &version);
+ rc = ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &version);
if (rc != LDAP_OPT_SUCCESS) {
ldap_unbind_ext(server->ldap, NULL, NULL);
server->ldap = NULL;
@@ -471,7 +471,8 @@
debug_print("%s\n", ldap_err2string(rc));
return TRUE;
}
- ldap_set_option( NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeOut);
+ ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &timeOut);
+ ldap_set_option(NULL, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
#ifdef LDAP_TLS
if (info->ldaps) {
@@ -1532,6 +1533,9 @@
*error = g_strdup(_("Missing address book connection"));
return TRUE;
}
+ if (ldap_connect(ac, error))
+ return TRUE;
+
server = ac->server;
ac->contact = (Contact *) contact;
@@ -1541,6 +1545,7 @@
if (*error)
*error = g_strdup(_("LDAP Add: Unresolved error"));
abook->dirty = FALSE;
+ deconnect(ac->server);
return TRUE;
}
@@ -1608,9 +1613,11 @@
}
else {
abook->dirty = TRUE;
+ deconnect(ac->server);
return FALSE;
}
+ deconnect(ac->server);
return TRUE;
}
@@ -1641,6 +1648,9 @@
*error = g_strdup(_("Missing address book connection"));
return TRUE;
}
+ if (ldap_connect(ac, error))
+ return TRUE;
+
server = ac->server;
ac->contact = (Contact *) contact;
@@ -1653,6 +1663,7 @@
if (*error)
*error = g_strdup(ldap_err2string(rc));
abook->dirty = FALSE;
+ deconnect(ac->server);
return TRUE;
}
}
@@ -1661,11 +1672,13 @@
if (*error)
*error = g_strdup(_("No such contact"));
abook->dirty = FALSE;
+ deconnect(ac->server);
return TRUE;
}
abook->dirty = TRUE;
-
+ deconnect(ac->server);
+
return FALSE;
}
@@ -1715,6 +1728,9 @@
*error = g_strdup(_("Missing address book connection"));
return TRUE;
}
+ if (ldap_connect(ac, error))
+ return TRUE;
+
server = ac->server;
ac->contact = (Contact *) contact;
@@ -1820,10 +1836,12 @@
if (error)
*error = g_strdup(ldap_err2string(rc));
abook->dirty = FALSE;
+ deconnect(ac->server);
return TRUE;
}
else {
abook->dirty = TRUE;
+ deconnect(ac->server);
return FALSE;
}
gslist_free(&diff, contact_change_free);
@@ -1833,6 +1851,7 @@
dn = NULL;
if (self->set_contact(abook, contact, error)) {
abook->dirty = FALSE;
+ deconnect(ac->server);
return TRUE;
}
}
@@ -1842,10 +1861,12 @@
if (*error)
*error = g_strdup(_("LDAP Update: Unresolved error"));
abook->dirty = FALSE;
+ deconnect(ac->server);
return TRUE;
}
abook->dirty = TRUE;
+ deconnect(ac->server);
return FALSE;
}
@@ -1892,6 +1913,7 @@
if (removed)
closed_books = g_list_prepend(closed_books, abook);
g_list_book_remove(&abooks, abook);
+ deconnect(ac->server);
return FALSE;
}
if (fetch_all(abook, ac, error)) {
@@ -1902,13 +1924,15 @@
if (removed)
closed_books = g_list_prepend(closed_books, abook);
g_list_book_remove(&abooks, abook);
+ deconnect(ac->server);
return FALSE;
}
}
abook->dirty = FALSE;
}
abook->open = TRUE;
-
+ deconnect(ac->server);
+
return TRUE;
}
@@ -1928,9 +1952,14 @@
*error = g_strdup_printf(_("%s: Not found"), abook->abook_name);
return FALSE;
}
+ if (ldap_connect(ac, error))
+ return FALSE;
if (abook->open)
self->abook_close(abook, error);
+
+ deconnect(ac->server);
+
/* Remove from closed books since deleting */
closed_books = g_list_remove(closed_books, abook);
abook_connection = g_slist_remove(abook_connection, ac);
More information about the Commits
mailing list