Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory
cvs-int.fedora.redhat.com:/tmp/cvs-serv12862/ldapserver/ldap/servers/slapd/back-ldbm
Modified Files:
ldbm_config.c ldbm_instance_config.c
Log Message:
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
Index: ldbm_config.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldbm_config.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ldbm_config.c 15 Mar 2007 21:34:32 -0000 1.11
+++ ldbm_config.c 14 Nov 2007 15:04:51 -0000 1.12
@@ -82,8 +82,10 @@
Slapi_Entry *e;
Slapi_PBlock *util_pb = NULL;
int rc;
+ int result;
char entry_string[512];
int dont_write_file = 0;
+ char ebuf[BUFSIZ];
if (flags & LDBM_INSTANCE_CONFIG_DONT_WRITE) {
dont_write_file = 1;
@@ -93,11 +95,21 @@
util_pb = slapi_pblock_new();
PR_snprintf(entry_string, 512, entries[x], string1, string2, string3);
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_pblock_set(util_pb, SLAPI_DSE_DONT_WRITE_WHEN_ADDING,
&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);
}
Index: ldbm_instance_config.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ldbm_instance_config.c 25 Jul 2007 15:20:01 -0000 1.8
+++ ldbm_instance_config.c 14 Nov 2007 15:04:51 -0000 1.9
@@ -490,27 +490,11 @@
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 */
PR_snprintf(dn, BUFSIZ, "cn=%s, cn=%s, cn=plugins, cn=config",