From 04aaf87f7629cc74d86632a20e4b751ec4ea5641 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 10 Jan 2012 19:20:51 -0500 Subject: - be more careful when logging the names of callback entries --- src/back-shr.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/back-shr.c') diff --git a/src/back-shr.c b/src/back-shr.c index e75a26b..b34797d 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -1462,6 +1462,7 @@ static int backend_shr_add_cb(Slapi_PBlock *pb) { struct backend_add_entry_cbdata cbdata; + char *dn; /* If we somehow recursed here from ourselves, just bail. */ if (wrap_get_call_level() > 0) { @@ -1475,10 +1476,10 @@ backend_shr_add_cb(Slapi_PBlock *pb) return 0; } slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e); - cbdata.ndn = slapi_entry_get_ndn(cbdata.e); + slapi_pblock_get(pb, SLAPI_ADD_TARGET, &dn); cbdata.pb = pb; slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id, - "added \"%s\"\n", cbdata.ndn); + "added \"%s\"\n", dn); /* Check for NULL entries, indicative of a failure elsewhere (?). */ if (cbdata.e == NULL) { @@ -1490,6 +1491,7 @@ backend_shr_add_cb(Slapi_PBlock *pb) return 0; } } + cbdata.ndn = slapi_entry_get_ndn(cbdata.e); /* Add map entries which corresponded to this directory server * entry. */ @@ -1604,6 +1606,7 @@ static int backend_shr_modify_cb(Slapi_PBlock *pb) { Slapi_DN *sdn; + char *dn; struct backend_shr_modify_entry_cbdata cbdata; /* If we somehow recursed here from ourselves, just bail. */ @@ -1617,14 +1620,14 @@ backend_shr_modify_cb(Slapi_PBlock *pb) /* The plugin was not actually started. */ return 0; } + slapi_pblock_get(pb, SLAPI_MODIFY_TARGET, &dn); slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &cbdata.mods); slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre); slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e_post); - cbdata.ndn = slapi_entry_get_ndn(cbdata.e_pre); cbdata.pb = pb; cbdata.modlist = NULL; slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id, - "modified \"%s\"\n", cbdata.ndn); + "modified \"%s\"\n", dn); /* Check for NULL entries, indicative of a failure elsewhere (?). */ if (cbdata.e_pre == NULL) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -1638,6 +1641,7 @@ backend_shr_modify_cb(Slapi_PBlock *pb) "post-modify entry is NULL\n"); return 0; } + cbdata.ndn = slapi_entry_get_ndn(cbdata.e_pre); cbdata.modlist = backend_shr_mods_as_string(cbdata.mods); /* Modify map entries which corresponded to this directory server * entry. */ @@ -1843,6 +1847,7 @@ static int backend_shr_delete_cb(Slapi_PBlock *pb) { struct backend_shr_delete_entry_cbdata cbdata; + char *dn; /* If we somehow recursed here from ourselves, just bail. */ if (wrap_get_call_level() > 0) { @@ -1856,10 +1861,10 @@ backend_shr_delete_cb(Slapi_PBlock *pb) return 0; } slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e); - cbdata.ndn = slapi_entry_get_ndn(cbdata.e); + slapi_pblock_get(pb, SLAPI_DELETE_TARGET, &dn); cbdata.pb = pb; slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id, - "deleted \"%s\"\n", cbdata.ndn); + "deleted \"%s\"\n", dn); /* Check for NULL entries, indicative of a failure elsewhere (?). */ if (cbdata.e == NULL) { slapi_log_error(SLAPI_LOG_PLUGIN, @@ -1867,6 +1872,7 @@ backend_shr_delete_cb(Slapi_PBlock *pb) "deleted entry is NULL\n"); return 0; } + cbdata.ndn = slapi_entry_get_ndn(cbdata.e); /* Remove map entries which corresponded to this directory server * entry. */ wrap_inc_call_level(); -- cgit