Thursday, June 26, 2014

[389-commits] Branch '389-ds-base-1.3.1' - ldap/servers

ldap/servers/slapd/back-ldbm/ldbm_index_config.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 18bc3e82c3919867f14747343e452019630b60d0
Author: Rich Megginson <rmeggins@redhat.com>
Date: Wed Jun 25 16:49:50 2014 -0600

Ticket #47831 - server restart wipes out index config if there is a default index

https://fedorahosted.org/389/ticket/47831
Reviewed by: nhosoi (Thanks!)
Branch: 389-ds-base-1.3.1
Fix Description: In ldbm_instance_index_config_enable_index(), only call
the function ldbm_index_parse_entry() if the index does not exist. Instead,
get the name of the index from the "cn" attribute of the entry, and use
ainfo_get() to get the index. If this returns NULL, then call
ldbm_index_parse_entry() to create and parse the index.
Platforms tested: Fedora 20
Flag Day: no
Doc impact: no

(cherry picked from commit 5c5c9603946ecb89fb17df665a95aa3ce75e01de)
(cherry picked from commit 111e11ad2b8ef1f3a1827e0aa833512189424a8b)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index e2bec79..51801f5 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -347,19 +347,26 @@ int ldbm_instance_config_add_index_entry(
int
ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry* e)
{
- char *index_name;
- int rc;
+ char *index_name = NULL;
+ int rc = LDAP_SUCCESS;
+ struct attrinfo *ai = NULL;

- rc=ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
+ index_name = slapi_entry_attr_get_charptr(e, "cn");
+ if (index_name) {
+ ainfo_get(inst->inst_be, index_name, &ai);
+ }
+ if (!ai) {
+ rc=ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
+ }
if (rc == LDAP_SUCCESS) {
/* Assume the caller knows if it is OK to go online immediately */
- struct attrinfo *ai = NULL;
-
- ainfo_get(inst->inst_be, index_name, &ai);
+ if (!ai) {
+ ainfo_get(inst->inst_be, index_name, &ai);
+ }
PR_ASSERT(ai != NULL);
ai->ai_indexmask &= ~INDEX_OFFLINE;
- slapi_ch_free((void **)&index_name);
- }
+ }
+ slapi_ch_free_string(&index_name);
return rc;
}


--
389 commits mailing list
389-commits@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-commits

No comments:

Post a Comment