[389-commits] ldap/servers

Noriko Hosoi nhosoi at fedoraproject.org
Wed May 26 00:01:49 UTC 2010


 ldap/servers/slapd/dn.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 50d1c0aaa081a6e2ead6518e992b18e3a12521b3
Author: Noriko Hosoi <nhosoi at redhat.com>
Date:   Tue May 25 16:54:46 2010 -0700

    595893 - Base DN in SASL mapping is not normalized
    
    https://bugzilla.redhat.com/show_bug.cgi?id=595893
    
    Fix Description: It must be guaranteed that ndn returned
    from slapi_sdn_get_ndn is normalized.  Putting back the
    normalization code in slapi_sdn_get_ndn.

diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index bd229d7..bd22f76 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -1918,10 +1918,26 @@ slapi_sdn_get_ndn(const Slapi_DN *sdn)
         if(sdn->dn!=NULL)
         {
             char *p= slapi_ch_strdup(sdn->dn);
+            char *normed = NULL;
+            size_t dnlen = 0;
+            int rc = 0;
+
             Slapi_DN *ncsdn= (Slapi_DN*)sdn; /* non-const Slapi_DN */
-            slapi_dn_ignore_case(p); /* dn is normalized; just ignore case */
-            ncsdn->ndn= p;
-            ncsdn->ndn_len=strlen(p);
+            rc = slapi_dn_normalize_case_ext(p, 0, &normed, &dnlen);
+            if (rc < 0) {
+                /* we give up, just set dn to ndn */
+                slapi_dn_ignore_case(p); /* ignore case */
+                ncsdn->ndn = p;
+                ncsdn->ndn_len = strlen(p);
+            } else if (rc == 0) { /* p is passed in */
+                *(normed + dnlen) = '\0';
+                ncsdn->ndn = normed;
+                ncsdn->ndn_len = dnlen;
+            } else { /* rc > 0 */
+                slapi_ch_free_string(&p);
+                ncsdn->ndn = normed;
+                ncsdn->ndn_len = dnlen;
+            }
             ncsdn->flag= slapi_setbit_uchar(sdn->flag,FLAG_NDN);
             PR_INCREMENT_COUNTER(slapi_sdn_counter_ndn_created);
             PR_INCREMENT_COUNTER(slapi_sdn_counter_ndn_exist);




More information about the 389-commits mailing list