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

Richard Allen Megginson rmeggins at fedoraproject.org
Thu Jun 26 14:32:17 UTC 2014


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

New commits:
commit 4bccd2b735d1fc6765f37623f8f67d6c2f22226d
Author: Rich Megginson <rmeggins at 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.2.11
    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)
    (cherry picked from commit 18bc3e82c3919867f14747343e452019630b60d0)
    (cherry picked from commit e260d9fd9e680579677007b6466f4e9ad3323eb6)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index 2775785..7026a79 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -341,19 +341,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;
 }
 




More information about the 389-commits mailing list