cURL / Mailing Lists / curl-library / Single Mail

curl-library

LDAP fix (fwd)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 25 Feb 2007 12:45:38 +0100 (CET)

Hi all,

I got this suggested patch from Emmanuel Dreyfus, but I'm rather lost in LDAP
land so I thought perhaps someone else could have a comment on his approach?

---------- Forwarded message ----------
Date: Sat, 24 Feb 2007 10:14:48 +0100
From: Emmanuel Dreyfus
To: daniel_at_haxx.se
Subject: LDAP fix

Hi

I use libcurl 7.15.5 on NetBSD

I encountered a problem when using libcurl with LDAP URI. The damn thing
complained "a required function in the shared library was not found".

Doing some debug, I discovered that the missing function was ber_free.
The problem is that libcurl looks for it in libldap, while it is in
liblber.

The patch above fixed the problem. I have no idea if it is fine or not.
What do you think?

--- lib/ldap.c.orig 2006-12-13 19:23:20.000000000 +0100
+++ lib/ldap.c 2006-12-13 19:23:20.000000000 +0100
@@ -197,8 +197,15 @@
       * cannot typecast a data pointer to a function pointer, but that's
       * exactly what we need to do here to avoid compiler warnings on
picky
       * compilers! */
      *(void**) (&func) = dlsym(libldap, name);
+#if 1
+ /*
+ * Manu 2006/12/13: if it is not in libldap, look in liblber
+ */
+ if ((func == NULL) && (liblber != NULL))
+ *(void**) (&func) = dlsym(liblber, name);
+#endif
    }
  #elif defined(WIN32)
    if (libldap) {
      func = (dynafunc)GetProcAddress((HINSTANCE)libldap, name);

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
Received on 2007-02-25