Don't log "with closest match (null)"
If we're sending a result, don't log that we're sending a closest match,
even if it's "(null)", if we're not sending a closest match.
Nalin Dahyabhai
10 years ago
1361 | 1361 | #endif |
1362 | 1362 | /* If we "own" the search target DN, then we need to send a response. */ |
1363 | 1363 | if (cbdata.answer) { |
1364 | if (!(cbdata.matched || (cbdata.n_entries > 0))) { | |
1364 | if (cbdata.matched || (cbdata.n_entries > 0)) { | |
1365 | /* Free the closest-match that we've recorded, so that | |
1366 | * we don't send it as part of the result. */ | |
1367 | free(cbdata.closest_match); | |
1368 | cbdata.closest_match = NULL; | |
1369 | slapi_log_error(SLAPI_LOG_PLUGIN, | |
1370 | cbdata.state->plugin_desc->spd_id, | |
1371 | "sending error %d\n", cbdata.result); | |
1372 | } else { | |
1365 | 1373 | /* Return a no-such-object error because the target DN |
1366 | 1374 | * was not found. */ |
1367 | 1375 | cbdata.result = LDAP_NO_SUCH_OBJECT; |
1368 | } | |
1369 | slapi_log_error(SLAPI_LOG_PLUGIN, | |
1370 | cbdata.state->plugin_desc->spd_id, | |
1371 | "sending error %d with closest match = " | |
1372 | "%s%s%s\n", cbdata.result, | |
1373 | cbdata.closest_match ? "\"" : "", | |
1374 | cbdata.closest_match ? | |
1375 | cbdata.closest_match : "(null)", | |
1376 | cbdata.closest_match ? "\"" : ""); | |
1377 | if (cbdata.matched || (cbdata.n_entries > 0)) { | |
1378 | /* Just in case, free the closest-match that we've | |
1379 | * recorded. */ | |
1380 | free(cbdata.closest_match); | |
1381 | cbdata.closest_match = NULL; | |
1376 | slapi_log_error(SLAPI_LOG_PLUGIN, | |
1377 | cbdata.state->plugin_desc->spd_id, | |
1378 | "sending error %d with closest match = " | |
1379 | "\"%s\"\n", cbdata.result, | |
1380 | cbdata.closest_match); | |
1382 | 1381 | } |
1383 | 1382 | slapi_pblock_set(cbdata.pb, SLAPI_PLUGIN_OPRETURN, |
1384 | 1383 | &cbdata.result); |