andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 7ec70c93f5cec20b8bd35b715c0aa00a913dfa63 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Wed, 1 Jul 2015 18:16:20 -0700
dc8c34
Subject: [PATCH 351/363] Ticket #48212 - Dynamic nsMatchingRule changes had no
dc8c34
 effect on the attrinfo thus following reindexing, as well.
dc8c34
dc8c34
Description: When nsMatchingRule was dynamically updated in an index entry,
dc8c34
the value was set to the configuration but was not applied to the attribute
dc8c34
info.  On-line reindexing following the nsMatchingRule change actually ignored
dc8c34
the setting. On the other hand, the standalone utility dbverify independently
dc8c34
picked up the nsMatchingRule from the configuration and generated the attribute
dc8c34
info, which expected the index reindexed based upon the new nsMatchingRule. But
dc8c34
it was actually not and dbverify reported the index corruption.
dc8c34
dc8c34
This patch applies the changes to the attribute info when nsMatchingRule is
dc8c34
modified.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48212
dc8c34
dc8c34
Reviewed by rmeggins@redhat.com (Thank you, Rich!)
dc8c34
dc8c34
(cherry picked from commit d9679725e69df1d191864ca00bad6b79b13e7362)
dc8c34
(cherry picked from commit d15beff66fd28902bd8ca80af12ad76a7ecbe57d)
dc8c34
(cherry picked from commit 96cb1511b46e35f93ff47a0ad56d6e19a8e06227)
dc8c34
(cherry picked from commit 84b03a890b7773fce0adb79e692b6e4d9c70d574)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_attr.c | 11 ++++++++++-
dc8c34
 1 file changed, 10 insertions(+), 1 deletion(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
dc8c34
index 1992174..db087fe 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
dc8c34
@@ -156,7 +156,16 @@ ainfo_dup(
dc8c34
   attrinfo_delete_idlistinfo(&a->ai_idlistinfo);
dc8c34
   a->ai_idlistinfo = b->ai_idlistinfo;
dc8c34
   b->ai_idlistinfo = NULL;
dc8c34
-  
dc8c34
+
dc8c34
+  /* copy cmp functions and substr lengths */
dc8c34
+  a->ai_key_cmp_fn = b->ai_key_cmp_fn;
dc8c34
+  a->ai_dup_cmp_fn = b->ai_dup_cmp_fn;
dc8c34
+  if (b->ai_substr_lens) {
dc8c34
+    size_t substrlen = sizeof(int) * INDEX_SUBSTRLEN;
dc8c34
+    a->ai_substr_lens = (int *)slapi_ch_calloc(1, substrlen);
dc8c34
+    memcpy(a->ai_substr_lens, b->ai_substr_lens, substrlen);
dc8c34
+  }
dc8c34
+
dc8c34
   return( 1 );
dc8c34
 }
dc8c34
 
dc8c34
-- 
dc8c34
2.4.3
dc8c34