[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Unix sockets connection to server ?
- To: kurt@boolean.net
- Subject: Re: Unix sockets connection to server ?
- From: Luke Howard <lukeh@PADL.COM>
- Date: Sun, 28 Nov 1999 13:43:46 +1100
- Cc: openldap-devel@OpenLDAP.org
- Organization: PADL Software Pty Ltd
- References: <199911271305.AAA64218@au.padl.com> <38400267.40921E49@boolean.net>
- Versions: dmail (bsd44) 2.2d/makemail 2.8u
[continuing on from openldap-general post on domain
socket transport for OpenLDAP ]
I found a cleaner way to integrate ldapi URL searching,
which was probably the obvious thing to do all along,
namely adding the extra line of code to ldap_url_search()
to pass along the domain socket flag. :-)
Ergo:
ld = ldap_init(NULL, LDAP_PORT);
if (ld == NULL) {
perror("ldap_init");
return 1;
}
rc = LDAP_VERSION3;
(void) ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &rc);
rc = ldap_url_search_s(ld, "ldapi://%2Ftmp%2F.ldap-sock/?+", 0, &res);
In order to get this to work, I had to comment some code
out in request.c. In ldap_send_initial_request(), we check
whether the sockbuf is connected or not, and if not, open
the default connection. However, this connection had
already been opened (to the domain socket) and calling
ldap_open_defconn() clobbered it with a TCP connection.
I checked the Mozilla SDK and this snippet of code wasn't
there. Perhaps it should be removed altogether.
#ifndef USE_PF_LOCAL
if ( ! ber_pvt_sb_in_use(&ld->ld_sb ) ) {
/* not connected yet */
int rc = ldap_open_defconn( ld );
if( rc < 0 ) {
ber_free( ber, 1 );
return( -1 );
}
...
}
#endif /* USE_PF_LOCAL */
cheers,
-- Luke
--
Luke Howard
PADL Software Pty Ltd
http://www.padl.com/