Segfault with asterisk-cvs and res_config_ldap

Hello,

I’ve got a Problem with SIP Authentication via Asterisk and LDAP.

I have tested the actual Version from subversion (SVN-trunk-r114601) and the actual Version 1.6.0-beta8. Both the same…

I’ve tested Gentoo and Debian 4.0 (both 64bit), both the same Problem.

When I start asterisk, with:

asterisk -c

Now appears the following Problem, when the Phone want’s to register:

*CLI> [Apr 24 15:53:40] WARNING[388]: res_config_ldap.c:816 realtime_ldap_base_ap: Could not find any entry matching (&(objectClass=inetOrgPerson)(uid=darasmus)(description=dynamic)) in base dn dc=fsd,dc=li.
*** glibc detected *** asterisk: free(): invalid pointer: 0x00000000007cf3d5 ***
======= Backtrace: =========
/lib/libc.so.6[0x2ac5a2558aad]
/lib/libc.so.6(cfree+0x76)[0x2ac5a255a796]
/usr/lib/liblber-2.3.so.0(ber_bvfree_x+0x27)[0x2aaaab72e7f7]
/usr/lib/liblber-2.3.so.0(ber_bvecfree_x+0x51)[0x2aaaab72e871]
/usr/lib/asterisk/modules/res_config_ldap.so[0x2aaaab2e78cb]
/usr/lib/asterisk/modules/res_config_ldap.so[0x2aaaab2e79bc]
/usr/lib/asterisk/modules/res_config_ldap.so[0x2aaaab2e97a5]
/usr/lib/asterisk/modules/res_config_ldap.so[0x2aaaab2e9aea]
asterisk[0x4628e7]
asterisk(ast_load_realtime+0xf2)[0x462acf]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab674440b]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab6744e99]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab6765e1f]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab678f611]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab6790631]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab679103f]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab6790ad2]
asterisk(ast_io_wait+0x1ba)[0x491f5a]
/usr/lib/asterisk/modules/chan_sip.so[0x2aaab6791f72]
asterisk[0x4ff3b5]
/lib/libpthread.so.0[0x2ac5a2a36047]
/lib/libc.so.6(clone+0x6d)[0x2ac5a25ac28d]
======= Memory map: ========                                                                                                                                                         

SNIP!

Solution:

MALLOC_CHECK_=1 asterisk -c 

With this Option, the Process isn’t killed, but shows a warning.

Now I can try to register and the error Messages are shown with wrong Password. This looks okay. :smile:

But, If I use the right Password, the process crashes with a Seg Fault and the following Output:

Asterisk Ready.
  == Parsing '/etc/asterisk/cli.conf':   == Found
*CLI> *** glibc detected *** asterisk: free(): invalid pointer: 0x00000000008b1da5 ***
*** glibc detected *** asterisk: free(): invalid pointer: 0x00000000008b1dd5 ***
[Apr 24 16:01:17] NOTICE[484]: chan_sip.c:20902 build_peer: The 'username' field for sip peers has been deprecated in favor of the term 'defaultuser'
*** glibc detected *** asterisk: free(): invalid pointer: 0x00000000008b29d5 ***
*** glibc detected *** asterisk: free(): invalid pointer: 0x00000000008b2945 ***
*** glibc detected *** asterisk: free(): invalid pointer: 0x00000000008b3a95 ***
*** glibc detected *** asterisk: free(): invalid pointer: 0x00000000008b3d65 ***
    -- Registered SIP 'alehmann' at 10.0.111.100 port 2048 expires 3600
       > Saved useragent "snom360/7.1.30" for peer alehmann
Segmentation fault

Any Ideas? Is this a configuration issue? Or someting other?

The LDAP Lookups look fine. I don’t think the Problem is LDAP related, because the wrong Password give’s me the right error message and the Last Message is “Registered SIP …”. Maybe a chan_sip Problem?

Any Help would be very nice!

André

Files:

My extconfig.conf:

[settings]
sipusers => ldap,"dc=fsd,dc=li",sip1
sippeers => ldap,"dc=fsd,dc=li",sip1

My res_ldap.conf:

[_general]
url=ldap://localhost:389
basedn=dc=fsd,dc=li                     ; Base DN
user=cn=admin,dc=fsd,dc=li                           ; Bind DN
pass=dammdamm                     ; Bind password

[config]
additionalFilter=(objectClass=inetOrgPerson)

[sip1]
name=>uid
username=>uid
md5secret=>userPassword
context => internal
host=>description
additionalFilter=(objectClass=inetOrgPerson)