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

Re: Unix sockets connection to server ?

At 01:43 PM 11/28/99 +1100, Luke Howard wrote:
>[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. :-)

This would be "cleaner" if ldap_url_search actually
used all the parameters of the URL.  However, ldap_url_search()
is designed to ignore the protocol and hostport provided and,
instead, always send the request to the sessions default
server.  The code you commented out is necessary to open
the default connection if ldap_url_search() is the first
operation made upon the session handle.

A couple of things need to happen to support LDAP over
non-TCP streams.  First, the session structure needs to
be expanded to hold address information for each supported
protocol family (TCP, UNIX, etc.).

Then, we need a replacement ldap_init() function to initialize
the session structure with the appropriate address information
such that the first operation can "open" the connection and
send the first request.

I suggest that the replacement for ldap_init() be called
ldap_initialize() (or ldap_create()) and take address
information in the form of a URL.  It should return a
session handle by argument and return a result indicating
success or the nature of any error.

	int rc;
	LDAP *ld;

	rc = ldap_initialize( &ld, "ldap://localhost/"; ); 
     	/* rc = ldap_initialize( &ld, "ldaps://tlshost/" ); */
	/* rc = ldap_initialize( &ld, "ldapi:///" ); */

	if( rc != LDAP_SUCCESS ) {
		/* handle error */

	/* do LDAP */

	rc = ldap_unbind( ld );

This will provide a mechanism that can support additional
stream protocols.

Kurt D. Zeilenga		<kurt@boolean.net>
Net Boolean Incorporated	<http://www.boolean.net/>