1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Fixed the LDAP_DEPRECATED #define as suggested by Daniel Johnson, and

indented some of the code to curl-style
This commit is contained in:
Daniel Stenberg 2007-08-12 22:25:50 +00:00
parent df3e8e19c1
commit 1b88990cbb

View File

@ -46,7 +46,7 @@
#ifdef CURL_LDAP_WIN /* Use W$ LDAP implementation. */
# include <winldap.h>
#else
#define LDAP_DEPRECATED /* Be sure ldap_init() is defined. */
#define LDAP_DEPRECATED 1 /* Be sure ldap_init() is defined. */
# include <ldap.h>
#endif
@ -376,9 +376,9 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
if (!conn->data ||
!conn->data->reqdata.path ||
conn->data->reqdata.path[0] != '/' ||
conn->data->reqdata.path[0] != '/' ||
!checkprefix(conn->protostr, conn->data->change.url))
return LDAP_INVALID_SYNTAX;
return LDAP_INVALID_SYNTAX;
ludp->lud_scope = LDAP_SCOPE_BASE;
ludp->lud_port = conn->remote_port;
@ -388,14 +388,14 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
*/
ludp->lud_dn = strdup(conn->data->reqdata.path+1);
if (!ludp->lud_dn)
return LDAP_NO_MEMORY;
return LDAP_NO_MEMORY;
p = strchr(ludp->lud_dn, '?');
LDAP_TRACE (("DN '%.*s'\n", p ? (size_t)(p-ludp->lud_dn) :
strlen(ludp->lud_dn), ludp->lud_dn));
if (!p)
goto success;
goto success;
*p++ = '\0';
@ -403,65 +403,65 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
*/
q = strchr(p, '?');
if (q)
*q++ = '\0';
*q++ = '\0';
if (*p && *p != '?') {
ludp->lud_attrs = split_str(p);
if (!ludp->lud_attrs)
return LDAP_NO_MEMORY;
return LDAP_NO_MEMORY;
for (i = 0; ludp->lud_attrs[i]; i++)
LDAP_TRACE (("attr[%d] '%s'\n", i, ludp->lud_attrs[i]));
LDAP_TRACE (("attr[%d] '%s'\n", i, ludp->lud_attrs[i]));
}
p = q;
if (!p)
goto success;
goto success;
/* parse scope. skip "??"
*/
q = strchr(p, '?');
if (q)
*q++ = '\0';
*q++ = '\0';
if (*p && *p != '?') {
ludp->lud_scope = str2scope(p);
if (ludp->lud_scope == -1)
return LDAP_INVALID_SYNTAX;
return LDAP_INVALID_SYNTAX;
LDAP_TRACE (("scope %d\n", ludp->lud_scope));
}
p = q;
if (!p)
goto success;
goto success;
/* parse filter
*/
q = strchr(p, '?');
if (q)
*q++ = '\0';
*q++ = '\0';
if (!*p)
return LDAP_INVALID_SYNTAX;
return LDAP_INVALID_SYNTAX;
ludp->lud_filter = p;
LDAP_TRACE (("filter '%s'\n", ludp->lud_filter));
p = q;
if (!p)
goto success;
goto success;
/* parse extensions
*/
ludp->lud_exts = split_str(p);
if (!ludp->lud_exts)
return LDAP_NO_MEMORY;
return LDAP_NO_MEMORY;
for (i = 0; ludp->lud_exts[i]; i++)
LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i]));
LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i]));
success:
success:
if (!unescape_elements(conn->data, ludp))
return LDAP_NO_MEMORY;
return LDAP_NO_MEMORY;
return LDAP_SUCCESS;
}