[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Referral chasing broken in libldap, unless port specified (ITS#1606)



At 02:40 PM 2002-02-20, lukeh@padl.com wrote:
>Full_Name: Luke Howard
>Version: 2.0.99
>OS: Darwin
>URL: ftp://ftp.openldap.org/incoming/
>Submission from: (NULL) (165.228.130.11)
>
>
>The [:port] part of an LDAP URL is optional, per RFC1738. ldap_url_parse()
>should be used instead of ldap_url_parse_ext() as it appears that the latter
>does not set the port to a sensible default in the case that it is omitted. 

ldap_url_parse_ext() does need to be used here.  But the caller
should check to see if 0 and set to LDAP_PORT/LDAPS_PORT as
appropriately.

>This used to work a year or so ago, but it has been broken for a while :-) (Also, I
>wonder whether the search scope should be set to that of the search when chasing
>references, rather than the RFC-specified default of "base". This would make
>things more useful IMO although I can compensate at the server.)

In chasing references where the server has not specified the
scope, the scope should be derived from the request which
generated the reference.  That is, if a subtree search
returns a reference, you chase as subtree.  If base or
one, you chase as base.

For referrals, when not specified by the server, you chase
using the scope of the same scope as the request which
generated the referral.


>Index: request.c
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/request.c,v
>retrieving revision 1.77
>diff -u -r1.77 request.c
>--- request.c   2002/01/04 20:17:39     1.77
>+++ request.c   2002/02/20 21:54:46
>@@ -650,7 +650,7 @@
>        /* parse out & follow referrals */
>        for( i=0; refarray[i] != NULL; i++) {
>                /* Parse the referral URL */
>-               if (( rc = ldap_url_parse_ext( refarray[i], &srv)) !=
>LDAP_SUCCESS) {
>+               if (( rc = ldap_url_parse( refarray[i], &srv)) != LDAP_SUCCESS)
>{
>                        ld->ld_errno = rc;
>                        rc = -1;
>                        goto done;
>@@ -878,7 +878,7 @@
>                        p = NULL;
>                }
> 
>-               rc = ldap_url_parse_ext( ref, &srv );
>+               rc = ldap_url_parse( ref, &srv );
> 
>                if ( rc != LDAP_URL_SUCCESS ) {
>                        Debug( LDAP_DEBUG_TRACE,
>Index: url.c
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/url.c,v
>retrieving revision 1.64
>diff -u -r1.64 url.c
>--- url.c       2002/01/04 20:17:40     1.64
>+++ url.c       2002/02/20 21:54:52
>@@ -10,7 +10,7 @@
>  *  LIBLDAP url.c -- LDAP URL (RFC 2255) related routines
>  *
>  *  LDAP URLs look like this:
>- *    ldap[is]://host:port[/[dn[?[attributes][?[scope][?[filter][?exts]]]]]]
>+ *    ldap[is]://host[:port][/[dn[?[attributes][?[scope][?[filter][?exts]]]]]]
>  *
>  *  where:
>  *   attributes is a comma separated list