[SCM] Samba Shared Repository - branch v4-16-test updated

Jule Anger janger at samba.org
Sat Jun 18 09:56:01 UTC 2022


The branch, v4-16-test has been updated
       via  a9f87b9278e s3:utils: Fix missing space in testparm output
       via  edd5a851273 cmdline_s4: re-initialise logging once loadparm is ready
       via  1137957a13b s4/dlz: add support for bind 9.18
       via  959d37e72cc ctdb-daemon: Use DEBUG() macro for child logging
       via  c4e176e46cd ctdb-daemon: Drop unused prefix, logfn, logfn_private
       via  79706765035 ctdb-common: Tell file logging not to redirect stderr
       via  a393eab06a7 util: Add new debug setting debug_no_stderr_redirect
      from  ad60cbaf053 VERSION: Bump version up to Samba 4.16.3...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-16-test


- Log -----------------------------------------------------------------
commit a9f87b9278e89c626c34c000af12559f33c1fd80
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Feb 21 14:34:06 2022 +0100

    s3:utils: Fix missing space in testparm output
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15097
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Alexander Bokovoy <ab at samba.org>
    (cherry picked from commit 7009fb1a10c579262dfa62894ea674197fcee354)
    
    Autobuild-User(v4-16-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-16-test): Sat Jun 18 09:55:28 UTC 2022 on sn-devel-184

commit edd5a851273cdbece6aba3d22241e469e58bed9a
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu May 26 15:46:08 2022 +1200

    cmdline_s4: re-initialise logging once loadparm is ready
    
    The first time round we maybe didn't know which files we wanted to log to.
    Suppose, for example, we had an smb.conf with
    
     log level = 1 dsdb_group_json_audit:5@/var/log/group_json.log
    
    we wouldn't see anything in "/var/log/group_json.log", while the level
    5 dsdb_group_json_audit messages would go into the main log.
    
    Note that the named file would still be opened by winbindd and others
    that use the s3 code, but would remain empty as they don't have anything
    to say about dsdb_group_json_audit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15076
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 9537ac723cfdc43e718fdd08dc28883e7057a372)

commit 1137957a13b733babd988831ce3e7cf67ac77526
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 24 12:17:00 2022 +1300

    s4/dlz: add support for bind 9.18
    
    It seems nothing has changed since 9.16 for our purposes.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14986
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Signed-off-by: Andreas Hasenack <andreas at canonical.com>
    Pair-programmed-with: Andreas Hasenack <andreas at canonical.com>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Douglas Bagnall <dbagnall at samba.org>
    Autobuild-Date(master): Mon May 23 00:53:09 UTC 2022 on sn-devel-184
    
    (cherry picked from commit 03036442deac25f58be4119e6c9ce2586e0abf51)

commit 959d37e72cc539cf76fb99dbe8fc99ae32e59b63
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jun 6 18:02:31 2022 +1000

    ctdb-daemon: Use DEBUG() macro for child logging
    
    Directly using dbgtext() with file logging results in a log entry with
    no header, which is wrong.  This is a regression, introduced in commit
    10d15c9e5dfe4e8595d0b322c96f474fc7078f46.  Prior to this, CTDB's
    callback for file logging would always add a header.
    
    Use DEBUG() instead dbgtext().  Note that DEBUG() effectively compares
    the passed script_log_level with DEBUGLEVEL, so an explicit check is
    no longer necessary.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Jun 16 13:33:10 UTC 2022 on sn-devel-184
    
    (cherry picked from commit e752f841e682cc571006c09249b03d82aea5f8cd)

commit c4e176e46cd4a8392cc1de08ad90d62b3c114079
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jun 6 17:57:51 2022 +1000

    ctdb-daemon: Drop unused prefix, logfn, logfn_private
    
    These aren't set anywhere in the code.
    
    Drop the log argument because it is also no longer used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 88f35cf86285b7a818282d5f465711de66dfad59)

commit 79706765035fc1815795d61bcfb3e0d937b08f5d
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 7 14:00:49 2022 +1000

    ctdb-common: Tell file logging not to redirect stderr
    
    This allows ctdb_set_child_logging() to work.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 1596a3e84babb8fdd86af0c4b98906b309be7907)

commit a393eab06a74e3b8f32eee33d11bef510e137bf6
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 7 13:54:20 2022 +1000

    util: Add new debug setting debug_no_stderr_redirect
    
    CTDB doesn't want this redirection of stderr to the log file.  It
    expects to be able to capture stderr of subprocesses and log them with
    a header.  This redirection stops that from happening.
    
    Unfortunately this has to be a negative option (i.e. "no" in the name)
    so that the default of 0/false maintains existing behaviour.
    
    Note that the default behaviour is sub-optimal because it causes raw
    data (i.e. debug data without a header) to appear in the log.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit a8091bd0c565a3f14542731e642319dbb68b4786)

-----------------------------------------------------------------------

Summary of changes:
 ctdb/common/logging.c              |  1 +
 ctdb/server/ctdb_logging.c         | 23 ++++-------------------
 lib/cmdline/cmdline_s4.c           | 22 +++++++++++++++++-----
 lib/util/debug.c                   |  3 ++-
 lib/util/debug.h                   |  1 +
 python/samba/provision/sambadns.py |  6 +++++-
 source3/utils/testparm.c           |  3 +--
 source4/dns_server/dlz_minimal.h   |  3 +++
 source4/dns_server/wscript_build   | 10 ++++++++++
 source4/setup/named.conf.dlz       |  3 +++
 10 files changed, 47 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c
index 1b91cdcc92b..3aa5ca996ee 100644
--- a/ctdb/common/logging.c
+++ b/ctdb/common/logging.c
@@ -148,6 +148,7 @@ static int file_log_setup(TALLOC_CTX *mem_ctx,
 	struct debug_settings settings = {
 		.debug_syslog_format = true,
 		.debug_hires_timestamp = true,
+		.debug_no_stderr_redirect = true,
 	};
 	const char *t = NULL;
 
diff --git a/ctdb/server/ctdb_logging.c b/ctdb/server/ctdb_logging.c
index 8af787c189f..1da26b5534c 100644
--- a/ctdb/server/ctdb_logging.c
+++ b/ctdb/server/ctdb_logging.c
@@ -38,12 +38,9 @@
 #include "common/logging.h"
 
 struct ctdb_log_state {
-	const char *prefix;
 	int fd, pfd;
 	char buf[1024];
 	uint16_t buf_used;
-	void (*logfn)(const char *, uint16_t, void *);
-	void *logfn_private;
 };
 
 /* Used by ctdb_set_child_logging() */
@@ -68,21 +65,9 @@ bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging,
 	return true;
 }
 
-/* Note that do_debug always uses the global log state. */
-static void write_to_log(struct ctdb_log_state *log,
-			 const char *buf, unsigned int len)
+static void write_to_log(const char *buf, unsigned int len)
 {
-	if (script_log_level <= DEBUGLEVEL) {
-		if (log != NULL && log->prefix != NULL) {
-			dbgtext("%s: %*.*s\n", log->prefix, len, len, buf);
-		} else {
-			dbgtext("%*.*s\n", len, len, buf);
-		}
-		/* log it in the eventsystem as well */
-		if (log && log->logfn) {
-			log->logfn(log->buf, len, log->logfn_private);
-		}
-	}
+	DEBUG(script_log_level, ("%*.*s\n", len, len, buf));
 }
 
 /*
@@ -119,7 +104,7 @@ static void ctdb_child_log_handler(struct tevent_context *ev,
 		if (n2 > 0 && log->buf[n2-1] == '\r') {
 			n2--;
 		}
-		write_to_log(log, log->buf, n2);
+		write_to_log(log->buf, n2);
 		memmove(log->buf, p+1, sizeof(log->buf) - n1);
 		log->buf_used -= n1;
 	}
@@ -127,7 +112,7 @@ static void ctdb_child_log_handler(struct tevent_context *ev,
 	/* the buffer could have completely filled - unfortunately we have
 	   no choice but to dump it out straight away */
 	if (log->buf_used == sizeof(log->buf)) {
-		write_to_log(log, log->buf, log->buf_used);
+		write_to_log(log->buf, log->buf_used);
 		log->buf_used = 0;
 	}
 }
diff --git a/lib/cmdline/cmdline_s4.c b/lib/cmdline/cmdline_s4.c
index 29e9f34bbe2..f8be4ed670c 100644
--- a/lib/cmdline/cmdline_s4.c
+++ b/lib/cmdline/cmdline_s4.c
@@ -31,6 +31,8 @@ static bool _samba_cmdline_load_config_s4(void)
 {
 	struct loadparm_context *lp_ctx = samba_cmdline_get_lp_ctx();
 	const char *config_file = NULL;
+	const struct samba_cmdline_daemon_cfg *cmdline_daemon_cfg = \
+		samba_cmdline_get_daemon_cfg();
 	bool ok;
 
 	/* Load smb conf */
@@ -45,15 +47,11 @@ static bool _samba_cmdline_load_config_s4(void)
 	}
 
 	switch (_config_type) {
-	case SAMBA_CMDLINE_CONFIG_SERVER: {
-		const struct samba_cmdline_daemon_cfg *cmdline_daemon_cfg =
-			samba_cmdline_get_daemon_cfg();
-
+	case SAMBA_CMDLINE_CONFIG_SERVER:
 		if (!cmdline_daemon_cfg->interactive) {
 			setup_logging(getprogname(), DEBUG_FILE);
 		}
 		break;
-	}
 	default:
 		break;
 	}
@@ -70,6 +68,20 @@ static bool _samba_cmdline_load_config_s4(void)
 		}
 	}
 
+	switch (_config_type) {
+	case SAMBA_CMDLINE_CONFIG_SERVER:
+		/*
+		 * We need to setup_logging *again* to ensure multi-file
+		 * logging is set up as specified in smb.conf.
+		 */
+		if (!cmdline_daemon_cfg->interactive) {
+			setup_logging(getprogname(), DEBUG_FILE);
+		}
+		break;
+	default:
+		break;
+	}
+
 	return true;
 }
 
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 784357e9370..3cd577dc0eb 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -1315,7 +1315,8 @@ bool reopen_logs_internal(void)
 	 * If log file was opened or created successfully, take over stderr to
 	 * catch output into logs.
 	 */
-	if (dbgc_config[DBGC_ALL].fd > 0) {
+	if (!state.settings.debug_no_stderr_redirect &&
+	    dbgc_config[DBGC_ALL].fd > 0) {
 		if (dup2(dbgc_config[DBGC_ALL].fd, 2) == -1) {
 			/* Close stderr too, if dup2 can't point it -
 			   at the logfile.  There really isn't much
diff --git a/lib/util/debug.h b/lib/util/debug.h
index 7317c2f43c5..34b63a24478 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -304,6 +304,7 @@ struct debug_settings {
 	bool debug_pid;
 	bool debug_uid;
 	bool debug_class;
+	bool debug_no_stderr_redirect;
 };
 
 void setup_logging(const char *prog_name, enum debug_logtype new_logtype);
diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py
index 6823f9ee56b..404b346a885 100644
--- a/python/samba/provision/sambadns.py
+++ b/python/samba/provision/sambadns.py
@@ -1017,6 +1017,7 @@ def create_named_conf(paths, realm, dnsdomain, dns_backend, logger):
         bind9_12 = '#'
         bind9_14 = '#'
         bind9_16 = '#'
+        bind9_18 = '#'
         if bind_info.upper().find('BIND 9.8') != -1:
             bind9_8 = ''
         elif bind_info.upper().find('BIND 9.9') != -1:
@@ -1031,6 +1032,8 @@ def create_named_conf(paths, realm, dnsdomain, dns_backend, logger):
             bind9_14 = ''
         elif bind_info.upper().find('BIND 9.16') != -1:
             bind9_16 = ''
+        elif bind_info.upper().find('BIND 9.18') != -1:
+            bind9_18 = ''
         elif bind_info.upper().find('BIND 9.7') != -1:
             raise ProvisioningError("DLZ option incompatible with BIND 9.7.")
         elif bind_info.upper().find('BIND_9.13') != -1:
@@ -1050,7 +1053,8 @@ def create_named_conf(paths, realm, dnsdomain, dns_backend, logger):
                     "BIND9_11": bind9_11,
                     "BIND9_12": bind9_12,
                     "BIND9_14": bind9_14,
-                    "BIND9_16": bind9_16
+                    "BIND9_16": bind9_16,
+                    "BIND9_18": bind9_18
                     })
 
 
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 58ba46bc15f..71bc4c2694e 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -195,7 +195,7 @@ static bool do_idmap_check(void)
 			if (maxranges < 2) {
 				fprintf(stderr,
 					"ERROR: The idmap autorid range "
-					"[%u-%u] needs to be at least twice as"
+					"[%u-%u] needs to be at least twice as "
 					"big as the rangesize [%u]!"
 					"\n\n",
 					c->low,
@@ -954,4 +954,3 @@ done:
 	TALLOC_FREE(frame);
 	return ret;
 }
-
diff --git a/source4/dns_server/dlz_minimal.h b/source4/dns_server/dlz_minimal.h
index e2a14266810..b7e36e7f8e6 100644
--- a/source4/dns_server/dlz_minimal.h
+++ b/source4/dns_server/dlz_minimal.h
@@ -48,6 +48,9 @@
 #elif defined (BIND_VERSION_9_16)
 # define DLZ_DLOPEN_VERSION 3
 # define DNS_CLIENTINFO_VERSION 2
+#elif defined (BIND_VERSION_9_18)
+# define DLZ_DLOPEN_VERSION 3
+# define DNS_CLIENTINFO_VERSION 2
 #else
 # error Unsupported BIND version
 #endif
diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build
index 8f606f92692..ab0a241b937 100644
--- a/source4/dns_server/wscript_build
+++ b/source4/dns_server/wscript_build
@@ -70,6 +70,16 @@ bld.SAMBA_LIBRARY('dlz_bind9_16',
                   deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
                   enabled=bld.AD_DC_BUILD_IS_ENABLED())
 
+bld.SAMBA_LIBRARY('dlz_bind9_18',
+                  source='dlz_bind9.c',
+                  cflags='-DBIND_VERSION_9_18',
+                  private_library=True,
+                  link_name='modules/bind9/dlz_bind9_18.so',
+                  realname='dlz_bind9_18.so',
+                  install_path='${MODULESDIR}/bind9',
+                  deps='samba-hostconfig samdb-common gensec popt dnsserver_common',
+                  enabled=bld.AD_DC_BUILD_IS_ENABLED())
+
 bld.SAMBA_LIBRARY('dlz_bind9_for_torture',
                   source='dlz_bind9.c',
                   cflags='-DBIND_VERSION_9_16',
diff --git a/source4/setup/named.conf.dlz b/source4/setup/named.conf.dlz
index c2c41e2cddf..cbe7d805f58 100644
--- a/source4/setup/named.conf.dlz
+++ b/source4/setup/named.conf.dlz
@@ -30,5 +30,8 @@ dlz "AD DNS Zone" {
 
     # For BIND 9.16.x
     ${BIND9_16} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_16.so";
+    #
+    # For BIND 9.18.x
+    ${BIND9_18} database "dlopen ${MODULESDIR}/bind9/dlz_bind9_18.so";
 };
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list