cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: LDAP support in libcurl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 1 Sep 2003 10:07:41 +0200 (CEST)

On Sun, 31 Aug 2003, Henrik Storner wrote:

> It turned out to be somewhat simpler than I thought.

Thanks for your work on this!

> The patch adds a new libcurl error code: CURLE_LDAP_INVALID_URL, which is
> returned if the ldap_url_parse() function detects an invalid URL.

Sounds reasonable.

> There is one issue with this patch that I am uncomfortable with. The
> ldap_url_parse() function returns a struct with the broken- down elements of
> the request URL. However, the ldap_search_s() function requires that each of
> the elements of the LDAP request are passed as separate parameters.
> Therefore, my patch adds a copy of the LDAPURLDesc structure definition to
> the CURL code. If this struct is changed in a later OpenLDAP release - or is
> defined differently by another LDAP library - the code breaks. But I cannot
> see how this can be avoided, unless the LDAP- library's own <ldap.h> is used
> (in which case libcurl's ldap.h file should probably be re-named).

I sympathize with your concerns here.

The dlopen() approach libcurl currently uses allow libcurl to be built
stand-alone without OpenLDAP present, but since one of the ldap functions
returns a pointer to a struct that might in fact change in a future release...

We would avoid the problem by using the ldap.h header file from the OpenLDAP
package, but that would then make us require OpenLDAP installed to build.

OTOH, the OpenLDAP library is not likely to ever change that struct in a
manner that break existing binary programs, since all programs that use this
struct (include from <ldap.h> or defined ourselves) will use and assume struct
fields that will remain even when the ldap lib is updated.

If they change that, many more programs than libcurl will break miserably too.

My conclusion is that I think your approach is fine and is likely to remain
functional even in the future. I'm gonna commit this!

Again: thanks for your nice effort!

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-01