You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2013/12/23 14:16:40 UTC

[Bug 44302] AuthLDAPURL does not accept ldapi:// urls

https://issues.apache.org/bugzilla/show_bug.cgi?id=44302

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #30254|0                           |1
           is patch|                            |

--- Comment #7 from Christophe JAILLET <ch...@wanadoo.fr> ---
Comment on attachment 30254
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30254
httpd patch to implement ldapi and ldap_initialize api

>diff --git a/include/util_ldap.h b/include/util_ldap.h
>index 3d5faed..ede304f 100644
>--- a/include/util_ldap.h
>+++ b/include/util_ldap.h
>@@ -106,7 +106,7 @@ typedef struct util_ldap_connection_t {
> #if APR_HAS_THREADS
>     apr_thread_mutex_t *lock;           /* Lock to indicate this connection is in use */
> #endif
>-
>+    const char *url;
>     const char *host;                   /* Name of the LDAP server (or space separated list) */
>     int port;                           /* Port of the LDAP server */
>     deref_options deref;                /* how to handle alias dereferening */
>@@ -237,7 +237,7 @@ APR_DECLARE_OPTIONAL_FN(apr_status_t,uldap_connection_unbind,(void *param));
>  *                                                           const char *binddn, const char *bindpw, deref_options deref,
>  *                                                           int netscapessl, int starttls)
>  */
>-APR_DECLARE_OPTIONAL_FN(util_ldap_connection_t *,uldap_connection_find,(request_rec *r, const char *host, int port,
>+APR_DECLARE_OPTIONAL_FN(util_ldap_connection_t *,uldap_connection_find,(request_rec *r, const char *url, const char *host, int port,
>                                                   const char *binddn, const char *bindpw, deref_options deref,
>                                                   int secure));
> 
>diff --git a/modules/aaa/mod_authnz_ldap.c b/modules/aaa/mod_authnz_ldap.c
>index b7b132e..fc35993 100644
>--- a/modules/aaa/mod_authnz_ldap.c
>+++ b/modules/aaa/mod_authnz_ldap.c
>@@ -434,7 +434,7 @@ static util_ldap_connection_t *get_connection_for_authz(request_rec *r, enum aut
>             bindpw = req->password;
>     }
> 
>-    return util_ldap_connection_find(r, sec->host, sec->port,
>+    return util_ldap_connection_find(r, (const char *)sec->url, sec->host, sec->port,
>                                      binddn, bindpw,
>                                      sec->deref, sec->secure);
> }
>@@ -487,7 +487,7 @@ static authn_status authn_ldap_check_password(request_rec *r, const char *user,
>             binddn = ldap_determine_binddn(r, user);
>         }
> 
>-        ldc = util_ldap_connection_find(r, sec->host, sec->port,
>+        ldc = util_ldap_connection_find(r, (const char *)sec->url, sec->host, sec->port,
>                                        binddn, bindpw,
>                                        sec->deref, sec->secure);
>     }
>@@ -1406,6 +1406,8 @@ static const char *mod_auth_ldap_parse_url(cmd_parms *cmd,
>         sec->port = urld->lud_port? urld->lud_port : LDAP_PORT;
>     }
> 
>+    sec->url = apr_pstrndup(cmd->pool, sec->url, strrchr((char *)url, '/') - url);
>+
>     sec->have_ldap_url = 1;
> 
>     ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, cmd->server,
>diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c
>index dc08dd4..f0f099f 100644
>--- a/modules/ldap/util_ldap.c
>+++ b/modules/ldap/util_ldap.c
>@@ -291,7 +291,8 @@ static int uldap_connection_init(request_rec *r,
>      * some hosts with ports and some without. All hosts which do not
>      * specify a port will use the default port.
>      */
>-    apr_ldap_init(r->pool, &(ldc->ldap),
>+
>+    apr_ldap_init(r->pool, &(ldc->ldap), ldc->url,
>                   ldc->host,
>                   APR_LDAP_SSL == ldc->secure ? LDAPS_PORT : LDAP_PORT,
>                   secure, &(result));
>@@ -686,7 +687,7 @@ static int compare_client_certs(apr_array_header_t *srcs,
>  * a pointer to the existing ldc structure will be returned.
>  */
> static util_ldap_connection_t *
>-            uldap_connection_find(request_rec *r,
>+            uldap_connection_find(request_rec *r, const char *url,
>                                   const char *host, int port,
>                                   const char *binddn, const char *bindpw,
>                                   deref_options deref, int secure)
>@@ -828,6 +829,7 @@ static util_ldap_connection_t *
>         apr_thread_mutex_lock(l->lock);
> #endif
>         l->bound = 0;
>+        l->url = url;
>         l->host = apr_pstrdup(l->pool, host);
>         l->port = port;
>         l->deref = deref;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org