summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-05-30 18:10:05 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-05-30 18:10:05 -0400
commit1fc0629626382c33f562a55c8b9b7a0d0bb0ac88 (patch)
tree8acc4a07f138c69588ce7b1a18d51bdfc8cea3e1 /src
parent2a4501dfb7b04dc1359b4bbbff13b5351392d669 (diff)
- take a write-lock when we're initially populating (at startup) or updating
maps (via postoperation callbacks)
Diffstat (limited to 'src')
-rw-r--r--src/backend.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend.c b/src/backend.c
index 148db3d..99d2f55 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -206,9 +206,9 @@ backend_map_entry_cb(Slapi_Entry *e, void *callback_data)
data->value_fmt, &visited_dn_list);
/* Pull out the NDN of this entry. */
dn = slapi_entry_get_ndn(e);
- /* If we actually generated a value, then set it for all keys. */
+ /* If we actually generated a value, then set it, otherwise clear it in
+ * case there was one set before. */
if ((key != NULL) && (value != NULL)) {
- /* For each key, set the value. */
slapi_log_error(SLAPI_LOG_PLUGIN,
data->state->plugin_desc->spd_id,
"setting domain/map/key/value "
@@ -433,10 +433,12 @@ backend_startup(struct plugin_state *state)
NULL,
state->plugin_identity,
0);
+ map_wrlock();
slapi_search_internal_callback_pb(pb, state,
NULL,
backend_map_config_entry_cb,
NULL);
+ map_unlock();
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
}
@@ -585,6 +587,7 @@ backend_add_cb(Slapi_PBlock *pb)
"added \"%s\"\n", cbdata.dn);
/* Add map entries which corresponded to this directory server
* entry. */
+ map_wrlock();
if (!map_data_foreach_map(cbdata.state, NULL,
backend_add_entry_cb, &cbdata)) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -592,6 +595,7 @@ backend_add_cb(Slapi_PBlock *pb)
"error adding map entries corresponding to "
"\"%s\"\n", cbdata.dn);
}
+ map_unlock();
/* If it's a map configuration entry, add and populate the map. XXX */
return 0;
}
@@ -692,6 +696,7 @@ backend_modify_cb(Slapi_PBlock *pb)
"modified \"%s\"\n", cbdata.dn);
/* Modify map entries which corresponded to this directory server
* entry. */
+ map_wrlock();
if (!map_data_foreach_map(cbdata.state, NULL,
backend_modify_entry_cb, &cbdata)) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -699,6 +704,7 @@ backend_modify_cb(Slapi_PBlock *pb)
"error modifying map entries corresponding to "
"\"%s\"\n", cbdata.dn);
}
+ map_unlock();
/* If it's a map configuration entry, reconfigure, clear, and
* repopulate the map. XXX */
return 0;
@@ -848,6 +854,7 @@ backend_modrdn_cb(Slapi_PBlock *pb)
cbdata.dn_pre, cbdata.dn_post);
/* Modify map entries which corresponded to this directory server
* entry. */
+ map_wrlock();
if (!map_data_foreach_map(cbdata.state, NULL,
backend_modrdn_entry_cb, &cbdata)) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -855,6 +862,7 @@ backend_modrdn_cb(Slapi_PBlock *pb)
"error renaming map entries corresponding to "
"\"%s\"\n", cbdata.dn_post);
}
+ map_unlock();
/* If it's a map configuration entry, reconfigure, clear, and
* repopulate the map. XXX */
return 0;
@@ -900,6 +908,7 @@ backend_delete_cb(Slapi_PBlock *pb)
"deleted \"%s\"\n", cbdata.dn);
/* Remove map entries which corresponded to this directory server
* entry. */
+ map_wrlock();
if (!map_data_foreach_map(cbdata.state, NULL,
backend_delete_entry_cb, &cbdata)) {
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -907,6 +916,7 @@ backend_delete_cb(Slapi_PBlock *pb)
"error removing map entries corresponding to "
"\"%s\"\n", cbdata.dn);
}
+ map_unlock();
/* If it's a map configuration entry, remove the map. XXX */
return 0;
}