1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

dns: dlz_bind9 reference count logging

dlz_bind9 has to count the number of times the plugin is 'created' by bind's
plugin manager so it doesn't repeat setup.  Logging doesn't reflect this
reference counting logic properly and so messages like "samba_dlz: shutdown"
can, confusingly, come up when the database connection has not actually been
severed.  This patch adds the necessary logging.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13655
Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Aaron Haslett 2018-10-15 16:52:40 +13:00 committed by Andrew Bartlett
parent 2557ae53ed
commit 3713905f8b

View File

@ -618,6 +618,9 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname,
char *errstring = NULL;
if (dlz_bind9_state != NULL) {
dlz_bind9_state->log(ISC_LOG_ERROR,
"samba_dlz: dlz_create ignored, #refs=%d",
dlz_bind9_state_ref_count);
*dbdata = dlz_bind9_state;
dlz_bind9_state_ref_count++;
return ISC_R_SUCCESS;
@ -743,6 +746,10 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname,
return ISC_R_SUCCESS;
failed:
state->log(ISC_LOG_INFO,
"samba_dlz: FAILED dlz_create call result=%d #refs=%d",
result,
dlz_bind9_state_ref_count);
talloc_free(state);
return result;
}
@ -753,13 +760,17 @@ failed:
_PUBLIC_ void dlz_destroy(void *dbdata)
{
struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data);
state->log(ISC_LOG_INFO, "samba_dlz: shutting down");
dlz_bind9_state_ref_count--;
if (dlz_bind9_state_ref_count == 0) {
state->log(ISC_LOG_INFO, "samba_dlz: shutting down");
talloc_unlink(state, state->samdb);
talloc_free(state);
dlz_bind9_state = NULL;
} else {
state->log(ISC_LOG_INFO,
"samba_dlz: dlz_destroy called. %d refs remaining.",
dlz_bind9_state_ref_count);
}
}