summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2008-11-03 23:21:16 +0000
committerNathan Kinder <nkinder@redhat.com>2008-11-03 23:21:16 +0000
commit485b3ddd27e4c1ac66b0c5aada1dae793bcc54dc (patch)
tree72b83242a20fc2093fd298aaf88afabf4f813c88 /ldap
parent8f5cb533588e0e83d4ffca80709d2554200514a3 (diff)
downloadds-485b3ddd27e4c1ac66b0c5aada1dae793bcc54dc.tar.gz
ds-485b3ddd27e4c1ac66b0c5aada1dae793bcc54dc.tar.xz
ds-485b3ddd27e4c1ac66b0c5aada1dae793bcc54dc.zip
Resolves: 467931
Summary: Fix crash caused by DNA shared config update event.
Diffstat (limited to 'ldap')
-rw-r--r--ldap/servers/plugins/dna/dna.c77
1 files changed, 48 insertions, 29 deletions
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 264d73a3..4148da4e 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -603,6 +603,7 @@ dna_load_plugin_config()
int status = DNA_SUCCESS;
int result;
int i;
+ time_t now;
Slapi_PBlock *search_pb;
Slapi_Entry **entries = NULL;
@@ -639,6 +640,14 @@ dna_load_plugin_config()
dna_parse_config_entry(entries[i], 1);
}
+ /* Setup an event to update the shared config 30
+ * seconds from now. We need to do this since
+ * performing the operation at this point when
+ * starting up would cause the change to not
+ * get changelogged. */
+ time(&now);
+ slapi_eq_once(dna_update_config_event, NULL, now + 30);
+
cleanup:
slapi_free_search_results_internal(search_pb);
slapi_pblock_destroy(search_pb);
@@ -1021,16 +1030,6 @@ dna_parse_config_entry(Slapi_Entry * e, int apply)
}
dna_free_config_entry(&entry);
} else {
- time_t now;
-
- time(&now);
-
- /* Setup an event to update the shared config 30
- * seconds from now. We need to do this since
- * performing the operation now would cause the
- * change to not get changelogged. */
- slapi_eq_once(dna_update_config_event, entry, now + 30);
-
ret = DNA_SUCCESS;
}
@@ -1174,39 +1173,59 @@ dna_load_host_port()
* dna_update_config_event()
*
* Event queue callback that we use to do the initial
- * update of the shared config entry shortly after
+ * update of the shared config entries shortly after
* startup.
*/
static void
dna_update_config_event(time_t event_time, void *arg)
{
Slapi_PBlock *pb = NULL;
- struct configEntry *config_entry = arg;
-
- if ((pb = slapi_pblock_new()) == NULL)
- goto bail;
+ struct configEntry *config_entry = NULL;
+ PRCList *list = NULL;
/* Get read lock to prevent config changes */
dna_read_lock();
- /* First delete the existing shared config entry. This
- * will allow the entry to be updated for things like
- * port number changes, etc. */
- slapi_delete_internal_set_pb(pb, config_entry->shared_cfg_dn,
- NULL, NULL, getPluginID(), 0);
+ /* Loop through all config entries and update the shared
+ * config entries. */
+ if (!PR_CLIST_IS_EMPTY(dna_global_config)) {
+ list = PR_LIST_HEAD(dna_global_config);
- /* We don't care about the results */
- slapi_delete_internal_pb(pb);
+ /* Create the pblock. We'll reuse this for all
+ * shared config updates. */
+ if ((pb = slapi_pblock_new()) == NULL)
+ goto bail;
- /* Now force the entry to be recreated */
- slapi_lock_mutex(config_entry->lock);
- dna_update_shared_config(config_entry);
- slapi_unlock_mutex(config_entry->lock);
- dna_unlock();
+ while (list != dna_global_config) {
+ config_entry = (struct configEntry *) list;
- bail:
+ /* If a shared config dn is set, update the shared config. */
+ if (config_entry->shared_cfg_dn != NULL) {
+ slapi_lock_mutex(config_entry->lock);
+
+ /* First delete the existing shared config entry. This
+ * will allow the entry to be updated for things like
+ * port number changes, etc. */
+ slapi_delete_internal_set_pb(pb, config_entry->shared_cfg_dn,
+ NULL, NULL, getPluginID(), 0);
+
+ /* We don't care about the results */
+ slapi_delete_internal_pb(pb);
+
+ /* Now force the entry to be recreated */
+ dna_update_shared_config(config_entry);
+
+ slapi_unlock_mutex(config_entry->lock);
+ slapi_pblock_init(pb);
+ }
+
+ list = PR_NEXT_LINK(list);
+ }
+ }
+
+bail:
+ dna_unlock();
slapi_pblock_destroy(pb);
- pb = NULL;
}
/****************************************************