aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-03 15:01:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-03 15:01:34 +0000
commite7ee1ccf4596a37a2278e523d0da7652ab43a42c (patch)
tree5df2d44677b8d30ce5860785201d8496b7311228 /lib
parent98bf69f8f154f4c75acf1e43316624dfb36fe635 (diff)
Gisle fixed the problem with ldap_search_s() fails with "filter error": a case
of using 'lud_filter' after freeing 'lud_dn'.
Diffstat (limited to 'lib')
-rw-r--r--lib/ldap.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/lib/ldap.c b/lib/ldap.c
index 2c1d118d7..223c3fb55 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -60,12 +60,6 @@
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
-/* WLdcap.dll's ldap_search_s() return filter error with CURLDEBUG !?
- */
-#ifdef WIN32
-#undef CURLDEBUG
-#endif
-
#ifdef CURLDEBUG
#include "memdebug.h"
#endif
@@ -78,7 +72,7 @@
#endif
#ifndef LDAP_SIZELIMIT_EXCEEDED
-#define LDAP_SIZELIMIT_EXCEEDED -1
+#define LDAP_SIZELIMIT_EXCEEDED 4
#endif
#define DLOPEN_MODE RTLD_LAZY /*! assume all dlopen() implementations have
@@ -426,8 +420,6 @@ static char **split_str (char *str)
for (i = 2, s = strchr(str,','); s; i++)
s = strchr(++s,',');
- LDAP_TRACE(("split_str: %d strings\n", i));
-
res = calloc(i, sizeof(char*));
if (!res)
return NULL;
@@ -445,16 +437,6 @@ static bool unescape_elements (LDAPURLDesc *ludp)
{
int i;
- if (ludp->lud_dn) {
- char *dn = ludp->lud_dn;
- char *new_dn = curl_unescape(dn, 0);
-
- free(dn);
- if (!new_dn)
- return (FALSE);
- ludp->lud_dn = new_dn;
- }
-
if (ludp->lud_filter) {
ludp->lud_filter = curl_unescape(ludp->lud_filter, 0);
if (!ludp->lud_filter)
@@ -472,6 +454,16 @@ static bool unescape_elements (LDAPURLDesc *ludp)
if (!ludp->lud_exts[i])
return (FALSE);
}
+
+ if (ludp->lud_dn) {
+ char *dn = ludp->lud_dn;
+ char *new_dn = curl_unescape(dn, 0);
+
+ free(dn);
+ if (!new_dn)
+ return (FALSE);
+ ludp->lud_dn = new_dn;
+ }
return (TRUE);
}
@@ -500,8 +492,6 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
ludp->lud_port = conn->remote_port;
ludp->lud_host = conn->host.name;
- LDAP_TRACE (("host '%s'\n", ludp->lud_host));
-
/* parse DN (Distinguished Name).
*/
ludp->lud_dn = strdup(conn->path+1);