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

JLDAP - LDAPUrl fails to parse attribute correctly (ITS#3049)

Full_Name: Aaron Johnson
Version: JLDAP - 2004/02/04
OS: Unix / Windows (Java)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

I'm constructing a LDAPUrl using the following string:
It appears that when it is parsed, and a scope is not specified the attributes
length (or specifically its end point) is computed incorrectly (off by on
For example when using: ldap://hostname/dc=examples,dc=com?uid
toString returns: ldap://hostname:389/dc=examples,dc=com?ui
and when using: ldap://hostname/dc=examples,dc=com?uid?
toString returns: ldap://hostname:389/dc=examples,dc=com?uid

I think the following one-liner should fix things, but maybe someone on the dev
team who knows the code and logic better would be able to verify this.  Sorry
this isn't in a patch file, but I think it would be more difficult to run the
patch then to just make the change.

--- com/novell/ldap/LDAPUrl.java.orig   2004-03-31 16:19:52.006413600 -0600
+++ com/novell/ldap/LDAPUrl.java        2004-03-31 16:07:38.505872200 -0600
@@ -697,7 +697,7 @@
         // Parse out the attributes
         int scopeStart = url.indexOf('?', scanStart);
         if( scopeStart < 0)
-            scopeStart = scanEnd - 1;
+            scopeStart = scanEnd;
         attrs = parseList( url, ',', attrsStart + 1, scopeStart);
         if( Debug.LDAP_DEBUG) {
             if( attrs != null) {