From bab977dad76e9204278c7afe0bb905cda064f488 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Jun 2005 05:39:40 +0000 Subject: r7626: a new ldap client library. Main features are: - hooked into events system, so requests can be truly async and won't interfere with other processing happening at the same time - uses NTSTATUS codes for errors (previously errors were mostly ignored). In a similar fashion to the DOS error handling, I have reserved a range of the NTSTATUS code 32 bit space for LDAP error codes, so a function can return a LDAP error code in a NTSTATUS - much cleaner packet handling (This used to be commit 2e3c660b2fc20e046d82bf1cc296422b6e7dfad0) --- source4/libcli/ldap/ldap.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'source4/libcli/ldap/ldap.c') diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index bce3da94ae..c642fc3e4b 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -1013,44 +1013,4 @@ BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg) return ((!data->has_error) && (data->nesting == NULL)); } -BOOL ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url, - char **host, uint16_t *port, BOOL *ldaps) -{ - int tmp_port = 0; - char protocol[11]; - char tmp_host[255]; - const char *p = url; - int ret; - - /* skip leading "URL:" (if any) */ - if (strncasecmp( p, "URL:", 4) == 0) { - p += 4; - } - - /* Paranoia check */ - SMB_ASSERT(sizeof(protocol)>10 && sizeof(tmp_host)>254); - - ret = sscanf(p, "%10[^:]://%254[^:/]:%d", protocol, tmp_host, &tmp_port); - if (ret < 2) { - return False; - } - - if (strequal(protocol, "ldap")) { - *port = 389; - *ldaps = False; - } else if (strequal(protocol, "ldaps")) { - *port = 636; - *ldaps = True; - } else { - DEBUG(0, ("unrecognised protocol (%s)!\n", protocol)); - return False; - } - - if (tmp_port != 0) - *port = tmp_port; - - *host = talloc_strdup(mem_ctx, tmp_host); - - return (*host != NULL); -} -- cgit