[Date Prev][Date Next] [Chronological] [Thread] [Top]

no whitespace compression in dn (ITS#852)

Full_Name: David Cooper
Version: 2.0.6
OS: Red Hat Linux 6.2
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

The normalization process for DNs does not compress whitespace within attribute
values nor does it eliminate whitespace at the end of the DN. For example, if a
DN of the form

dn: cn=User1, ou=NIST, o=U.S.   Government, c=US
is entered into the database, a search with a base of "o=U.S. Government, c=US
will not find the entry.

I was able to correct these problems by adding a few lines of code to the
dn_validate function in openldap-2.0.6/servers/slapd/dn.c.

First, under the section "case INVALUE:", I replaced

} else {
	*d++ = *s;


} else if ( ASCII_SPACE( *s ) ) {
	if ( !ASCII_SPACE( *(d - 1) ) ) {
	*d++ = ' ';
} else {
	*d++ = *s;

second, after the for loop, but before the line "*d = '\0';", I added the
following lines:

if (state != B4LEADTYPE) {
	while ( ASCII_SPACE( *(d - 1) ) )

These changes seem to have fixed the problem, however, given that I am not very
familiar with the code, I can not be sure that this was the best way to fix the
problem or that it solves the problem entirely.