ldap/servers/plugins/replication/cl5_api.c | 2 -
ldap/servers/slapd/back-ldbm/filterindex.c | 39 +++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 3 deletions(-)
New commits:
commit bb7a41be1d456f74273a301e0ec1926feb091de9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Apr 17 16:07:49 2013 -0700
Ticket #47330 - changelog db extension / upgrade is obsolete
Fix description: There was a typo in commit 845a221350bc58166773f50526adfd186bdc86e6.
Replaced _cl5UpgradeMajor with _cl5UpgradeMinor for the minor upgrade.
diff --git a/ldap/servers/plugins/replication/cl5_api.c
b/ldap/servers/plugins/replication/cl5_api.c
index 6b621e5..885e3a1 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -3080,7 +3080,7 @@ static int _cl5CheckDBVersion ()
else if (dbminor < DB_VERSION_MINOR)
{
/* minor upgrade */
- rc = _cl5UpgradeMajor(dbVersion, clVersion);
+ rc = _cl5UpgradeMinor(dbVersion, clVersion);
if (rc != CL5_SUCCESS)
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
commit fae006821bd6e524c0f7f8d5f023f4fe5e160ef0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Apr 17 14:55:56 2013 -0700
Ticket #47313 - Indexed search with filter containing '&' and
"!" with attribute subtypes gives wrong result
Bug description: Index db files do not contain the subtype knowledge,
which is only in the primary id2entry db and entries in the memory.
If the search filter includes subtype in the NOT condition and
the type is indexed, the condition is mistakenly simplified to
the one equivalent to not having the subtype.
E.g., if the given filter is (&(cn=A*)(!(cn;fr=ABC en)), it's
evaluated as (&(cn=A*)(!(cn=ABC en)).
Fix description: If a filter contains a subtype in NOT condition,
we give up using the index and leave the not evaluation to the
search return code.
Reviewed by Rich (Thank you!!)
https://fedorahosted.org/389/ticket/47313
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c
b/ldap/servers/slapd/back-ldbm/filterindex.c
index 9dc9cbf..865f8ab 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -630,6 +630,27 @@ done:
return idl;
}
+/*
+ * If the filter type contains subtype, it returns 1; otherwise, returns 0.
+ */
+static int
+filter_is_subtype(Slapi_Filter *f)
+{
+ char *p = NULL;
+ size_t len = 0;
+ int issubtype = 0;
+ if (f) {
+ p = strchr(f->f_type, ';');
+ if (p) {
+ len = p - f->f_type;
+ if (len < strlen(f->f_type)) {
+ issubtype = 1;
+ }
+ }
+ }
+ return issubtype;
+}
+
static IDList *
list_candidates(
Slapi_PBlock *pb,
@@ -777,7 +798,17 @@ list_candidates(
/* Fetch the IDL for foo */
/* Later we'll remember to call idl_notin() */
LDAPDebug( LDAP_DEBUG_TRACE,"NOT filter\n", 0, 0, 0 );
- tmp = ava_candidates( pb, be, slapi_filter_list_first(f),
LDAP_FILTER_EQUALITY, nextf, range, err, allidslimit );
+ if (filter_is_subtype(slapi_filter_list_first(f))) {
+ /*
+ * If subtype is included in the filter (e.g., !(cn;fr=<CN>)),
+ * we have to give up using the index since the subtype info
+ * is not in the index.
+ */
+ tmp = idl_allids( be );
+ } else {
+ tmp = ava_candidates(pb, be, slapi_filter_list_first(f),
+ LDAP_FILTER_EQUALITY, nextf, range, err, allidslimit);
+ }
} else {
if (fpairs[0] == f)
{
@@ -819,9 +850,13 @@ list_candidates(
break; /* We can exit the loop now, since the candidate list is small
already */
}
} else if ( ftype == LDAP_FILTER_AND ) {
- if (isnot) {
+ if (isnot && !idl_is_allids(tmp)) {
IDList *new_idl = NULL;
int notin_result = 0;
+ /*
+ * If the given tmp is ALLIDs (due to subtype in filter),
+ * we cannot use idl_notin.
+ */
notin_result = idl_notin( be, idl, tmp, &new_idl );
if (notin_result) {
idl_free(idl);