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

Jule Anger janger at samba.org
Tue Dec 19 10:44:01 UTC 2023


The branch, v4-19-test has been updated
       via  efc1a606a27 VERSION: move COPYRIGHT_STARTUP_MESSAGE as SAMBA_COPYRIGHT_STRING into version.h
       via  2298b92f183 lib/util: convert DBG_STARTUP_NOTICE() to use debug_set_forced_log_priority(DBGLVL_NOTICE)
       via  98d79426022 lib/util: add debug_set_forced_log_priority()
       via  928dfe6e94d source3/nmbd/nmbd.c: use DBG_STARTUP_NOTICE
       via  ed2806fd166 lib/util/become_daemon.c: use DBG_STARTUP_NOTICE
       via  51ce833dd52 logging: use DBG_STARTUP_NOTICE for startup message
       via  fb08893cde4 debug.h: introduce DEBUG_STARTUP_NOTICE
       via  13748870c37 lib/util: move copyright define to copyright.h
       via  c05330a909f s4/server.c: move some log messages from ERR to NOTICE
       via  8b913da8b99 profile: issues info message with lower log level
       via  3d3cc1bd68f s3:rpc_server: call reopen_logs before we print the copyright notice
      from  853efb9dd7b ctdb-server: Drop unnecessary copy of destination address

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


- Log -----------------------------------------------------------------
commit efc1a606a2710d0e28a632436088c13d05b116da
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Dec 14 11:35:19 2023 +0100

    VERSION: move COPYRIGHT_STARTUP_MESSAGE as SAMBA_COPYRIGHT_STRING into version.h
    
    We also prodive a samba_copyright_string() helper similar to
    samba_version_string().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Fri Dec 15 10:44:42 UTC 2023 on atb-devel-224
    
    (cherry picked from commit d23d6145bf08c4765479951237e697c4b2b11aa2)
    
    Autobuild-User(v4-19-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-19-test): Tue Dec 19 10:43:21 UTC 2023 on atb-devel-224

commit 2298b92f1832a893b2e9a8eb193c219e2221174b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Nov 22 17:18:29 2023 +0100

    lib/util: convert DBG_STARTUP_NOTICE() to use debug_set_forced_log_priority(DBGLVL_NOTICE)
    
    Using -1 as log level is not compatible without our infrastructure.
    
    As all backends are initialized with .log_level = -1, which means
    they don't log the message, but now they all try to handle the
    startup message even if they are not configured.
    
    E.g. is means that systemd's journalctl get the message twice
    now, first via the syslog and also the systemd backend.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit cd8dcff9e9cbfffab8c502c8701c00b0c8e3512b)

commit 98d794260222c287c187d38bc57f9f836e4923ab
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Nov 22 17:03:30 2023 +0100

    lib/util: add debug_set_forced_log_priority()
    
    By default the priority for syslog/systemd is derived from
    the log level of the debug message.
    
    But for things like startup messages we want to
    change the priority temporary, like this:
    
    debug_set_forced_log_priority(DBGLVL_NOTICE);
    D_ERR("Startup...\n");
    debug_set_forced_log_priority(-1);
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit bd21a0cdefb30ef5522f81d865c03d11a182a63c)

commit 928dfe6e94d71018fc53136d03028143af65dab2
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 14:35:55 2023 +0200

    source3/nmbd/nmbd.c: use DBG_STARTUP_NOTICE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 72f20311acc4ab8851f18ac2b87f7ecc7803afad)

commit ed2806fd166e259aa31f354858d20eee69dc3ea7
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 14:34:29 2023 +0200

    lib/util/become_daemon.c: use DBG_STARTUP_NOTICE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 50337acaa566b6696e035e38f6408f65805182a0)

commit 51ce833dd52f2dfc3876f2dbde56c189bc2032da
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Jun 5 18:10:07 2023 +0200

    logging: use DBG_STARTUP_NOTICE for startup message
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 159cfde446c95c387ef212be103b109ea0dca93d)

commit fb08893cde411072fba125accff328138530f900
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 13:48:06 2023 +0200

    debug.h: introduce DEBUG_STARTUP_NOTICE
    
    this is log level -1 and lowest syslog priority. This is used for start up
    messages and copyright notices, which should always be printed but which are no
    errors or warnings.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit ccfe345fece0a5a44d766fb9426d43c2e046d040)

commit 13748870c37929e60835a5affdf5ac405cb436d2
Author: Björn Jacke <bj at sernet.de>
Date:   Tue Jun 6 17:25:35 2023 +0200

    lib/util: move copyright define to copyright.h
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit b7631bf603fbce9b80b19410f0680ce8c4170a1b)

commit c05330a909f18d9d5316e7beda6ec5beb4e0e2e3
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 13:45:54 2023 +0200

    s4/server.c: move some log messages from ERR to NOTICE
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit baa67024bca391f2e212b91131f544cc911c6895)

commit 8b913da8b990914071eb61097905c8a3b784dac5
Author: Björn Jacke <bj at sernet.de>
Date:   Mon Sep 18 23:42:31 2023 +0200

    profile: issues info message with lower log level
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377
    
    Signed-off-by: Bjoern Jacke <bjacke at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 55d895dc42248ad524a10812b9975ac05a722fdc)

commit 3d3cc1bd68f5c3495e167a8f939cf0b986038ccb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Aug 16 16:47:24 2023 +0200

    s3:rpc_server: call reopen_logs before we print the copyright notice
    
    This matches what we do in smbd, winbindd and nmbd.
    
    For the workers it's important to call it at all, otherwise
    things like 'debug pid = yes' or 'debug class = yes' have no effect
    in the workers.
    
    We could argue if we want the copyright notice on the start
    of each worker at all, but that's a different discussion...
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 94723b6732a67482eb7792e82b01e26a807e8265)

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

Summary of changes:
 VERSION                               |  2 ++
 buildtools/wafsamba/samba_patterns.py |  2 +-
 buildtools/wafsamba/samba_version.py  |  1 +
 lib/param/param.h                     |  1 +
 lib/util/become_daemon.c              |  2 +-
 lib/util/debug.c                      | 10 ++++++++++
 lib/util/debug.h                      |  7 +++++++
 source3/include/proto.h               |  1 +
 source3/include/smb.h                 |  3 ---
 source3/lib/version.c                 |  5 +++++
 source3/nmbd/nmbd.c                   |  4 +++-
 source3/profile/profile_dummy.c       |  2 +-
 source3/rpc_server/rpc_host.c         | 10 +++++-----
 source3/rpc_server/rpc_worker.c       | 10 ++++++----
 source3/smbd/server.c                 |  5 +++--
 source3/winbindd/winbindd.c           |  5 +++--
 source3/wscript_build                 |  3 +--
 source4/samba/server.c                | 13 ++++++-------
 18 files changed, 57 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 398208fb3fa..91bf1b9e447 100644
--- a/VERSION
+++ b/VERSION
@@ -13,6 +13,8 @@
 #                                                      #
 ########################################################
 
+SAMBA_COPYRIGHT_STRING="Copyright Andrew Tridgell and the Samba Team 1992-2023"
+
 ########################################################
 # This are the main SAMBA version numbers              #
 #                                                      #
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index a9c5fcc4b4c..41296810e13 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -15,7 +15,7 @@ def write_version_header(task):
     return 0
 
 
-def SAMBA_MKVERSION(bld, target, source='VERSION'):
+def SAMBA_MKVERSION(bld, target, source='VERSION buildtools/wafsamba/samba_version.py'):
     '''generate the version.h header for Samba'''
 
     # We only force waf to re-generate this file if we are installing,
diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
index 54ae62f38bd..31103e0f8c4 100644
--- a/buildtools/wafsamba/samba_version.py
+++ b/buildtools/wafsamba/samba_version.py
@@ -174,6 +174,7 @@ also accepted as dictionary entries here
 
     def __str__(self):
         string="/* Autogenerated by waf */\n" +\
+                "#define SAMBA_COPYRIGHT_STRING \"%s\"\n" % self.SAMBA_COPYRIGHT_STRING +\
                 "#define SAMBA_VERSION_MAJOR %u\n" % self.MAJOR +\
                 "#define SAMBA_VERSION_MINOR %u\n" % self.MINOR +\
                 "#define SAMBA_VERSION_RELEASE %u\n" % self.RELEASE
diff --git a/lib/param/param.h b/lib/param/param.h
index 7ead57f6130..aed48c1660c 100644
--- a/lib/param/param.h
+++ b/lib/param/param.h
@@ -276,6 +276,7 @@ int lpcfg_rpc_port_high(struct loadparm_context *lp_ctx);
 /* The following definitions come from lib/version.c  */
 
 const char *samba_version_string(void);
+const char *samba_copyright_string(void);
 
 
 #endif /* _PARAM_H */
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 9424656d403..c6795c585c8 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -147,5 +147,5 @@ void daemon_status(const char *daemon, const char *msg)
 		sd_notifyf(0, "STATUS=%s: %s", daemon, msg);
 	}
 #endif
-	DBG_ERR("daemon '%s' : %s\n", daemon, msg);
+	DBG_STARTUP_NOTICE("daemon '%s' : %s\n", daemon, msg);
 }
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 0e13fa564e3..a3266148b12 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -94,6 +94,7 @@ static struct {
 	char hostname[HOST_NAME_MAX+1];
 	bool reopening_logs;
 	bool schedule_reopen_logs;
+	int forced_log_priority;
 
 	struct debug_settings settings;
 	debug_callback_fn callback;
@@ -230,6 +231,10 @@ static int debug_level_to_priority(int level)
 	};
 	int priority;
 
+	if (state.forced_log_priority != -1) {
+		level = state.forced_log_priority;
+	}
+
 	if (level < 0 || (size_t)level >= ARRAY_SIZE(priority_map))
 		priority = LOG_DEBUG;
 	else
@@ -1133,6 +1138,11 @@ void debug_set_hostname(const char *name)
 	strlcpy(state.hostname, name, sizeof(state.hostname));
 }
 
+void debug_set_forced_log_priority(int forced_log_priority)
+{
+	state.forced_log_priority = forced_log_priority;
+}
+
 /**
  * Ensure debug logs are initialised.
  *
diff --git a/lib/util/debug.h b/lib/util/debug.h
index 335a644718f..d4bd8246b97 100644
--- a/lib/util/debug.h
+++ b/lib/util/debug.h
@@ -275,6 +275,12 @@ void debuglevel_set_class(size_t idx, int level);
 #define DBGLVL_INFO	 5	/* informational message */
 #define DBGLVL_DEBUG	10	/* debug-level message */
 
+#define DBG_STARTUP_NOTICE(...) do { \
+	debug_set_forced_log_priority(DBGLVL_NOTICE); \
+	D_ERR(__VA_ARGS__); \
+	debug_set_forced_log_priority(-1); \
+} while(0)
+
 #define DBG_ERR(...)		DBG_PREFIX(DBGLVL_ERR,		(__VA_ARGS__))
 #define DBG_WARNING(...)	DBG_PREFIX(DBGLVL_WARNING,	(__VA_ARGS__))
 #define DBG_NOTICE(...)		DBG_PREFIX(DBGLVL_NOTICE,	(__VA_ARGS__))
@@ -354,6 +360,7 @@ void debug_set_settings(struct debug_settings *settings,
 			const char *logging_param,
 			int syslog_level, bool syslog_only);
 void debug_set_hostname(const char *name);
+void debug_set_forced_log_priority(int forced_log_priority);
 bool reopen_logs_internal( void );
 void force_check_log_size( void );
 bool need_to_check_log_size( void );
diff --git a/source3/include/proto.h b/source3/include/proto.h
index bf6797514e3..8eed81d8f2e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -564,6 +564,7 @@ ssize_t full_path_tos(const char *dir, const char *name,
 /* The following definitions come from lib/version.c  */
 
 const char *samba_version_string(void);
+const char *samba_copyright_string(void);
 
 /* The following definitions come from lib/wins_srv.c  */
 
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 487a8b316d8..81d761d2280 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -29,9 +29,6 @@
 #include "libcli/smb/smb_common.h"
 #include "libds/common/roles.h"
 
-/* logged when starting the various Samba daemons */
-#define COPYRIGHT_STARTUP_MESSAGE	"Copyright Andrew Tridgell and the Samba Team 1992-2023"
-
 #define LARGE_WRITEX_HDR_SIZE 65
 #define LARGE_WRITEX_BUFFER_SIZE (128*1024)
 
diff --git a/source3/lib/version.c b/source3/lib/version.c
index e81f463586e..28fcd1b704b 100644
--- a/source3/lib/version.c
+++ b/source3/lib/version.c
@@ -25,3 +25,8 @@ const char *samba_version_string(void)
 {
 	return SAMBA_VERSION_STRING;
 }
+
+const char *samba_copyright_string(void)
+{
+	return SAMBA_COPYRIGHT_STRING;
+}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 7cdd9bd1303..49ad382f8c5 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -898,7 +898,9 @@ static bool open_sockets(bool isdaemon, int port)
 
 	reopen_logs();
 
-	DBG_ERR("nmbd version %s started.\n%s\n", samba_version_string(), COPYRIGHT_STARTUP_MESSAGE);
+	DBG_STARTUP_NOTICE("nmbd version %s started.\n%s\n",
+			   samba_version_string(),
+			   samba_copyright_string());
 
 	if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC
 	    && !lp_parm_bool(-1, "server role check", "inhibit", false)) {
diff --git a/source3/profile/profile_dummy.c b/source3/profile/profile_dummy.c
index 7d34d209fce..5d3213eec1a 100644
--- a/source3/profile/profile_dummy.c
+++ b/source3/profile/profile_dummy.c
@@ -27,5 +27,5 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
 
 void set_profile_level(int level, const struct server_id *src)
 {
-	DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
+	DBG_NOTICE("INFO: Profiling support unavailable in this build.\n");
 }
diff --git a/source3/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c
index 1cb874569e2..394c58436ab 100644
--- a/source3/rpc_server/rpc_host.c
+++ b/source3/rpc_server/rpc_host.c
@@ -2838,13 +2838,13 @@ int main(int argc, const char *argv[])
 
 	dump_core_setup(progname, lp_logfile(frame, lp_sub));
 
-	DEBUG(0, ("%s version %s started.\n",
-		  progname,
-		  samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
-
 	reopen_logs();
 
+	DBG_STARTUP_NOTICE("%s version %s started.\n%s\n",
+			   progname,
+			   samba_version_string(),
+			   samba_copyright_string());
+
 	(void)winbind_off();
 	ok = init_guest_session_info(frame);
 	(void)winbind_on();
diff --git a/source3/rpc_server/rpc_worker.c b/source3/rpc_server/rpc_worker.c
index 4f47a0ad4f3..56cba5a88f7 100644
--- a/source3/rpc_server/rpc_worker.c
+++ b/source3/rpc_server/rpc_worker.c
@@ -1122,10 +1122,12 @@ int rpc_worker_main(
 	/* Ignore children - no zombies. */
 	CatchChild();
 
-	DEBUG(0, ("%s version %s started.\n",
-		  progname,
-		  samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+	reopen_logs();
+
+	DBG_STARTUP_NOTICE("%s version %s started.\n%s\n",
+			   progname,
+			   samba_version_string(),
+			   samba_copyright_string());
 
 	msg_ctx = global_messaging_context();
 	if (msg_ctx == NULL) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 18c79f9df35..42abfa948e6 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1743,8 +1743,9 @@ extern void build_options(bool screen);
 
 	reopen_logs();
 
-	DEBUG(0,("smbd version %s started.\n", samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+	DBG_STARTUP_NOTICE("smbd version %s started.\n%s\n",
+			   samba_version_string(),
+			   samba_copyright_string());
 
 	DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
 		 (int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid()));
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 765e5a2561b..04ba6778c1c 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1438,8 +1438,9 @@ int main(int argc, const char **argv)
 
 	reopen_logs();
 
-	DEBUG(0,("winbindd version %s started.\n", samba_version_string()));
-	DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
+	DBG_STARTUP_NOTICE("winbindd version %s started.\n%s\n",
+			   samba_version_string(),
+			   samba_copyright_string());
 
 	/* After parsing the configuration file we setup the core path one more time
 	 * as the log file might have been set in the configuration and cores's
diff --git a/source3/wscript_build b/source3/wscript_build
index 5410da1b50f..092fa4bf796 100644
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -939,8 +939,7 @@ bld.SAMBA3_SUBSYSTEM('PASSCHANGE',
                          ''')
 
 bld.SAMBA3_SUBSYSTEM('SAMBA_VERSION',
-                    source='lib/version.c',
-                    deps='samba-util')
+                    source='lib/version.c')
 
 bld.SAMBA3_SUBSYSTEM('SLCACHE',
                     source='libsmb/samlogon_cache.c',
diff --git a/source4/samba/server.c b/source4/samba/server.c
index eb4ddeb7ce7..84314447533 100644
--- a/source4/samba/server.c
+++ b/source4/samba/server.c
@@ -630,11 +630,10 @@ static int binary_smbd_main(TALLOC_CTX *mem_ctx,
 	   so set our umask to 0 */
 	umask(0);
 
-	DEBUG(0,("%s version %s started.\n",
-		binary_name,
-		SAMBA_VERSION_STRING));
-	DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team"
-		" 1992-2023\n"));
+	DBG_STARTUP_NOTICE("%s version %s started.\n%s\n",
+			   binary_name,
+			   SAMBA_VERSION_STRING,
+			   SAMBA_COPYRIGHT_STRING);
 
 	if (sizeof(uint16_t) < 2 ||
 			sizeof(uint32_t) < 4 ||
@@ -801,7 +800,7 @@ static int binary_smbd_main(TALLOC_CTX *mem_ctx,
 
 	if (max_runtime) {
 		struct tevent_timer *te;
-		DBG_ERR("%s PID %d was called with maxruntime %d - "
+		DBG_NOTICE("%s PID %d was called with maxruntime %d - "
 			"current ts %llu\n",
 			binary_name, (int)getpid(),
 			max_runtime, (unsigned long long) time(NULL));
@@ -905,7 +904,7 @@ static int binary_smbd_main(TALLOC_CTX *mem_ctx,
 		return 1;
 	}
 
-	DBG_ERR("%s: using '%s' process model\n", binary_name, model);
+	DBG_NOTICE("%s: using '%s' process model\n", binary_name, model);
 
 	{
 		int child_pipe[2];


-- 
Samba Shared Repository



More information about the samba-cvs mailing list