mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-29 02:59:34 -05:00
Add better space compression
This commit is contained in:
parent
f417a66feb
commit
38cf4a1d82
1 changed files with 11 additions and 3 deletions
|
|
@ -34,10 +34,11 @@
|
|||
*/
|
||||
|
||||
char *
|
||||
dn_validate( char *dn )
|
||||
dn_validate( char *dn_in )
|
||||
{
|
||||
char *d, *s;
|
||||
int state, gotesc;
|
||||
char *dn = dn_in;
|
||||
|
||||
gotesc = 0;
|
||||
state = B4LEADTYPE;
|
||||
|
|
@ -121,7 +122,7 @@ dn_validate( char *dn )
|
|||
!RDN_SEPARATOR( *s ) ) {
|
||||
*--d = *s;
|
||||
d++;
|
||||
} else {
|
||||
} else if( !ASCII_SPACE( *s ) || !ASCII_SPACE( *(d - 1) ) ) {
|
||||
*d++ = *s;
|
||||
}
|
||||
break;
|
||||
|
|
@ -133,7 +134,7 @@ dn_validate( char *dn )
|
|||
} else if ( gotesc && !RDN_NEEDSESCAPE( *s ) ) {
|
||||
*--d = *s;
|
||||
d++;
|
||||
} else {
|
||||
} else if( !ASCII_SPACE( *s ) || !ASCII_SPACE( *(d - 1) ) ) {
|
||||
*d++ = *s;
|
||||
}
|
||||
break;
|
||||
|
|
@ -142,6 +143,8 @@ dn_validate( char *dn )
|
|||
if ( RDN_SEPARATOR( *s ) ) {
|
||||
state = B4TYPE;
|
||||
*d++ = *s;
|
||||
} else if ( !ASCII_SPACE( *s ) ) {
|
||||
dn = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -158,6 +161,11 @@ dn_validate( char *dn )
|
|||
gotesc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* trim trailing spaces */
|
||||
while( d > dn_in && ASCII_SPACE( *(d-1) ) ) {
|
||||
--d;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
if( gotesc ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue