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

Re: openldap 2.1.4 fails on solaris (segmentation fault)



Hallo Howard,

You are write, the one is just symbolic link to another... Damned, I made mess again. I just again downloaded 2.1.4 made configure make depend on my linux box and got the same code in os-ip.c as on solaris box (uuuu). Look, there are differences in os-ip.c in 2.1.2 and 2.1.4, these are below. ldapsearch from 2.1.4 really does not work, if you wish I can send you core dump tomorrow. Making changes I described before makes ldapsearch in 2.1.4 work again, I believe it is essential.

Sorry for the mess, reagards, avdim tarassov.

1c1
< /* $OpenLDAP: pkg/ldap/libraries/libldap/os-ip.c,v 1.72.2.2 2002/04/15 15:21:47 kurt Exp $ */
---
> /* $OpenLDAP: pkg/ldap/libraries/libldap/os-ip.c,v 1.72.2.6 2002/08/12 15:35:04 kurt Exp $ */
32a33,40
> #if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
> # ifdef LDAP_PF_INET6
> int ldap_int_inet4or6 = AF_UNSPEC;
> # else
> int ldap_int_inet4or6 = AF_INET;
> # endif
> #endif
>
170a179,181
> #ifdef LDAP_PF_INET6
> struct sockaddr_storage sin;
> #else
171a183
> #endif
195a208
> int rc;
225,226c238
< if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR )
< {
---
> if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) {
252c264,265
< if ( select(ldap_int_tblsize, z, &wfds,
---
> do {
> rc = select(ldap_int_tblsize, z, &wfds,
254c267
< &efds,
---
> &efds,
256c269
< z,
---
> z,
258,261c271,275
< opt_tv ? &tv : NULL) == AC_SOCKET_ERROR )
< {
< return ( -1 );
< }
---
> opt_tv ? &tv : NULL);
> } while( rc == AC_SOCKET_ERROR && errno == EINTR &&
> LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART ));
>
> if( rc == AC_SOCKET_ERROR ) return rc;
314d327
< struct sockaddr_in sin;
343c356
< hints.ai_family = AF_UNSPEC;
---
> hints.ai_family = ldap_int_inet4or6;
428a442,443
> struct sockaddr_in sin;
>
440c455
< (void)memset((char *)&sin, '\0', sizeof(struct sockaddr_in));
---
> (void)memset((char *)&sin, '\0', sizeof sin);
475c490,495
< struct sockaddr sa;
---
> #ifdef LDAP_PF_INET6
> struct sockaddr_storage sabuf;
> #else
> struct sockaddr sabuf;
> #endif
> struct sockaddr *sa = (struct sockaddr *) &sabuf;
485,486c505,506
< (void)memset( (char *)&sa, '\0', sizeof( struct sockaddr ));
< len = sizeof( sa );
---
> (void)memset( (char *)sa, '\0', sizeof sabuf );
> len = sizeof sabuf;
489c509
< if ( getpeername( sd, &sa, &len ) == -1 ) {
---
> if ( getpeername( sd, sa, &len ) == -1 ) {
499c519
< switch (sa.sa_family) {
---
> switch (sa->sa_family) {
506c526
< addr = (char *) &((struct sockaddr_in6 *)&sa)->sin6_addr;
---
> addr = (char *) &((struct sockaddr_in6 *)sa)->sin6_addr;
511c531
< addr = (char *) &((struct sockaddr_in *)&sa)->sin_addr;
---
> addr = (char *) &((struct sockaddr_in *)sa)->sin_addr;
519c539
< &((struct sockaddr_in *)&sa)->sin_addr,
---
> &((struct sockaddr_in *)sa)->sin_addr,
529c549
< &((struct sockaddr_in *)&sa)->sin_addr,
---
> &((struct sockaddr_in *)sa)->sin_addr,
544,546c564,565
< if ((ldap_pvt_gethostbyaddr_a( addr, len,
< sa.sa_family, &he_buf, &ha_buf,
< &hp,&local_h_errno ) == 0 ) &&
---
> if ((ldap_pvt_gethostbyaddr_a( addr, len, sa->sa_family,
> &he_buf, &ha_buf, &hp, &local_h_errno ) == 0 ) &&
685c704
< LDAP_LOG (( "os-ip", LDAP_LEVEL_ENTRY, "ldap_int_select\n" ));
---
> LDAP_LOG ( CONNECTION, ENTRY, "ldap_int_select\n", 0, 0, 0 );



Howard Chu wrote:

-----Original Message-----
From: owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of Tarassov Vadim





Hallo again,

I just could make ldapsearch to work. You guys definitely have a
bug. Steping through ldap_connect_to_host in

libraries/libldap_r/os-ip.c

I noticed that

hp->h_addr_list[0]

becomes NULL after executing

(void)memset((char *)&sin, '\0', sizeof sin);

Odd enough everything starts to work if you define sin like you
did it in libraries/libldap/os-ip.c.



In the OpenLDAP build, libraries/libldap_r/os-ip.c is just a symlink to libraries/libldap/os-ip.c, so any variables are defined exactly alike in both places. If you see a difference in the code between these two files, perhaps someone has made some local modifications to your source tree. You should find out what they changed and why.

 -- Howard Chu
 Chief Architect, Symas Corp.       Director, Highland Sun
 http://www.symas.com               http://highlandsun.com/hyc
 Symas: Premier OpenSource Development and Support