diff options
Diffstat (limited to 'src/back-shr.c')
-rw-r--r-- | src/back-shr.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/back-shr.c b/src/back-shr.c index e24aa69..1edcb9e 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -1295,6 +1295,12 @@ backend_shr_add_cb(Slapi_PBlock *pb) { struct backend_add_entry_cbdata cbdata; + /* If we somehow recursed here from ourselves, just bail. */ + if (wrap_get_call_level() > 0) { + return 0; + } + + /* Read parameters from the pblock. */ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state); slapi_pblock_get(pb, SLAPI_ADD_TARGET, &cbdata.ndn); slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e); @@ -1315,6 +1321,7 @@ 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_data_foreach_map(cbdata.state, NULL, backend_shr_add_entry_cb, &cbdata)) { @@ -1337,6 +1344,7 @@ backend_shr_add_cb(Slapi_PBlock *pb) backend_shr_update_references(cbdata.state, cbdata.e); map_unlock(); + wrap_dec_call_level(); return 0; } @@ -1389,6 +1397,13 @@ backend_shr_modify_cb(Slapi_PBlock *pb) { Slapi_DN *sdn; struct backend_shr_modify_entry_cbdata cbdata; + + /* If we somehow recursed here from ourselves, just bail. */ + if (wrap_get_call_level() > 0) { + return 0; + } + + /* Read parameters from the pblock. */ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state); slapi_pblock_get(pb, SLAPI_MODIFY_TARGET, &cbdata.ndn); slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &cbdata.mods); @@ -1412,6 +1427,7 @@ 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_data_foreach_map(cbdata.state, NULL, backend_shr_modify_entry_cb, &cbdata)) { @@ -1454,6 +1470,7 @@ backend_shr_modify_cb(Slapi_PBlock *pb) slapi_sdn_free(&sdn); } map_unlock(); + wrap_dec_call_level(); return 0; } @@ -1508,9 +1525,17 @@ static int backend_shr_modrdn_cb(Slapi_PBlock *pb) { struct backend_shr_modrdn_entry_cbdata cbdata; + + /* If we somehow recursed here from ourselves, just bail. */ + if (wrap_get_call_level() > 0) { + return 0; + } + + /* Read parameters from the pblock. */ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state); slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre); slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e_post); + /* Check for NULL entries, indicative of a failure elsewhere (?). */ if (cbdata.e_pre == NULL) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -1533,6 +1558,7 @@ backend_shr_modrdn_cb(Slapi_PBlock *pb) cbdata.ndn_pre, cbdata.ndn_post); /* Modify map entries which corresponded to this directory server * entry. */ + wrap_inc_call_level(); map_wrlock(); if (!map_data_foreach_map(cbdata.state, NULL, backend_shr_modrdn_entry_cb, &cbdata)) { @@ -1558,6 +1584,7 @@ backend_shr_modrdn_cb(Slapi_PBlock *pb) backend_set_config_entry_add_cb(cbdata.e_post, cbdata.state); } map_unlock(); + wrap_dec_call_level(); return 0; } @@ -1597,6 +1624,13 @@ static int backend_shr_delete_cb(Slapi_PBlock *pb) { struct backend_shr_delete_entry_cbdata cbdata; + + /* If we somehow recursed here from ourselves, just bail. */ + if (wrap_get_call_level() > 0) { + return 0; + } + + /* Read parameters from the pblock. */ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state); slapi_pblock_get(pb, SLAPI_DELETE_TARGET, &cbdata.ndn); slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e); @@ -1612,6 +1646,7 @@ 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_data_foreach_map(cbdata.state, NULL, backend_shr_delete_entry_cb, &cbdata)) { @@ -1631,6 +1666,7 @@ backend_shr_delete_cb(Slapi_PBlock *pb) * affected by this entry. */ backend_shr_update_references(cbdata.state, cbdata.e); map_unlock(); + wrap_dec_call_level(); return 0; } |