[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_init( ) causing segv violation (malloc failure)



1) please don't send mails in html (see the result below)
2) my crystal ball tells me that you're using a 64 bit architecture.
ldap_init() is deprecated and, as such, its prototype is not usually
visible.  Instead of teaching you how to work this around, I prefer you
to use ldap_initialize(), which has a much more versatile API and should
avoid the issue you report.

p.

Santosh Kumar wrote:
> Hi  everyone,  require your suggestion ,  facing segmentation violation issue, when invoked ldap_init()when
> tried analysing by gdb of coredump it points for malloc failure in
> ldapxx.so libraries, not sure wheather any issues should be considered
> for overcoming this,  would appreciate your solutions about issue. LDAP      *ld_user;/* Code - start*/                
> ld_user = ldap_init(LDAP_SERVER, LDAP_PORT);  //Connect to Local LDAP Server       if(ld_user == NULL)
>                       {
>                             fprintf(fpDisplay,\"ERROR : ldap_init: ....Allocated : %p\\n\",ld_user );
>                             exit(1);
>                       }
>                       else
>                       {
>                           fprintf(fpDisplay,\"main: ldap_init: Sucess =.Allocated=%p\\n\", ld_user);
>                       }
>                       fflush(NULL);
>                       rc = ldap_simple_bind_s( ld_user, bind_dn, LDAP_PASSWD);
>                       if ( rc != LDAP_SUCCESS )
>                         {
>                           fprintf( fpDisplay, \"main: ldap_simple_bind_s: ldap_simple_bind_s\\n\" );
>                           return -3;
>                         }
> /* Code Ends */Snap shot of GDB of coredump
> 0x00861d49 in _int_malloc () from /lib/tls/libc.so.6
> (gdb) #1  0x00861d49 in _int_malloc () from /lib/tls/libc.so.6
> (gdb) #2  0x008610ed in malloc () from /lib/tls/libc.so.6
> (gdb) #3  0x00f3b2ef in ber_memalloc () from /usr/lib/liblber.so.2
> (gdb) #4  0x00f3b427 in ber_memrealloc () from /usr/lib/liblber.so.2
> (gdb) #5  0x00ac5a6b in ?? () from /usr/lib/libldap.so.2
> (gdb) #6  0x00000000 in ?? ()
> Thanks in advanceRegards,
>  Santosh Kumar.B
>  Sr Systems Engineer
>  NeoAccel India Pvt Ltd
>  Sector 24, Plot no 6, Turbhe
>  Navi Mumbai 400705
>  Mobile:09820939496
> 
> Regards,
>  Santosh Kumar.B
>  Sr Systems Engineer
>  NeoAccel India Pvt Ltd
>  Sector 24, Plot no 6, Turbhe
>  Navi Mumbai 400705
>  Mobile:09820939496
> 
> 
> 




Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
---------------------------------------
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Email:   pierangelo.masarati@sys-net.it
---------------------------------------