You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Norval Hope (JIRA)" <ji...@apache.org> on 2006/12/13 04:56:21 UTC

[jira] Created: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

LdapDn.toString() doesn't return valid parseable DN string
----------------------------------------------------------

                 Key: DIRSERVER-796
                 URL: http://issues.apache.org/jira/browse/DIRSERVER-796
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: ldap
    Affects Versions: 1.0, 1.5.0
            Reporter: Norval Hope


If you do the following:

    LdapDN  dn = new LdapDN("oU=a\\,comma,O=acme");

then you get the following

    1. dn.toString() = dn.getNormName()        = 'ou=a,comma,o=acme'
    2. dn.getUpName()                                        = 'oU=a\,comma,O=acme'

Due to the value returned in 1. the following results in a parsing exception

   LdapDN  dn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").getNormName());  

I think the value in 1. should still be a valid parseable DN string instead, namely 'ou=a\,comma,o=acme'



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] Resolved: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by Emmanuel Lecharny <el...@gmail.com>.
Yeah there are some other problems with uniqueMember attribute :
http://issues.apache.org/jira/browse/DIRSERVER-757
and
http://issues.apache.org/jira/browse/DIRSERVER-766

I think that the second one is related to what you get.

Let's throw a glance to this problem, I think it's time for a debugging
session :)

On 12/14/06, Norval Hope <nr...@gmail.com> wrote:
>
> I seem to have run into a different problem now (although still around
> quoting issues) when doing reverse searches for membership, in that a
> filter like
>
> subtree scoped search for the directory root with this filter:
>
> (& (| (objectclass=groupOfUniqueNames) (objectclass=groupOfNames) ) (|
> (uniquemember=cn=acct\,comma,o=cont\,comma,ou=system)
> (member=cn=acct\,comma,o=cont\,comma,ou=system) ) )
>
> passed to a vanilla ApacheDS 1.1 doesn't match the object with the
> following LDIF:
>
> version: 1
> dn: cn=grp\,comma,ou=system
> objectclass: groupOfUniqueNames
> objectclass: top
> cn: grp,comma
> uniquemember: cn=acct\,comma,o=cont\,comma,ou=system
>
> However, exactly the same search works where there are no quoted
> characters in the DNs stored in uniquemember. I have to rush now but
> will open a JIRA in the next three days or so.
>
> Thanks
>



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: [jira] Resolved: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by Norval Hope <nr...@gmail.com>.
I seem to have run into a different problem now (although still around
quoting issues) when doing reverse searches for membership, in that a
filter like

subtree scoped search for the directory root with this filter:

(& (| (objectclass=groupOfUniqueNames) (objectclass=groupOfNames) ) (|
(uniquemember=cn=acct\,comma,o=cont\,comma,ou=system)
(member=cn=acct\,comma,o=cont\,comma,ou=system) ) )

passed to a vanilla ApacheDS 1.1 doesn't match the object with the
following LDIF:

version: 1
dn: cn=grp\,comma,ou=system
objectclass: groupOfUniqueNames
objectclass: top
cn: grp,comma
uniquemember: cn=acct\,comma,o=cont\,comma,ou=system

However, exactly the same search works where there are no quoted
characters in the DNs stored in uniquemember. I have to rush now but
will open a JIRA in the next three days or so.

Thanks

Re: [jira] Resolved: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by Norval Hope <nr...@gmail.com>.
Wow! That's what I call amazingly good service!

Thanks, I updated my 1.1 working dir with your changes and tried them
out and everything worked a treat.

[jira] Commented: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRSERVER-796?page=comments#action_12458120 ] 
            
Emmanuel Lecharny commented on DIRSERVER-796:
---------------------------------------------

I confirlm that it's a serious bug. For instance, let's consider this test :

LdapDN dn1 = new LdapDN( "a=b,c=d,e=f" );
LdapDN dn2 = new LdapDN( "a=b\\,c\\=d,e=f" );

When comparing those two different DN into the server, we use the normalized form of the dn, which is :
a=b,c=d,e=f
for both value. So those two DNs will be considered as equals, leading to an error when searching for those DN into the backend...

This is BAD :(

> LdapDn.toString() doesn't return valid parseable DN string
> ----------------------------------------------------------
>
>                 Key: DIRSERVER-796
>                 URL: http://issues.apache.org/jira/browse/DIRSERVER-796
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.0, 1.0
>            Reporter: Norval Hope
>
> If you do the following:
>     LdapDN  dn = new LdapDN("oU=a\\,comma,O=acme");
> then you get the following
>     1. dn.toString() = dn.getNormName()        = 'ou=a,comma,o=acme'
>     2. dn.getUpName()                                        = 'oU=a\,comma,O=acme'
> Due to the value returned in 1. the following results in a parsing exception
>    LdapDN  dn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").getNormName());  
> I think the value in 1. should still be a valid parseable DN string instead, namely 'ou=a\,comma,o=acme'

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by "Norval Hope (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRSERVER-796?page=comments#action_12458012 ] 
            
Norval Hope commented on DIRSERVER-796:
---------------------------------------

Email thread relating to this issue:

=========
 from  Norval Hope <nr...@gmail.com>    hide details  10:29 am (4 hours ago)  
 to  Apache Directory Developers List <de...@directory.apache.org> 


I have a question regarding what to me seems to be a problem with
Rdn.tostring() and LdapDN.toString(), in that when quoted text is
passed in they return text which is no longer quoted. This is
problematic for me as there are cases in my code where I'm dealing
with either a Sun LdapName or an LdapDN and I expect just to be able
to do a toString() and end up with a valid DN.

Here is an example of what I mean:

==== LdapNameTest.java

import org.apache.directory.shared.ldap.name.LdapDN;

import javax.naming.ldap.LdapName;
import javax.naming.InvalidNameException;

public class LdapNameTest
{
   public static void main(String[] args)
   {
       try
       {
           LdapName        name = new LdapName("ou=a\\,comma,o=acme");
           LdapDN          dn = new LdapDN("oU=a\\,comma,O=acme");

           System.out.println("name='" + name.toString() + '\'');
           System.out.println("dn='" + dn.toString() + '\'');
           System.out.println("dn(up)='" + dn.getUpName() + '\'');
       }
       catch (InvalidNameException e)
       {
           e.printStackTrace();
       }
   }
}
====
which produces this output

name='ou=a\,comma,o=acme'
dn='ou=a,comma,o=acme'
dn(up)='oU=a\,comma,O=acme'

Now, I would have expected that LdapDN.toString() would have
guaranteed that code like this would work (even though some
information about the exact case of some characters in the original DN
would be lost):

  LdapDN mydn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").toString());

but as things stand this code would fail with a parsing exception
because the '\' has been thrown away. Hence only the .getUpName() call
returns a valid DN string.
I would have expected dn= to be as follows above:

dn='ou=a\,comma,o=acme'

where the attribute names have been normalized but we still have a
valid DN string.


====
from  Emmanuel Lecharny <el...@gmail.com>
     to  Apache Directory Developers List <de...@directory.apache.org> 

Well, LdapDN.toString() contract may be not really clear. It returns the
normalized name, which is not what you expect, but which is what the
server is using when doing DN comparizon, for speed sake. Let's say that
'toString' is not exactly the best name for this method, and we should
use toNormName() instead (this metho exists, but calculate the
normalized name).

Ok,ok, you are right, this is messy... :(

I suggest you open an issue, and make a proposal for methods renaming.
At least, we won't forget to do that during the next release race.

PS: LdapDN was not intended to be used in external tools, it was written
with performance in mind, because DN parsing and manipulation cost
around 50% of all the CPU when adding or searching data. However, this
was not really a reason to deliver such a crappy API :(

====
from  Norval Hope <nr...@gmail.com>  
 to   Apache Directory Developers List <de...@directory.apache.org>, 

Thanks for the feedback. My point is that getNormName() should also
return a valid parseable DN string (with quoted chars). This won't
effect speed in comparisons or the general principal of having a
normalized representation.





> LdapDn.toString() doesn't return valid parseable DN string
> ----------------------------------------------------------
>
>                 Key: DIRSERVER-796
>                 URL: http://issues.apache.org/jira/browse/DIRSERVER-796
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.0, 1.0
>            Reporter: Norval Hope
>
> If you do the following:
>     LdapDN  dn = new LdapDN("oU=a\\,comma,O=acme");
> then you get the following
>     1. dn.toString() = dn.getNormName()        = 'ou=a,comma,o=acme'
>     2. dn.getUpName()                                        = 'oU=a\,comma,O=acme'
> Due to the value returned in 1. the following results in a parsing exception
>    LdapDN  dn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").getNormName());  
> I think the value in 1. should still be a valid parseable DN string instead, namely 'ou=a\,comma,o=acme'

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRSERVER-796?page=all ]

Emmanuel Lecharny resolved DIRSERVER-796.
-----------------------------------------

    Resolution: Fixed

Fix committed to 1.0 and to 1.5 trunks : 
http://svn.apache.org/viewvc?view=rev&rev=486779
and
http://svn.apache.org/viewvc?view=rev&rev=486780

> LdapDn.toString() doesn't return valid parseable DN string
> ----------------------------------------------------------
>
>                 Key: DIRSERVER-796
>                 URL: http://issues.apache.org/jira/browse/DIRSERVER-796
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.0, 1.0
>            Reporter: Norval Hope
>
> If you do the following:
>     LdapDN  dn = new LdapDN("oU=a\\,comma,O=acme");
> then you get the following
>     1. dn.toString() = dn.getNormName()        = 'ou=a,comma,o=acme'
>     2. dn.getUpName()                                        = 'oU=a\,comma,O=acme'
> Due to the value returned in 1. the following results in a parsing exception
>    LdapDN  dn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").getNormName());  
> I think the value in 1. should still be a valid parseable DN string instead, namely 'ou=a\,comma,o=acme'

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRSERVER-796?page=comments#action_12458197 ] 
            
Emmanuel Lecharny commented on DIRSERVER-796:
---------------------------------------------

Ok, I have just committed a big patch in trunks which should fix this issue (http://svn.apache.org/viewvc?view=rev&rev=486748 )

I will try to apply it to 1.0 now.



> LdapDn.toString() doesn't return valid parseable DN string
> ----------------------------------------------------------
>
>                 Key: DIRSERVER-796
>                 URL: http://issues.apache.org/jira/browse/DIRSERVER-796
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.0, 1.5.0
>            Reporter: Norval Hope
>
> If you do the following:
>     LdapDN  dn = new LdapDN("oU=a\\,comma,O=acme");
> then you get the following
>     1. dn.toString() = dn.getNormName()        = 'ou=a,comma,o=acme'
>     2. dn.getUpName()                                        = 'oU=a\,comma,O=acme'
> Due to the value returned in 1. the following results in a parsing exception
>    LdapDN  dn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").getNormName());  
> I think the value in 1. should still be a valid parseable DN string instead, namely 'ou=a\,comma,o=acme'

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (DIRSERVER-796) LdapDn.toString() doesn't return valid parseable DN string

Posted by "Norval Hope (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Norval Hope closed DIRSERVER-796.
---------------------------------


> LdapDn.toString() doesn't return valid parseable DN string
> ----------------------------------------------------------
>
>                 Key: DIRSERVER-796
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-796
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.0, 1.0
>            Reporter: Norval Hope
>
> If you do the following:
>     LdapDN  dn = new LdapDN("oU=a\\,comma,O=acme");
> then you get the following
>     1. dn.toString() = dn.getNormName()        = 'ou=a,comma,o=acme'
>     2. dn.getUpName()                                        = 'oU=a\,comma,O=acme'
> Due to the value returned in 1. the following results in a parsing exception
>    LdapDN  dn = new LdapDN(new LdapDN("oU=a\\,comma,O=acme").getNormName());  
> I think the value in 1. should still be a valid parseable DN string instead, namely 'ou=a\,comma,o=acme'

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.