Issue Details (XML | Word | Printable)

Key: DIRSERVER-612
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Alex Karasulu
Reporter: Alex Karasulu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

apacheds-tools dump command does NOT generate the correct base 64 output for binary attributes in LDIF dump

Created: 01/May/06 10:31 AM   Updated: 18/Aug/06 02:14 PM
Return to search
Component/s: tools
Affects Version/s: 1.0-RC2
Fix Version/s: 1.5.0, 1.0-RC4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works ADS-1.0-RC4-2006-08-18_apacheds.patch 2006-08-18 01:31 PM Pierre-Arnaud Marcelot 3 kB
Text File Licensed for inclusion in ASF works ADS-1.0-RC4-2006-08-18_shared.patch 2006-08-18 01:32 PM Pierre-Arnaud Marcelot 5 kB
Text File Licensed for inclusion in ASF works ads-1.0RC4-DIRSERVER-612-apacheds.patch 2006-08-02 11:17 AM Pierre-Arnaud Marcelot 2 kB
Text File Licensed for inclusion in ASF works ads-1.0RC4-DIRSERVER-612-shared.patch 2006-08-02 11:21 AM Pierre-Arnaud Marcelot 9 kB
Text File Licensed for inclusion in ASF works ADS-1.1.0-2006-08-18.patch 2006-08-18 12:20 PM Pierre-Arnaud Marcelot 8 kB
Text File Licensed for inclusion in ASF works ADS-1.1.0-2006-08-18_SecondEdition.patch 2006-08-18 01:28 PM Pierre-Arnaud Marcelot 8 kB
Text File Licensed for inclusion in ASF works ads-1.1.0-DIRSERVER-612.patch 2006-08-02 11:22 AM Pierre-Arnaud Marcelot 12 kB

Resolution Date: 18/Aug/06 02:14 PM


 Description  « Hide
The dump command which produces LDIF dumps of partitions is not generating the base64 encoded values for binary attributes. It seems to be printing just the byte[] which shows the id of the object in the jvm instead of the base64 encoded value.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu made changes - 01/May/06 10:32 AM
Field Original Value New Value
Summary apacheds-tools dump command does generate the correct base 64 output for binary attributes in LDIF dump apacheds-tools dump command does NOT generate the correct base 64 output for binary attributes in LDIF dump
Alex Karasulu made changes - 09/May/06 05:39 PM
Fix Version/s 1.0-RC4 [ 12311053 ]
Fix Version/s 1.0-RC3 [ 12310791 ]
Pierre-Arnaud Marcelot added a comment - 02/Aug/06 11:17 AM
Here is a patch for this issue.

Dump now generates base64 encoded for binary attributes and also text attributes that need to be base64 encoded (because they contain special characters, such as accent for example).

The part comes in two parts :
- One for apache/server-tools
- One for shared/ldap
(I couldn't managed to generate a global patch, 'svn diff' at root directory didn't give any difference... Strange...)

This post contains the first part. It must be patched for /apacheds

Pierre-Arnaud Marcelot made changes - 02/Aug/06 11:17 AM
Attachment ads-1.0RC4-DIRSERVER-612-apacheds.patch [ 12337988 ]
Pierre-Arnaud Marcelot added a comment - 02/Aug/06 11:21 AM
Here is the second part.

It must be patched from /shared.

I added a new class LdifUtils containing a method verifying that a String is LDIF safe.
I also implemented a TestCase for this new class and method.

I use this method to check if encoded is needed for text attributes in the Dump Command.

Pierre-Arnaud Marcelot made changes - 02/Aug/06 11:21 AM
Attachment ads-1.0RC4-DIRSERVER-612-shared.patch [ 12337990 ]
Pierre-Arnaud Marcelot added a comment - 02/Aug/06 11:22 AM
Last file...

Here is a patch for the current trunks for v1.1.0.

It must be applied from the root directory.

Pierre-Arnaud Marcelot made changes - 02/Aug/06 11:22 AM
Attachment ads-1.1.0-DIRSERVER-612.patch [ 12337991 ]
Alex Karasulu added a comment - 17/Aug/06 09:04 PM
Anybody apply your patches yet? Looks like it's up for grabs. I'll take care of this one.

Alex Karasulu made changes - 17/Aug/06 09:04 PM
Assignee Alex Karasulu [ akarasulu ]
Alex Karasulu made changes - 17/Aug/06 09:04 PM
Status Open [ 1 ] In Progress [ 3 ]
Repository Revision Date User Message
ASF #432490 Fri Aug 18 05:26:48 UTC 2006 akarasulu Applying PAMs patches for DIRSERVER-612
Files Changed
ADD /directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java
ADD /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java

Repository Revision Date User Message
ASF #432491 Fri Aug 18 05:27:02 UTC 2006 akarasulu Applying PAMs patches for DIRSERVER-612
Files Changed
MODIFY /directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java

Repository Revision Date User Message
ASF #432492 Fri Aug 18 05:34:26 UTC 2006 akarasulu Applying pams patches for DIRSERVER-612
Files Changed
MODIFY /directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java
ADD /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
ADD /directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifUtilsTest.java

Alex Karasulu added a comment - 18/Aug/06 05:34 AM
I applied your patches 432490, 432491 for 1.0 and 432492 for the trunks for 1.1.

THere is however a *big* problem. I noticed this after I applied the patches. I can roll back but instead I can take corrective patches from you. Here's what a dump now looks like:

#---------------------
# Entry: 23
#---------------------

dn: uid=user.22,dc=example,dc=com
pager: Attribute id : 'pager', Values : ['515-711-8297']
employeenumber: Attribute id : 'employeenumber', Values : ['22']
objectclass: Attribute id : 'objectclass', Values : ['person', 'organizationalPerson', 'inetOrgPerson']
mobile: Attribute id : 'mobile', Values : ['338-209-4979']
telephonenumber: Attribute id : 'telephonenumber', Values : ['619-921-3217']
street: Attribute id : 'street', Values : ['76697 Ash Street']
userpassword: Attribute id : 'userpassword', Values : ['cGFzc3dvcmQ=']
uid: Attribute id : 'uid', Values : ['user.22']
postalcode: Attribute id : 'postalcode', Values : ['09762']
givenname: Attribute id : 'givenname', Values : ['Abigael']
mail: Attribute id : 'mail', Values : ['user.22@cs.hacettepe.edu.tr']
l: Attribute id : 'l', Values : ['Dothan']
sn: Attribute id : 'sn', Values : ['Abel']
cn: Attribute id : 'cn', Values : ['Abigael Abel']
postaladdress: Attribute id : 'postaladdress', Values : ['Abigael Abel$76697 Ash Street$Dothan, CO 09762']
description: Attribute id : 'description', Values : ['This is the description for Abigael Abel.']
initials: Attribute id : 'initials', Values : ['AA']
homephone: Attribute id : 'homephone', Values : ['490-458-8467']
st: Attribute id : 'st', Values : ['CO']

Seems like we're using toString() on an attribute object instead of on it's value. The good news is the base64 issue is gone.

Can you supply a patch to fix this problem?

Thanks!

Alex Karasulu made changes - 18/Aug/06 05:34 AM
Status In Progress [ 3 ] Open [ 1 ]
Alex Karasulu added a comment - 18/Aug/06 05:35 AM
It's pretty important that we make sure this dump tool works right before the next release. I'm raisint this to critical.

Alex Karasulu made changes - 18/Aug/06 05:35 AM
Priority Major [ 3 ] Critical [ 2 ]
Alex Karasulu made changes - 18/Aug/06 05:35 AM
Status Open [ 1 ] In Progress [ 3 ]
Pierre-Arnaud Marcelot added a comment - 18/Aug/06 11:05 AM
No problem Alex.

I'm now working on that.

It seems that the toString method I used has been changed in the merge of the optimization branch. This method doesn't print LDIF anymore.

I send the patch as soon as possible.

Pierre-Arnaud Marcelot added a comment - 18/Aug/06 12:20 PM
Here's the patch for Trunks.

The output is now ok.

I also corrected a possible bug. The DN is now encoded to Base64 if it needs to. It was printed as is before.
---
#---------------------
# Entry: 138
#---------------------

dn: Y249TMOpY2hhcm55LCBkYz1leGFtcGxlLGRjPWNvbQ==
cn:: TMOpY2hhcm55
objectclass: person
objectclass: top
---


Moreover, lines are now folded every 80 characters.
---
#---------------------
# Entry: 92
#---------------------

dn: cn=newperson, dc=example,dc=com
jpegphoto:: /9j/4AAQSkZJRgABAQEASABIAAD//gAoRmlsZSB3cml0dGVuIGJ5IEFkb2JlIFBob3Rv
 vc2hvcKggNC4wAA3/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIx
 wcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyM
 jIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAMABAADASIAAhEBAxEB/8QAHwAAAQUB
 AQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE
[...]
---

Pierre-Arnaud Marcelot made changes - 18/Aug/06 12:20 PM
Attachment ADS-1.1.0-2006-08-18.patch [ 12339091 ]
Pierre-Arnaud Marcelot added a comment - 18/Aug/06 01:28 PM
Just a small update to the patch since I noticed that if I forgot to add the additionnal : (Colon) next to the dn definition when the value is Base64 encoded. In my sample output above, "dn: Y249TMOpY2hhcm55LCBkYz1leGFtcGxlLGRjPWNvbQ==" should be "dn:: Y249TMOpY2hhcm55LCBkYz1leGFtcGxlLGRjPWNvbQ==".

Sorry about that.

Pierre-Arnaud Marcelot made changes - 18/Aug/06 01:28 PM
Pierre-Arnaud Marcelot added a comment - 18/Aug/06 01:31 PM
The next two patches are for 1.0-RC4.

This one has to be applied from /apacheds.

Pierre-Arnaud Marcelot made changes - 18/Aug/06 01:31 PM
Attachment ADS-1.0-RC4-2006-08-18_apacheds.patch [ 12339095 ]
Pierre-Arnaud Marcelot added a comment - 18/Aug/06 01:32 PM
And this one has to be applied from /shared.

Pierre-Arnaud Marcelot made changes - 18/Aug/06 01:32 PM
Attachment ADS-1.0-RC4-2006-08-18_shared.patch [ 12339096 ]
Repository Revision Date User Message
ASF #432590 Fri Aug 18 14:09:45 UTC 2006 akarasulu applying second set of patches for DIRSERVER-612
Files Changed
MODIFY /directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java

Repository Revision Date User Message
ASF #432593 Fri Aug 18 14:12:02 UTC 2006 akarasulu applying second set of patches for DIRSERVER-612
Files Changed
MODIFY /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/LockableAttributesImpl.java
MODIFY /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java

Alex Karasulu added a comment - 18/Aug/06 02:13 PM
Applied second set of patches on 1.0 in versions 432590 and 432593 and for 1.1 trunks on version 432597.

NOTE: I applied the SecondEdition patch instead of the first one for the 1.1 trunks. I guessed these patches were not additive.

Alex Karasulu made changes - 18/Aug/06 02:13 PM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Closed [ 6 ]
Alex Karasulu added a comment - 18/Aug/06 02:13 PM
reopen to edit fields

Alex Karasulu made changes - 18/Aug/06 02:13 PM
Resolution Fixed [ 1 ]
Status Closed [ 6 ] Reopened [ 4 ]
Alex Karasulu added a comment - 18/Aug/06 02:14 PM
fixed in 1.1 as well

Alex Karasulu made changes - 18/Aug/06 02:14 PM
Fix Version/s 1.1.0 [ 12310790 ]
Alex Karasulu added a comment - 18/Aug/06 02:14 PM
closed now.

Alex Karasulu made changes - 18/Aug/06 02:14 PM
Status Reopened [ 4 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #432597 Fri Aug 18 14:15:18 UTC 2006 akarasulu applying second set of patches for DIRSERVER-612
Files Changed
MODIFY /directory/trunks/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LockableAttributesImpl.java
MODIFY /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java