diff options
-rw-r--r-- | src/back-shr.c | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/src/back-shr.c b/src/back-shr.c index ade1336..5b7c6ec 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -594,7 +594,14 @@ backend_shr_startup(struct plugin_state *state, NULL, state->plugin_identity, 0); - map_wrlock(); + if (map_wrlock() != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, + state->plugin_desc->spd_id, + "failed to search under \"%s\" for " + "configuration: failed to acquire a lock\n", + state->plugin_base); + goto done_with_lock; + } set_cbdata.state = state; set_cbdata.pb = pb; slapi_search_internal_callback_pb(pb, &set_cbdata, @@ -602,6 +609,7 @@ backend_shr_startup(struct plugin_state *state, backend_set_config_entry_add_cb, NULL); map_unlock(); +done_with_lock: slapi_pblock_destroy(pb); } @@ -1582,7 +1590,14 @@ backend_shr_add_cb(Slapi_PBlock *pb) /* Add map entries which corresponded to this directory server * entry. */ wrap_inc_call_level(); - map_wrlock(); + if (map_wrlock() != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, + cbdata.state->plugin_desc->spd_id, + "error adding set entries corresponding to " + "\"%s\": failed to acquire a lock\n", + cbdata.ndn); + goto done_with_lock; + } if (!map_data_foreach_map(cbdata.state, NULL, backend_shr_add_entry_cb, &cbdata)) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -1604,8 +1619,8 @@ backend_shr_add_cb(Slapi_PBlock *pb) /* Update entries in maps which are affected by this entry. */ backend_shr_update_references(cbdata.state, pb, cbdata.e, NULL, NULL); - map_unlock(); +done_with_lock: wrap_dec_call_level(); return 0; } @@ -2009,7 +2024,14 @@ backend_shr_modify_cb(Slapi_PBlock *pb) /* Modify map entries which corresponded to this directory server * entry. */ wrap_inc_call_level(); - map_wrlock(); + if (map_wrlock() != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, + cbdata.state->plugin_desc->spd_id, + "error modifying set entries corresponding to " + "\"%s\": failed to acquire a lock\n", + cbdata.ndn); + goto done_with_lock; + } if (!map_data_foreach_map(cbdata.state, NULL, backend_shr_modify_entry_cb, &cbdata)) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -2059,6 +2081,7 @@ backend_shr_modify_cb(Slapi_PBlock *pb) slapi_sdn_free(&sdn); } map_unlock(); +done_with_lock: wrap_dec_call_level(); free(cbdata.modlist); return 0; @@ -2178,7 +2201,14 @@ backend_shr_modrdn_cb(Slapi_PBlock *pb) /* Modify map entries which corresponded to this directory server * entry. */ wrap_inc_call_level(); - map_wrlock(); + if (map_wrlock() != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, + cbdata.state->plugin_desc->spd_id, + "error renaming map entries corresponding to " + "\"%s\": failed to acquire a lock\n", + cbdata.ndn_post); + goto done_with_lock; + } if (!map_data_foreach_map(cbdata.state, NULL, backend_shr_modrdn_entry_cb, &cbdata)) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -2205,6 +2235,7 @@ backend_shr_modrdn_cb(Slapi_PBlock *pb) backend_set_config_entry_add_cb(cbdata.e_post, &set_cbdata); } map_unlock(); +done_with_lock: wrap_dec_call_level(); return 0; } @@ -2305,7 +2336,14 @@ backend_shr_delete_cb(Slapi_PBlock *pb) /* Remove map entries which corresponded to this directory server * entry. */ wrap_inc_call_level(); - map_wrlock(); + if (map_wrlock() != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, + cbdata.state->plugin_desc->spd_id, + "error removing entries corresponding to " + "\"%s\": failed to acquire a lock\n", + cbdata.ndn); + goto done_with_lock; + } if (!map_data_foreach_map(cbdata.state, NULL, backend_shr_delete_entry_cb, &cbdata)) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -2324,6 +2362,7 @@ backend_shr_delete_cb(Slapi_PBlock *pb) * affected by this entry. */ backend_shr_update_references(cbdata.state, pb, cbdata.e, NULL, NULL); map_unlock(); +done_with_lock: wrap_dec_call_level(); return 0; } |