The Samba-Bugzilla – Attachment 16596 Details for
Bug 13214
samba_dlz shuts down when bind 'reloads'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The patch on Github mentioned in the comments
bug-13214-from-github.patch (text/plain), 3.89 KB, created by
Douglas Bagnall
on 2021-04-23 04:19:54 UTC
(
hide
)
Description:
The patch on Github mentioned in the comments
Filename:
MIME Type:
Creator:
Douglas Bagnall
Created:
2021-04-23 04:19:54 UTC
Size:
3.89 KB
patch
obsolete
>From c6f07622e89827c3b88e031c93ca1b06fd4924b0 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= <kristjan@rvx.is> >Date: Tue, 30 Jan 2018 17:14:50 +0000 >Subject: [PATCH] bind9_dlz fix: support named reload > >https://bugzilla.samba.org/show_bug.cgi?id=13214 > >Using a singleton instance makes samba_dlz break when named does a "reload". >Remove the singleton management and allow named to initialize a new >samba_dlz_state and destroy the old on reload. > >bind does a "reload" of a dlz module by: > > 1. Creating a new dlz instance state via dlz_create() > 2. Initializing it with dlz_configure() > 3. Deleting the old instance state via dlz_destroy(). > >Using a singleton instance would cause samba_dlz to fail after a reload. >I don't know the precise reason, here are two possibles: > > - dlz_configure() on an already running instance would break it somehow. > - Returning the same pointer from dlz_create() as the one already running may > confuse the internal bookkeeping in bind. Notice how a new instance is > created before the old is destroyed. > >Note: This effectively undoes revision 34eab45. The issues with 'state->samdb' > seem to have been gone away. newstate->samdb is a talloc_reference() of > oldstate->samdb() and thus has proper refcounts. talloc_free(oldstate) > does not invalidate it. > >Signed-off-by: kristj?n Valur J?nssons <kristjan@rvx.is> >--- > source4/dns_server/dlz_bind9.c | 29 ++++++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > >diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c >index 6ef378c75a6b..7aaa7463aefb 100644 >--- a/source4/dns_server/dlz_bind9.c >+++ b/source4/dns_server/dlz_bind9.c >@@ -40,6 +40,16 @@ > #include "dlz_minimal.h" > #include "dns_server/dnsserver_common.h" > >+/* >+ * maintaining a singleton will break the 'reload' functionality >+ * triggered by 'rndc reload' and 'service reload named' which >+ * is used e.g. by logrotate. It can be enabled by defining the following >+ * preprocessor macro >+ */ >+#ifndef DLZ_BIND9_USE_SINGLETON >+#define DLS_BIND9_USE_SINGLETON 0 >+#endif >+ > struct b9_options { > const char *url; > const char *debug; >@@ -72,8 +82,10 @@ struct dlz_bind9_data { > dns_dlz_writeablezone_t *writeable_zone; > }; > >+#if DLZ_BIND9_USE_SINGLETON > static struct dlz_bind9_data *dlz_bind9_state = NULL; > static int dlz_bind9_state_ref_count = 0; >+#endif > > static const char *zone_prefixes[] = { > "CN=MicrosoftDNS,DC=DomainDnsZones", >@@ -615,11 +627,13 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname, > struct ldb_dn *dn; > NTSTATUS nt_status; > >+#if DLZ_BIND9_USE_SINGLETON > if (dlz_bind9_state != NULL) { > *dbdata = dlz_bind9_state; > dlz_bind9_state_ref_count++; > return ISC_R_SUCCESS; > } >+#endif > > state = talloc_zero(NULL, struct dlz_bind9_data); > if (state == NULL) { >@@ -635,6 +649,8 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname, > } > va_end(ap); > >+ state->log(ISC_LOG_INFO, "samba_dlz: starting for instance %p", state); >+ > /* Do not install samba signal handlers */ > fault_setup_disable(); > >@@ -715,8 +731,11 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname, > state->auth_context->generate_session_info_pac = b9_generate_session_info_pac; > > *dbdata = state; >+ >+#if DLZ_BIND9_USE_SINGLETON > dlz_bind9_state = state; > dlz_bind9_state_ref_count++; >+#endif > > return ISC_R_SUCCESS; > >@@ -731,14 +750,18 @@ _PUBLIC_ isc_result_t dlz_create(const char *dlzname, > _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"); > >+#if DLZ_BIND9_USE_SINGLETON > dlz_bind9_state_ref_count--; > if (dlz_bind9_state_ref_count == 0) { >- talloc_unlink(state, state->samdb); >- talloc_free(state); > dlz_bind9_state = NULL; >+ } else { >+ return; > } >+#endif >+ >+ state->log(ISC_LOG_INFO, "samba_dlz: shutting down instance %p", state); >+ talloc_free(state); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13214
: 16596