瀏覽代碼

Resolves: bug 339041
Bug Description: migration : encryption key entries missing when source is 6.21
Reviewed by: nhosoi (Thanks!)
Fix Description: I found out why it wasn't always adding the attribute encryption entries. If the cn=monitor entry existed for the database, it would not add the other container entries. I don't know why it did that. I changed it to always add those entries, and just skip the ones that already exist. This should ensure that the attribute encryption entries always exist.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none

Rich Megginson 18 年之前
父節點
當前提交
69586c4c25
共有 2 個文件被更改,包括 19 次插入23 次删除
  1. 14 2
      ldap/servers/slapd/back-ldbm/ldbm_config.c
  2. 5 21
      ldap/servers/slapd/back-ldbm/ldbm_instance_config.c

+ 14 - 2
ldap/servers/slapd/back-ldbm/ldbm_config.c

@@ -82,8 +82,10 @@ int ldbm_config_add_dse_entries(struct ldbminfo *li, char **entries, char *strin
     Slapi_Entry *e;
     Slapi_Entry *e;
     Slapi_PBlock *util_pb = NULL;
     Slapi_PBlock *util_pb = NULL;
     int rc;
     int rc;
+    int result;
     char entry_string[512];
     char entry_string[512];
     int dont_write_file = 0;
     int dont_write_file = 0;
+    char ebuf[BUFSIZ];
 
 
     if (flags & LDBM_INSTANCE_CONFIG_DONT_WRITE) {
     if (flags & LDBM_INSTANCE_CONFIG_DONT_WRITE) {
         dont_write_file = 1;
         dont_write_file = 1;
@@ -93,11 +95,21 @@ int ldbm_config_add_dse_entries(struct ldbminfo *li, char **entries, char *strin
         util_pb = slapi_pblock_new();
         util_pb = slapi_pblock_new();
         PR_snprintf(entry_string, 512, entries[x], string1, string2, string3);
         PR_snprintf(entry_string, 512, entries[x], string1, string2, string3);
         e = slapi_str2entry(entry_string, 0);
         e = slapi_str2entry(entry_string, 0);
+        PR_snprintf(ebuf, sizeof(ebuf), slapi_entry_get_dn_const(e)); /* for logging */
         slapi_add_entry_internal_set_pb(util_pb, e, NULL, li->li_identity, 0);
         slapi_add_entry_internal_set_pb(util_pb, e, NULL, li->li_identity, 0);
         slapi_pblock_set(util_pb, SLAPI_DSE_DONT_WRITE_WHEN_ADDING, 
         slapi_pblock_set(util_pb, SLAPI_DSE_DONT_WRITE_WHEN_ADDING, 
                          &dont_write_file);
                          &dont_write_file);
-        if ((rc = slapi_add_internal_pb(util_pb)) != LDAP_SUCCESS) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Unable to add config entries to the DSE: %d\n", rc, 0, 0);
+        rc = slapi_add_internal_pb(util_pb);
+        slapi_pblock_get(util_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
+        if (!rc && (result == LDAP_SUCCESS)) {
+            LDAPDebug(LDAP_DEBUG_CONFIG, "Added database config entry [%s]\n",
+                      ebuf, 0, 0);
+        } else if (result == LDAP_ALREADY_EXISTS) {
+            LDAPDebug(LDAP_DEBUG_TRACE, "Database config entry [%s] already exists - skipping\n",
+                      ebuf, 0, 0);
+        } else {
+            LDAPDebug(LDAP_DEBUG_ANY, "Unable to add config entry [%s] to the DSE: %d %d\n",
+                      ebuf, result, rc);
         }
         }
         slapi_pblock_destroy(util_pb);
         slapi_pblock_destroy(util_pb);
     }
     }

+ 5 - 21
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c

@@ -490,27 +490,11 @@ ldbm_instance_config_load_dse_info(ldbm_instance *inst)
         slapi_pblock_destroy(search_pb);
         slapi_pblock_destroy(search_pb);
     }
     }
 
 
-    /* now check for cn=monitor -- if not present, add default child entries */
-    search_pb = slapi_pblock_new();
-    PR_snprintf(dn, BUFSIZ, "cn=monitor, cn=%s, cn=%s, cn=plugins, cn=config",
-            inst->inst_name, li->li_plugin->plg_name);
-    slapi_search_internal_set_pb(search_pb, dn, LDAP_SCOPE_BASE,
-                                 "objectclass=*", NULL, 0, NULL, NULL,
-                                 li->li_identity, 0);
-    slapi_search_internal_pb(search_pb);
-    slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &res);
-
-    if (res == LDAP_NO_SUCH_OBJECT) {
-        /* Add skeleton dse entries for this instance */
-        ldbm_config_add_dse_entries(li, ldbm_instance_skeleton_entries,
-                                    inst->inst_name, li->li_plugin->plg_name,
-                                    inst->inst_name, 0);
-    }
-
-    if (search_pb) {
-        slapi_free_search_results_internal(search_pb);
-        slapi_pblock_destroy(search_pb);
-    }
+    /* Add skeleton dse entries for this instance */
+    /* IF they already exist, that's ok */
+    ldbm_config_add_dse_entries(li, ldbm_instance_skeleton_entries,
+                                inst->inst_name, li->li_plugin->plg_name,
+                                inst->inst_name, 0);
 
 
     /* setup the dse callback functions for the ldbm instance config entry */
     /* setup the dse callback functions for the ldbm instance config entry */
     PR_snprintf(dn, BUFSIZ, "cn=%s, cn=%s, cn=plugins, cn=config",
     PR_snprintf(dn, BUFSIZ, "cn=%s, cn=%s, cn=plugins, cn=config",