[Pkg-openldap-devel] Bug#340601: ldapsearch hangs when using ldap for /etc/hosts

Steve Langasek vorlon at debian.org
Sun Feb 10 03:38:24 UTC 2008


tags 340601 confirmed
thanks

I can confirm that this is still an issue even after transitioning to
libnss-ldap built against libldap-2.4-2.  This is easily reproducible by
configuring libnss-ldap to point at ldap://127.0.0.1 (with or without slapd
installed), setting 'hosts: files ldap dns' (or variant) in
/etc/nsswitch.conf, and running 'ldapsearch -H ldap://unknown-host/'.

Here is a gdb backtrace of a hung ldapsearch:

(gdb) bt
#0  0x00002b4065305174 in __lll_lock_wait () from /lib/libpthread.so.0
#1  0x00002b4065300b08 in _L_lock_104 () from /lib/libpthread.so.0
#2  0x00002b4065300470 in pthread_mutex_lock () from /lib/libpthread.so.0
#3  0x00002b40638e3ca7 in ldap_connect_to_host ()
   from /usr/lib/libldap-2.4.so.2
#4  0x00002b40638cf46a in ldap_int_open_connection ()
   from /usr/lib/libldap-2.4.so.2
#5  0x00002b40638e16d0 in ldap_new_connection () from /usr/lib/libldap-2.4.so.2
#6  0x00002b40638cf38d in ldap_open_defconn () from /usr/lib/libldap-2.4.so.2
#7  0x00002b40638e219f in ldap_send_initial_request ()
   from /usr/lib/libldap-2.4.so.2
#8  0x00002b40638d83e7 in ldap_sasl_bind () from /usr/lib/libldap-2.4.so.2
#9  0x00002b40638d88e9 in ldap_simple_bind () from /usr/lib/libldap-2.4.so.2
#10 0x00002b406572561b in ?? () from /lib/libnss_ldap.so.2
#11 0x00002b40657272d0 in ?? () from /lib/libnss_ldap.so.2
#12 0x00002b406572796e in ?? () from /lib/libnss_ldap.so.2
#13 0x00002b406572841b in ?? () from /lib/libnss_ldap.so.2
#14 0x00002b406572ac53 in _nss_ldap_gethostbyname2_r ()
   from /lib/libnss_ldap.so.2
#15 0x00002b4065059c3e in ?? () from /lib/libc.so.6
#16 0x00002b406505af19 in getaddrinfo () from /lib/libc.so.6
#17 0x00002b40638e3cbf in ldap_connect_to_host ()
   from /usr/lib/libldap-2.4.so.2
#18 0x00002b40638cf46a in ldap_int_open_connection ()
   from /usr/lib/libldap-2.4.so.2
#19 0x00002b40638e16d0 in ldap_new_connection () from /usr/lib/libldap-2.4.so.2
#20 0x00002b40638cf38d in ldap_open_defconn () from /usr/lib/libldap-2.4.so.2
#21 0x00002b40638e219f in ldap_send_initial_request ()
   from /usr/lib/libldap-2.4.so.2
#22 0x00002b40638d49cf in ldap_extended_operation ()
   from /usr/lib/libldap-2.4.so.2
#23 0x00002b40638d4b69 in ldap_extended_operation_s ()
   from /usr/lib/libldap-2.4.so.2
#24 0x00002b40638f1565 in ldap_start_tls_s () from /usr/lib/libldap-2.4.so.2
#25 0x0000000000407ddd in ?? ()
#26 0x000000000040559a in ?? ()
#27 0x00002b4064fb81c4 in __libc_start_main () from /lib/libc.so.6
#28 0x00000000004030f9 in ?? ()
#29 0x00007fff47408b18 in ?? ()
#30 0x0000000000000000 in ?? ()

So the issue is that ldap_start_tls_s() calls getaddrinfo(), which of course
recurses into libldap as needed and tries to start a connection, and boom.



More information about the Pkg-openldap-devel mailing list