diff --git a/include/apr_ldap_init.h b/include/apr_ldap_init.h index aeb6d9b..374be44 100644 --- a/include/apr_ldap_init.h +++ b/include/apr_ldap_init.h @@ -138,6 +138,7 @@ APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void); */ APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, LDAP **ldap, + const char *uri, const char *hostname, int portno, int secure, diff --git a/include/private/apu_internal.h b/include/private/apu_internal.h index c95c9d5..7006510 100644 --- a/include/private/apu_internal.h +++ b/include/private/apu_internal.h @@ -46,7 +46,7 @@ apr_status_t apu_dso_load(apr_dso_handle_t **dso, apr_dso_handle_sym_t *dsoptr, struct apr__ldap_dso_fntable { int (*info)(apr_pool_t *pool, apr_ldap_err_t **result_err); - int (*init)(apr_pool_t *pool, LDAP **ldap, const char *hostname, + int (*init)(apr_pool_t *pool, LDAP **ldap, const char *url,const char *hostname, int portno, int secure, apr_ldap_err_t **result_err); int (*ssl_init)(apr_pool_t *pool, const char *cert_auth_file, int cert_file_type, apr_ldap_err_t **result_err); diff --git a/ldap/apr_ldap_init.c b/ldap/apr_ldap_init.c index 8aacb2a..b4575db 100644 --- a/ldap/apr_ldap_init.c +++ b/ldap/apr_ldap_init.c @@ -146,6 +146,7 @@ APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void) */ APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, LDAP **ldap, + const char *uri, const char *hostname, int portno, int secure, @@ -154,7 +155,6 @@ APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); *result_err = result; - #if APR_HAS_LDAPSSL_INIT #if APR_HAS_SOLARIS_LDAPSDK /* @@ -169,6 +169,8 @@ APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, #endif #elif APR_HAS_LDAP_SSLINIT *ldap = ldap_sslinit((char *)hostname, portno, 0); +#elif APR_HAS_OPENLDAP_LDAPSDK + ldap_initialize(ldap, uri); #else *ldap = ldap_init((char *)hostname, portno); #endif diff --git a/ldap/apr_ldap_stub.c b/ldap/apr_ldap_stub.c index 97c1551..52500b9 100644 --- a/ldap/apr_ldap_stub.c +++ b/ldap/apr_ldap_stub.c @@ -72,13 +72,14 @@ APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool, APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool, LDAP **ldap, + const char *url, const char *hostname, int portno, int secure, apr_ldap_err_t **result_err) { LOAD_LDAP_STUB(pool, -1); - return lfn->init(pool, ldap, hostname, portno, secure, result_err); + return lfn->init(pool, ldap, url, hostname, portno, secure, result_err); } APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool, diff --git a/ldap/apr_ldap_url.c b/ldap/apr_ldap_url.c index 52e37b2..2fd0a25 100644 --- a/ldap/apr_ldap_url.c +++ b/ldap/apr_ldap_url.c @@ -286,6 +286,11 @@ APU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool, result->rc = APR_LDAP_URL_ERR_BADSCHEME; return APR_EGENERAL; } + else if ( !APR_HAS_OPENLDAP_LDAPSDK && strcasecmp(scheme, "ldapi") == 0 ) { + result->reason = "ldapi:// is only supported with OpenLDAP client library."; + result->rc = APR_LDAP_URL_ERR_BADSCHEME; + return APR_EGENERAL; + } /* make working copy of the remainder of the URL */ url = (char *)apr_pstrdup(pool, url_tmp);