ldap/ldif/template-suffix-db.ldif.in | 1 + ldap/servers/slapd/dn.c | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-)
New commits: commit e7a81ddaa86b284d8eb29906e63e7841958f8ef1 Author: Noriko Hosoi nhosoi@redhat.com Date: Tue Apr 27 11:50:43 2010 -0700
574167 - An escaped space at the end of the RDN value is not handled correctly
https://bugzilla.redhat.com/show_bug.cgi?id=574167
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.
diff --git a/ldap/ldif/template-suffix-db.ldif.in b/ldap/ldif/template-suffix-db.ldif.in index 1b97826..1bcc5c2 100644 --- a/ldap/ldif/template-suffix-db.ldif.in +++ b/ldap/ldif/template-suffix-db.ldif.in @@ -21,6 +21,7 @@ dn: cn="%ds_suffix%",cn=mapping tree,cn=config objectclass: top objectclass: extensibleObject objectclass: nsMappingTree +cn: %ds_suffix% cn: "%ds_suffix%" nsslapd-state: backend nsslapd-backend: %ds_bename% diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c index 4a40369..c3aaf4c 100644 --- a/ldap/servers/slapd/dn.c +++ b/ldap/servers/slapd/dn.c @@ -78,6 +78,7 @@ hexchar2int( char c ) }
#define ISBLANK(c) ((c) == ' ') +#define ISBLANKSTR(s) (((*(s)) == '2') && (*((s)+1) == '0')) #define ISSPACE(c) (ISBLANK(c) || ((c) == '\n') || ((c) == '\r')) /* XXX 518524 */
#define ISEQUAL(c) ((c) == '=') @@ -444,6 +445,21 @@ substr_dn_normalize( char *dn, char *end ) return end; }
+static int +ISEOV(char *s, char *ends) +{ + char *p; + int rc = 1; + for (p = s; p && *p && p < ends; p++) { + if (SEPARATOR(*p)) { + return 1; + } else if (!ISBLANK(*p)) { + return 0; /* not the end of the value */ + } + } + return 1; +} + /* * 1) Escaped NEEDSESCAPE chars (e.g., ',', '<', '=', etc.) are converted to * ESC HEX HEX (e.g., \2C, \3C, \3D, etc.) @@ -664,10 +680,13 @@ slapi_dn_normalize_ext(char *src, size_t src_len, char **dest, size_t *dest_len) s++; } } - } else if (((state == INVALUE1ST) && (s+2 < ends) && - LEADNEEDSESCAPESTR(s+1)) || - ((state == INVALUE) && (s+2 < ends) && - NEEDSESCAPESTR(s+1))) { + } else if (((state == INVALUE1ST) && + (s+2 < ends) && LEADNEEDSESCAPESTR(s+1)) || + ((state == INVALUE) && + (((s+2 < ends) && NEEDSESCAPESTR(s+1)) || + (ISEOV(s+3, ends) && ISBLANKSTR(s+1))))) { + /* e.g., cn=abc\20 ,... */ + /* ^ */ if (ISEQUALSTR(s+1)) { if (NULL == subtypestart) { /* e.g., cn=a\3Db\2Cc\3Dd */ @@ -933,7 +952,7 @@ bail: if (*dest != src) { slapi_ch_free_string(dest); } else { - *dest = NULL; + *dest = NULL; } *dest_len = 0; } else if (rc > 0) {
389-commits@lists.fedoraproject.org