[Commits] ldap-plugin.c 1.14 1.15
miras at claws-mail.org
miras at claws-mail.org
Fri Dec 23 23:25:23 CET 2011
Update of /home/claws-mail/contacts/plugins/ldap
In directory claws-mail:/tmp/cvs-serv21173/plugins/ldap
Modified Files:
ldap-plugin.c
Log Message:
2011-12-23 [mir] 0.6.0cvs57
* plugins/ldap/ldap-plugin.c
Fixed two bugs.
1) Missing the default dn if connection was reopened
2) Possible dereferencing a NULL pointer if 'error'
parameter was NULL.
Index: ldap-plugin.c
===================================================================
RCS file: /home/claws-mail/contacts/plugins/ldap/ldap-plugin.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- ldap-plugin.c 17 Dec 2011 02:52:22 -0000 1.14
+++ ldap-plugin.c 23 Dec 2011 22:25:21 -0000 1.15
@@ -804,8 +804,6 @@
gboolean multi = FALSE;
token = filter_string_object(objectclass, "objectClass");
- filter = g_string_prepend(filter, token);
- g_free(token);
if (contact) {
if (multi) {
@@ -819,6 +817,10 @@
else
filter = g_string_append(filter, token);
}
+ else
+ filter = g_string_prepend(filter, token);
+
+ g_free(token);
return g_string_free(filter, FALSE);
}
@@ -978,6 +980,7 @@
gchar* tmp;
gboolean found = FALSE;
Contact* contact = (Contact *) ac->contact;
+ gchar* err = NULL;
search_filter = filter_build(contact, ac->intersection);
filter = g_string_new("(&");
@@ -992,7 +995,7 @@
msgs = call_server(ac->server, LDAP_SCOPE_BASE, search_filter, error);
- for (cur = msgs; ! *error && cur && ! found; cur = g_slist_next(cur)) {
+ for (cur = msgs; ! err && cur && ! found; cur = g_slist_next(cur)) {
res = (LDAPMessage *) cur->data;
if (res) {
entry = ldap_first_entry(ac->server->ldap, res);
@@ -1004,7 +1007,7 @@
found = TRUE;
}
else {
- msgs1 = call_server(ac->server, LDAP_SCOPE_ONELEVEL, search_filter, error);
+ msgs1 = call_server(ac->server, LDAP_SCOPE_ONELEVEL, search_filter, &err);
for (cur1 = msgs1; cur1 && ! found; cur1 = g_slist_next(cur1)) {
res1 = (LDAPMessage *) cur1->data;
if (res1) {
@@ -1017,9 +1020,7 @@
found = TRUE;
}
else {
- if (error) {
- *error = g_strdup_printf(_("%s: Cannot get DN\n"), search_filter);
- }
+ err = g_strdup_printf(_("%s: Cannot get DN\n"), search_filter);
}
}
}
@@ -1030,6 +1031,14 @@
}
gslist_free_ldapmessage(&msgs);
+ if (err) {
+ if (error) {
+ *error = g_strdup(err);
+ }
+ debug_print("%s\n", err);
+ g_free(err);
+ }
+
g_free(search_filter);
}
@@ -1306,6 +1315,8 @@
}
if (! dn) {
gchar* tmp = create_dummy_dn(NULL);
+ if (! ac->server->dn)
+ find_dn(ac, NULL);
dn = g_strconcat("mail=", tmp, ",", ac->server->dn, NULL);
Email* a = g_new0(Email, 1);
a->email = g_strdup(tmp);
More information about the Commits
mailing list