You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org> on 2005/08/13 00:11:53 UTC
[jira] Created: (DIREVE-224) Pb with case sensitivity for attributes
Pb with case sensitivity for attributes
---------------------------------------
Key: DIREVE-224
URL: http://issues.apache.org/jira/browse/DIREVE-224
Project: Directory Server
Type: Bug
Components: jdbm database
Versions: 0.9.2
Reporter: Emmanuel Lecharny
Priority: Blocker
There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
This usage is spreaded all over the code and need to be fixed.
As an example, here is a snapshot of a working code :
/*
* create objectClass=top, objectClass=organizationalUnit
*/
Attributes attributes = new BasicAttributes();
Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
attribute.add( "top" );
attribute.add( "organizationalUnit" );
attributes.put( attribute );
Attribute attr = attributes.get("objectclass".toLowerCase());
Attribute attr2 = attributes.get("objectClass".toLowerCase());
Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
/*
* The same piece of code, without the lowerCase()
*/
Attributes attributes = new BasicAttributes();
Attribute attribute = new BasicAttribute( "objectClass");
attribute.add( "top" );
attribute.add( "organizationalUnit" );
attributes.put( attribute );
Attribute attr = attributes.get("objectclass");
Attribute attr2 = attributes.get("objectClass");
Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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-334) Pb with case sensitivity for
attributes
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/DIRSERVER-334?page=all ]
Emmanuel Lecharny closed DIRSERVER-334:
---------------------------------------
done
> Pb with case sensitivity for attributes
> ---------------------------------------
>
> Key: DIRSERVER-334
> URL: http://issues.apache.org/jira/browse/DIRSERVER-334
> Project: Directory ApacheDS
> Type: Bug
> Reporter: Emmanuel Lecharny
> Assignee: Alex Karasulu
> Priority: Blocker
>
> There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
> If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
> This usage is spreaded all over the code and need to be fixed.
> As an example, here is a snapshot of a working code :
> /*
> * create objectClass=top, objectClass=organizationalUnit
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass".toLowerCase());
> Attribute attr2 = attributes.get("objectClass".toLowerCase());
> Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
> /*
> * The same piece of code, without the lowerCase()
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass");
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass");
> Attribute attr2 = attributes.get("objectClass");
> Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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] Assigned: (DIREVE-224) Pb with case sensitivity for attributes
Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/DIREVE-224?page=all ]
Alex Karasulu reassigned DIREVE-224:
------------------------------------
Assign To: Alex Karasulu
> Pb with case sensitivity for attributes
> ---------------------------------------
>
> Key: DIREVE-224
> URL: http://issues.apache.org/jira/browse/DIREVE-224
> Project: Directory Server
> Type: Bug
> Components: server main
> Versions: 0.9.2
> Reporter: Emmanuel Lecharny
> Assignee: Alex Karasulu
> Priority: Blocker
>
> There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
> If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
> This usage is spreaded all over the code and need to be fixed.
> As an example, here is a snapshot of a working code :
> /*
> * create objectClass=top, objectClass=organizationalUnit
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass".toLowerCase());
> Attribute attr2 = attributes.get("objectClass".toLowerCase());
> Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
> /*
> * The same piece of code, without the lowerCase()
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass");
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass");
> Attribute attr2 = attributes.get("objectClass");
> Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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: (DIREVE-224) Pb with case sensitivity for attributes
Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/DIREVE-224?page=comments#action_12318682 ]
Emmanuel Lecharny commented on DIREVE-224:
------------------------------------------
I have found 177 reference to BasicAttribute through the code, but many of them ar imports.
org.apache.dns.store.DnsRecordStateFactory.getStateToBind(),
org.apache.kerberos.store.operations.ChangePassword.execute()
org.apache.kerberos.store.operations.GetPrincipal.execute()
org.apache.ldap.common.ldif.LdifEntry.addModificationItem()
org.apache.ldap.server.exception.ExceptionServiceTest.testFailAddOnAlias()
...
> Pb with case sensitivity for attributes
> ---------------------------------------
>
> Key: DIREVE-224
> URL: http://issues.apache.org/jira/browse/DIREVE-224
> Project: Directory Server
> Type: Bug
> Components: jdbm database
> Versions: 0.9.2
> Reporter: Emmanuel Lecharny
> Priority: Blocker
>
> There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
> If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
> This usage is spreaded all over the code and need to be fixed.
> As an example, here is a snapshot of a working code :
> /*
> * create objectClass=top, objectClass=organizationalUnit
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass".toLowerCase());
> Attribute attr2 = attributes.get("objectClass".toLowerCase());
> Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
> /*
> * The same piece of code, without the lowerCase()
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass");
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass");
> Attribute attr2 = attributes.get("objectClass");
> Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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] Updated: (DIREVE-224) Pb with case sensitivity for attributes
Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/DIREVE-224?page=all ]
Emmanuel Lecharny updated DIREVE-224:
-------------------------------------
Component: server main
(was: jdbm database)
> Pb with case sensitivity for attributes
> ---------------------------------------
>
> Key: DIREVE-224
> URL: http://issues.apache.org/jira/browse/DIREVE-224
> Project: Directory Server
> Type: Bug
> Components: server main
> Versions: 0.9.2
> Reporter: Emmanuel Lecharny
> Priority: Blocker
>
> There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
> If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
> This usage is spreaded all over the code and need to be fixed.
> As an example, here is a snapshot of a working code :
> /*
> * create objectClass=top, objectClass=organizationalUnit
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass".toLowerCase());
> Attribute attr2 = attributes.get("objectClass".toLowerCase());
> Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
> /*
> * The same piece of code, without the lowerCase()
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass");
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass");
> Attribute attr2 = attributes.get("objectClass");
> Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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: (DIREVE-224) Pb with case sensitivity for attributes
Posted by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/DIREVE-224?page=comments#action_12318694 ]
Emmanuel Lecharny commented on DIREVE-224:
------------------------------------------
The fact is that when creating a BasicAttribute and adding it to a BasicAttributes, the latter MUST have been created using the constructor that declares it as case insensitive :
/*
* create objectClass=top, objectClass=organizationalUnit
*/
boolean IGNORE_CASE = true;
Attributes attributes = new BasicAttributes( IGNORE_CASE ); // Declares the BasicAttributes as case insensitive
Attribute attribute = new BasicAttribute( "objectClass" );
attribute.add( "top" );
attribute.add( "organizationalUnit" );
attributes.put( attribute );
Attribute attr = attributes.get("objectclass");
Attribute attr2 = attributes.get("objectClass");
Assert.assertTrue( attr == attr2 ); // They now are equal
There are places in the code where this is done, othere where it's not :
org.apache.ldap.server.configuration.ContextPartitionConfiguration :
private Attributes contextEntry = new BasicAttributes(); // Should be new BasicAttributes( true );
> Pb with case sensitivity for attributes
> ---------------------------------------
>
> Key: DIREVE-224
> URL: http://issues.apache.org/jira/browse/DIREVE-224
> Project: Directory Server
> Type: Bug
> Components: server main
> Versions: 0.9.2
> Reporter: Emmanuel Lecharny
> Priority: Blocker
>
> There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
> If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
> This usage is spreaded all over the code and need to be fixed.
> As an example, here is a snapshot of a working code :
> /*
> * create objectClass=top, objectClass=organizationalUnit
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass".toLowerCase());
> Attribute attr2 = attributes.get("objectClass".toLowerCase());
> Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
> /*
> * The same piece of code, without the lowerCase()
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass");
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass");
> Attribute attr2 = attributes.get("objectClass");
> Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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: (DIREVE-224) Pb with case sensitivity for attributes
Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/DIREVE-224?page=all ]
Alex Karasulu resolved DIREVE-224:
----------------------------------
Resolution: Fixed
Committed changes that correct all misuses of BasicAttributes here:
http://svn.apache.org/viewcvs?rev=232433&view=rev
Now all BasicAttriubtes are case insensitive for attribute Ids. This is consistent across the board.
> Pb with case sensitivity for attributes
> ---------------------------------------
>
> Key: DIREVE-224
> URL: http://issues.apache.org/jira/browse/DIREVE-224
> Project: Directory Server
> Type: Bug
> Components: server main
> Versions: 0.9.2
> Reporter: Emmanuel Lecharny
> Assignee: Alex Karasulu
> Priority: Blocker
>
> There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")
> If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.
> This usage is spreaded all over the code and need to be fixed.
> As an example, here is a snapshot of a working code :
> /*
> * create objectClass=top, objectClass=organizationalUnit
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass".toLowerCase());
> Attribute attr2 = attributes.get("objectClass".toLowerCase());
> Assert.assertTrue( attr == attr2 ); // no problem, they are equal.
> /*
> * The same piece of code, without the lowerCase()
> */
> Attributes attributes = new BasicAttributes();
> Attribute attribute = new BasicAttribute( "objectClass");
> attribute.add( "top" );
> attribute.add( "organizationalUnit" );
> attributes.put( attribute );
>
> Attribute attr = attributes.get("objectclass");
> Attribute attr2 = attributes.get("objectClass");
> Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.
--
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