You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/10/05 10:23:00 UTC
svn commit: r453136 - in /directory/branches:
apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/
shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/
shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/c...
Author: elecharny
Date: Thu Oct 5 01:22:58 2006
New Revision: 453136
URL: http://svn.apache.org/viewvc?view=rev&rev=453136
Log:
Fixed DIRSERVER-756 : The DN was not encoded correctly when returned
in SearchResultEntry and LdapResult.
Modified:
directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java
directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java?view=diff&rev=453136&r1=453135&r2=453136
==============================================================================
--- directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java (original)
+++ directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/AddingEntriesWithSpecialCharactersInRDNTest.java Thu Oct 5 01:22:58 2006
@@ -140,6 +140,7 @@
Attribute cn = sr.getAttributes().get("cn");
assertNotNull(cn);
assertTrue(cn.contains("Bush, Kate"));
+ assertEquals( "cn=Bush\\, Kate", sr.getName() );
}
ctx.destroySubcontext(rdn);
Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java?view=diff&rev=453136&r1=453135&r2=453136
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java Thu Oct 5 01:22:58 2006
@@ -101,6 +101,9 @@
/** The DN that is matched by the Bind */
private LdapDN matchedDN;
+
+ /** Temporary storage of the byte[] representing the matchedDN */
+ private transient byte[] matchedDNBytes;
/** The error message */
private String errorMessage;
@@ -263,7 +266,8 @@
}
else
{
- ldapResultLength += 1 + TLV.getNbBytes( LdapDN.getNbBytes( matchedDN ) ) + LdapDN.getNbBytes( matchedDN );
+ matchedDNBytes = StringTools.getBytesUtf8( matchedDN.getUpName() );
+ ldapResultLength += 1 + TLV.getNbBytes( matchedDNBytes.length ) + matchedDNBytes.length;
}
// The errorMessage length
@@ -318,7 +322,7 @@
}
// The matchedDN
- Value.encode( buffer, LdapDN.getBytes( matchedDN ) );
+ Value.encode( buffer, matchedDNBytes );
// The error message
Value.encode( buffer, errorMessageBytes );
Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java?view=diff&rev=453136&r1=453135&r2=453136
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java Thu Oct 5 01:22:58 2006
@@ -71,6 +71,9 @@
/** The DN of the returned entry */
private LdapDN objectName;
+ /** A temporary storage for the byte[] representing the objectName */
+ private transient byte[] objectNameBytes;
+
/** The attributes list. It contains javax.naming.directory.Attribute */
private Attributes partialAttributeList;
@@ -225,9 +228,10 @@
*/
public int computeLength()
{
+ objectNameBytes = StringTools.getBytesUtf8( objectName.getUpName() );
+
// The entry
- searchResultEntryLength = 1 + TLV.getNbBytes( LdapDN.getNbBytes( objectName ) )
- + LdapDN.getNbBytes( objectName );
+ searchResultEntryLength = 1 + TLV.getNbBytes( objectNameBytes.length ) + objectNameBytes.length;
// The attributes sequence
attributesLength = 0;
@@ -359,7 +363,7 @@
buffer.put( TLV.getBytes( searchResultEntryLength ) );
// The objectName
- Value.encode( buffer, LdapDN.getBytes( objectName ) );
+ Value.encode( buffer, objectNameBytes );
// The attributes sequence
buffer.put( UniversalTag.SEQUENCE_TAG );