diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-05-25 16:54:46 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-05-25 16:54:46 -0700 |
commit | 50d1c0aaa081a6e2ead6518e992b18e3a12521b3 (patch) | |
tree | 9602635b7e099866f571a41821c5e2ca77aab311 /ldap | |
parent | 08a38d39590e4117673ca5d5fe2f4d6b1924da1f (diff) | |
download | ds-50d1c0aaa081a6e2ead6518e992b18e3a12521b3.tar.gz ds-50d1c0aaa081a6e2ead6518e992b18e3a12521b3.tar.xz ds-50d1c0aaa081a6e2ead6518e992b18e3a12521b3.zip |
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.
Diffstat (limited to 'ldap')
-rw-r--r-- | ldap/servers/slapd/dn.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c index bd229d72..bd22f76e 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); |