Gisle fixed the problem with ldap_search_s() fails with "filter error": a case
of using 'lud_filter' after freeing 'lud_dn'.
This commit is contained in:
parent
98bf69f8f1
commit
e7ee1ccf45
32
lib/ldap.c
32
lib/ldap.c
@ -60,12 +60,6 @@
|
|||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
/* WLdcap.dll's ldap_search_s() return filter error with CURLDEBUG !?
|
|
||||||
*/
|
|
||||||
#ifdef WIN32
|
|
||||||
#undef CURLDEBUG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CURLDEBUG
|
#ifdef CURLDEBUG
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
#endif
|
#endif
|
||||||
@ -78,7 +72,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LDAP_SIZELIMIT_EXCEEDED
|
#ifndef LDAP_SIZELIMIT_EXCEEDED
|
||||||
#define LDAP_SIZELIMIT_EXCEEDED -1
|
#define LDAP_SIZELIMIT_EXCEEDED 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DLOPEN_MODE RTLD_LAZY /*! assume all dlopen() implementations have
|
#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++)
|
for (i = 2, s = strchr(str,','); s; i++)
|
||||||
s = strchr(++s,',');
|
s = strchr(++s,',');
|
||||||
|
|
||||||
LDAP_TRACE(("split_str: %d strings\n", i));
|
|
||||||
|
|
||||||
res = calloc(i, sizeof(char*));
|
res = calloc(i, sizeof(char*));
|
||||||
if (!res)
|
if (!res)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -445,16 +437,6 @@ static bool unescape_elements (LDAPURLDesc *ludp)
|
|||||||
{
|
{
|
||||||
int i;
|
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) {
|
if (ludp->lud_filter) {
|
||||||
ludp->lud_filter = curl_unescape(ludp->lud_filter, 0);
|
ludp->lud_filter = curl_unescape(ludp->lud_filter, 0);
|
||||||
if (!ludp->lud_filter)
|
if (!ludp->lud_filter)
|
||||||
@ -472,6 +454,16 @@ static bool unescape_elements (LDAPURLDesc *ludp)
|
|||||||
if (!ludp->lud_exts[i])
|
if (!ludp->lud_exts[i])
|
||||||
return (FALSE);
|
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);
|
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_port = conn->remote_port;
|
||||||
ludp->lud_host = conn->host.name;
|
ludp->lud_host = conn->host.name;
|
||||||
|
|
||||||
LDAP_TRACE (("host '%s'\n", ludp->lud_host));
|
|
||||||
|
|
||||||
/* parse DN (Distinguished Name).
|
/* parse DN (Distinguished Name).
|
||||||
*/
|
*/
|
||||||
ludp->lud_dn = strdup(conn->path+1);
|
ludp->lud_dn = strdup(conn->path+1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user