Bug 3027

Summary: Claws segfaults when closing LDAP-enabled address book
Product: Claws Mail (GTK 2) Reporter: Arthur HUILLET <arthur.huillet>
Component: UI/Address Book/LDAPAssignee: users
Status: RESOLVED FIXED    
Severity: normal CC: arthur.huillet
Priority: P3    
Version: 3.9.2   
Hardware: PC   
OS: Linux   

Description Arthur HUILLET 2013-11-02 15:17:42 UTC
Sometimes, when closing a LDAP-enabled addres book, claws will crash.

Below is a backtrace:

#0  0x00007ffff4395ad6 in __strcmp_ssse3 () from /usr/lib/libc.so.6
#1  0x00000000005ae98c in ldapsvr_modify_dn (hash=hash@entry=0x115f180, dn=dn@entry=0x7fffd400c250 "CN=FirstName LastName,OU=Users,OU=accounts,DC=company,DC=com") at ldapupdate.c:415
#2  0x00000000005b059b in ldapsvr_update_contact (server=server@entry=0xa22ca0, contact=contact@entry=0x115f180) at ldapupdate.c:1126
#3  0x00000000005b0f39 in ldapsvr_update_book (server=server@entry=0xa22ca0, item=item@entry=0x0) at ldapupdate.c:1444
#4  0x000000000058be06 in addrindex_save_data (addrIndex=0xa1ded0) at addrindex.c:1825
#5  0x000000000058796e in addressbook_export_to_file () at addressbook.c:4374
#6  0x0000000000588299 in addressbook_close () at addressbook.c:1358
#7  0x00007ffff728fd85 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#8  0x00007ffff4eeb6a8 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#9  0x00007ffff4efd03d in ?? () from /usr/lib/libgobject-2.0.so.0
#10 0x00007ffff4f04a19 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#11 0x00007ffff4f05002 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#12 0x00007ffff739fab4 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#13 0x00007ffff728eb5b in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#14 0x00007ffff6f09c3c in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#15 0x00007ffff4c23256 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#16 0x00007ffff4c235a8 in ?? () from /usr/lib/libglib-2.0.so.0
#17 0x00007ffff4c239aa in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#18 0x00007ffff728d9d7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#19 0x0000000000448775 in main (argc=1, argv=0x7fffffffe878) at main.c:1721

Here is some more info:

(gdb) frame 1
415                     if (strcmp(compare, rdn->attribute) != 0) {
(gdb) print compare
$1 = (gchar *) 0x0
(gdb) print rdn->attribute
$2 = (gchar *) 0x12b2670 "CN"


By the way - I never asked Claws to write to the LDAP, and it looks like this might be what it is attempting to do. ?!

Thanks
Comment 1 users 2016-08-30 10:04:02 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2016-08-30 10:04:02.465578020 +0200
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=bd5a2f11731a865d3db59786453bcf4db33a4852
Merge: 21d9e5d 2032c91
Author: Colin Leroy <colin@colino.net>
Date:   Tue Aug 30 10:04:01 2016 +0200

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=2032c913a77a1c55527152af1244a3b8cfda9a6f
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Tue Aug 30 10:03:06 2016 +0200

    Fix NULL pointer dereference in LDAP lookup code.
    
    Fixes bug #3027.
Comment 2 Andrej Kacian 2016-08-30 10:06:34 UTC
A long-overdue fix. :)

By the way, Claws Mail is not trying to write into LDAP here, all this code is doing is modifying strings in local memory, during config save to local addressbook XML.