Bug 574167 - An escaped space at the end of the RDN value is not handled correctly
Summary: An escaped space at the end of the RDN value is not handled correctly
Alias: None
Product: 389
Classification: Retired
Component: Database - Import/Export
Version: 1.2.6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
Depends On:
Blocks: 434914
TreeView+ depends on / blocked
Reported: 2010-03-16 19:13 UTC by Noriko Hosoi
Modified: 2015-12-07 16:57 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-12-07 16:57:21 UTC

Attachments (Terms of Use)
git patch file (master) (3.58 KB, patch)
2010-04-27 19:08 UTC, Noriko Hosoi
nkinder: review+
Details | Diff
test data (suffix: dc=example,dc=com) (599 bytes, text/plain)
2010-04-27 20:15 UTC, Noriko Hosoi
no flags Details

Description Noriko Hosoi 2010-03-16 19:13:27 UTC
Description of problem:
Add this entry:
dn: ou=\#\ ,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top

Search result:
dn: ou=\#\ ,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: #

Exported entry:
# entry-id: 11
dn: ou=\#\,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: #
creatorsName: cn=directory manager
modifiersName: cn=directory manager
createTimestamp: 20100316171116Z
modifyTimestamp: 20100316171116Z
nsUniqueId: d4994a81-311e11df-ab07d9d1-eac8aaf9

Expected results:
Expected search result & exported entry:
dn: ou=\23\20,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou:: IyA=

Comment 1 Noriko Hosoi 2010-04-27 19:08:45 UTC
Created attachment 409555 [details]
git patch file (master)


Bug Description: If a DN contains "\ " at the end of its RDN,
it's be converted to "\20" by slapi_dn_normalize_ext in the
add operation.  But the following search returns ' ' (not
an escaped space).

Fix Description: When slapi_dn_normalize_ext was applied to a
string which contains "\20", it converted the string to ' '.
This fix changes the behaviour so that the string "\20" in
DN remains untouched.

Also, this patch includes a fix to add a default suffix value
with no double quotes in template-suffix-db.ldif.in.  We keep
double quoted suffix for the backward compatibility.

Comment 2 Noriko Hosoi 2010-04-27 20:15:32 UTC
Created attachment 409577 [details]
test data (suffix: dc=example,dc=com)

How to verify the bug:
1) add the test data
$ /usr/lib[64]/mozldap/ldapmodify -a -f /path/to/test.ldif

2) run the search and see these 6 DNs
$ /usr/lib[64]/mozldap/ldapsearch -b "dc=example,dc=com" "(ou=#*)" dn
dn: ou=\23,dc=example,dc=com
dn: ou=\23\20,dc=example,dc=com
dn: ou=\23#,dc=example,dc=com
dn: ou=\23\3C,dc=example,dc=com
dn: ou=\23\2C\2B\22\5C\3E:\3D\3C\3C\3E\3B/,dc=example,dc=com
dn: ou=\23\2C\2B\22\5C\3E:\3D\3C\3C\3E\3B/\20,dc=example,dc=com

Comment 3 Noriko Hosoi 2010-04-27 20:34:45 UTC
Reviewed by Nathan (Thank you!!)

Pushed to master.

$ git merge work
Updating b65b3c9..0501282
Fast forward
 ldap/ldif/template-suffix-db.ldif.in |    1 +
 ldap/servers/slapd/dn.c              |   29 ++++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

$ git push
Counting objects: 15, done.
Delta compression using 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 1.37 KiB, done.
Total 8 (delta 6), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   b65b3c9..0501282  master -> master

Comment 5 Jenny Severance 2010-05-06 15:23:59 UTC
fix verified - redhat-ds-base-8.2.0-2010050604.el5dsrv - RHEL 5.5 32 bit

ldapsearch -x -h hostname.redhat.com -p 389 -D "cn=Directory Manager" -w secret -b "dc=example, dc=com" "(ou=#*)" dn
# extended LDIF
# LDAPv3
# base <dc=example, dc=com> with scope subtree
# filter: (ou=#*)
# requesting: dn 

# \23, example.com
dn: ou=\23,dc=example,dc=com

# \23\20, example.com
dn: ou=\23\20,dc=example,dc=com

# \23#, example.com
dn: ou=\23#,dc=example,dc=com

# \23\3C, example.com
dn: ou=\23\3C,dc=example,dc=com

# \23\2C\2B\22\5C\3E:\3D\3C\3C\3E\3B/, example.com
dn: ou=\23\2C\2B\22\5C\3E:\3D\3C\3C\3E\3B/,dc=example,dc=com

# \23\2C\2B\22\5C\3E:\3D\3C\3C\3E\3B/\20, example.com
dn: ou=\23\2C\2B\22\5C\3E:\3D\3C\3C\3E\3B/\20,dc=example,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 7
# numEntries: 6

Note You need to log in before you can comment on or make changes to this bug.