[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-directory-commits
Subject:    [389-commits] ldap/ldif ldap/servers
From:       Noriko Hosoi <nhosoi () fedoraproject ! org>
Date:       2010-04-27 20:33:29
Message-ID: 20100427203329.B0D7812096E () lists ! fedorahosted ! org
[Download RAW message or body]

 ldap/ldif/template-suffix-db.ldif.in |    1 +
 ldap/servers/slapd/dn.c              |   29 ++++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 0501282a9042af77c20b793645a5b241082a08b5
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 743aa36..f30578f 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 mailing list
389-commits@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic