summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/back-ldbm/index.c
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2006-11-06 20:51:32 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2006-11-06 20:51:32 +0000
commit891043bf95a5973198fc42068adaf72ef2163e4d (patch)
treefdbec1a575d5108eebad9bcff5302e9a1173267f /ldap/servers/slapd/back-ldbm/index.c
parent379091dfc02ea735b75764dbe50cfe17019f89be (diff)
downloadds-891043bf95a5973198fc42068adaf72ef2163e4d.tar.gz
ds-891043bf95a5973198fc42068adaf72ef2163e4d.tar.xz
ds-891043bf95a5973198fc42068adaf72ef2163e4d.zip
Resolves: #199923
Summary: subtree search fails to find items under a db containing special characters (Comment#16) Description: When dn contains rdn which includes '\\', it was escaped twice to generate a key for entrydn and caused mismatch in forming ancestorid index. It ends up the subtree search fail.
Diffstat (limited to 'ldap/servers/slapd/back-ldbm/index.c')
-rw-r--r--ldap/servers/slapd/back-ldbm/index.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index 750c1041..e01a2780 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -381,10 +381,10 @@ index_addordel_entry(
/* if we are adding a tombstone entry (see ldbm_add.c) */
if ((flags & BE_INDEX_TOMBSTONE) && (flags & BE_INDEX_ADD))
{
- Slapi_DN parent;
- Slapi_DN *sdn = slapi_entry_get_sdn(e->ep_entry);
- slapi_sdn_init(&parent);
- slapi_sdn_get_parent(sdn, &parent);
+ Slapi_DN parent;
+ Slapi_DN *sdn = slapi_entry_get_sdn(e->ep_entry);
+ slapi_sdn_init(&parent);
+ slapi_sdn_get_parent(sdn, &parent);
/*
* Just index the "nstombstone" attribute value from the objectclass
* attribute, and the nsuniqueid attribute value, and the entrydn value of the deleted entry.
@@ -404,7 +404,7 @@ index_addordel_entry(
ldbm_nasty(errmsg, 1020, result);
return( result );
}
- slapi_sdn_done(&parent);
+ slapi_sdn_done(&parent);
}
else
{
@@ -414,8 +414,11 @@ index_addordel_entry(
rc = slapi_entry_next_attr( e->ep_entry, attr, &attr ) ) {
slapi_attr_get_type( attr, &type );
svals = attr_get_present_values(attr);
- result = index_addordel_values_sv( be, type, svals, NULL, e->ep_id,
- flags, txn );
+ if ( 0 == strcmp( type, "entrydn" )) {
+ slapi_values_set_flags(svals, SLAPI_ATTR_FLAG_NORMALIZED);
+ }
+ result = index_addordel_values_sv( be, type, svals, NULL,
+ e->ep_id, flags, txn );
if ( result != 0 ) {
ldbm_nasty(errmsg, 1030, result);
return( result );
@@ -423,13 +426,13 @@ index_addordel_entry(
}
/* update ancestorid index . . . */
- /* . . . only if we are not deleting a tombstone entry - tombstone entries are not in the ancestor id index - see bug 603279 */
- if (!((flags & BE_INDEX_TOMBSTONE) && (flags & BE_INDEX_DEL))) {
- result = ldbm_ancestorid_index_entry(be, e, flags, txn);
- if ( result != 0 ) {
- return( result );
- }
- }
+ /* . . . only if we are not deleting a tombstone entry - tombstone entries are not in the ancestor id index - see bug 603279 */
+ if (!((flags & BE_INDEX_TOMBSTONE) && (flags & BE_INDEX_DEL))) {
+ result = ldbm_ancestorid_index_entry(be, e, flags, txn);
+ if ( result != 0 ) {
+ return( result );
+ }
+ }
}
LDAPDebug( LDAP_DEBUG_TRACE, "<= index_%s_entry%s %d\n",
@@ -1643,6 +1646,8 @@ index_addordel_string(backend *be, const char *type, const char *s, ID id, int f
sv.bv.bv_val= (void*)s;
svp[0] = &sv;
svp[1] = NULL;
+ if (flags & BE_INDEX_NORMALIZED)
+ slapi_value_set_flags(&sv, BE_INDEX_NORMALIZED);
return index_addordel_values_ext_sv(be,type,svp,NULL,id,flags,txn,NULL,NULL);
}