The Samba-Bugzilla – Attachment 18202 Details for
Bug 15377
systemd stumbled over copyright-message at smbd startup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
backport patch for 4.19 v2
p.patch (text/plain), 29.43 KB, created by
Björn Jacke
on 2023-12-17 17:22:14 UTC
(
hide
)
Description:
backport patch for 4.19 v2
Filename:
MIME Type:
Creator:
Björn Jacke
Created:
2023-12-17 17:22:14 UTC
Size:
29.43 KB
patch
obsolete
>From 798035fe71309037d2fca61677702fb00b085a5a Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 16 Aug 2023 16:47:24 +0200 >Subject: [PATCH 01/11] 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@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 94723b6732a67482eb7792e82b01e26a807e8265) >--- > source3/rpc_server/rpc_host.c | 4 ++-- > source3/rpc_server/rpc_worker.c | 2 ++ > 2 files changed, 4 insertions(+), 2 deletions(-) > >diff --git a/source3/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c >index 1cb874569e2..b59916b5dda 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)); > >+ reopen_logs(); >+ > DEBUG(0, ("%s version %s started.\n", > progname, > samba_version_string())); > DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); > >- reopen_logs(); >- > (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..2ef90547dd6 100644 >--- a/source3/rpc_server/rpc_worker.c >+++ b/source3/rpc_server/rpc_worker.c >@@ -1122,6 +1122,8 @@ int rpc_worker_main( > /* Ignore children - no zombies. */ > CatchChild(); > >+ reopen_logs(); >+ > DEBUG(0, ("%s version %s started.\n", > progname, > samba_version_string())); >-- >2.38.0 > > >From 57a0b8d2986879b68348ce3465a130ec58c0666b Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Mon, 18 Sep 2023 23:42:31 +0200 >Subject: [PATCH 02/11] profile: issues info message with lower log level > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 > >Signed-off-by: Bjoern Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 55d895dc42248ad524a10812b9975ac05a722fdc) >--- > source3/profile/profile_dummy.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >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"); > } >-- >2.38.0 > > >From a50d3fbee16d3731ac3c4a13eebc57fdb0f7b536 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Mon, 18 Sep 2023 13:45:54 +0200 >Subject: [PATCH 03/11] 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@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit baa67024bca391f2e212b91131f544cc911c6895) >--- > source4/samba/server.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/source4/samba/server.c b/source4/samba/server.c >index eb4ddeb7ce7..a66e1cf0363 100644 >--- a/source4/samba/server.c >+++ b/source4/samba/server.c >@@ -801,7 +801,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 +905,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]; >-- >2.38.0 > > >From f4d27ba30f6858e13b8ad55b69bdd3942f74b5ec Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Tue, 6 Jun 2023 17:25:35 +0200 >Subject: [PATCH 04/11] lib/util: move copyright define to copyright.h > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 > >Signed-off-by: Bjoern Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit b7631bf603fbce9b80b19410f0680ce8c4170a1b) >--- > lib/util/copyright.h | 28 ++++++++++++++++++++++++++++ > source3/include/includes.h | 3 +++ > source3/include/smb.h | 3 --- > source4/include/includes.h | 3 +++ > 4 files changed, 34 insertions(+), 3 deletions(-) > create mode 100644 lib/util/copyright.h > >diff --git a/lib/util/copyright.h b/lib/util/copyright.h >new file mode 100644 >index 00000000000..a29f2285d13 >--- /dev/null >+++ b/lib/util/copyright.h >@@ -0,0 +1,28 @@ >+/* >+ Unix SMB/CIFS implementation. >+ >+ Copyright (C) Björn Jacke 2023 >+ >+ This program is free software; you can redistribute it and/or modify >+ it under the terms of the GNU General Public License as published by >+ the Free Software Foundation; either version 3 of the License, or >+ (at your option) any later version. >+ >+ This program is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ GNU General Public License for more details. >+ >+ You should have received a copy of the GNU General Public License >+ along with this program. If not, see <http://www.gnu.org/licenses/>. >+*/ >+ >+#ifndef __LIB_UTIL_COPYRIGHT_H__ >+#define __LIB_UTIL_COPYRIGHT_H__ >+ >+/* logged when starting the various Samba daemons */ >+#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2023" >+ >+#endif /* __LIB_UTIL_COPYRIGHT_H__ */ >+ >+ >diff --git a/source3/include/includes.h b/source3/include/includes.h >index 02beb0a0c88..8bb6ee88803 100644 >--- a/source3/include/includes.h >+++ b/source3/include/includes.h >@@ -242,6 +242,9 @@ enum timestamp_set_resolution { > typedef char fstring[FSTRING_LEN]; > #endif > >+/* copyright define */ >+#include "../lib/util/copyright.h" >+ > /* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */ > #include "../lib/util/debug.h" > >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/source4/include/includes.h b/source4/include/includes.h >index e7abf1a2492..8832b97ed02 100644 >--- a/source4/include/includes.h >+++ b/source4/include/includes.h >@@ -57,6 +57,9 @@ > #endif > #include "../lib/util/attr.h" > >+/* copyright define */ >+#include "../lib/util/copyright.h" >+ > /* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */ > #include "../lib/util/debug.h" > #include "../lib/util/samba_util.h" >-- >2.38.0 > > >From 0a515d1ef1777e53e5b314c7a150c2f60d6bb925 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Mon, 18 Sep 2023 13:48:06 +0200 >Subject: [PATCH 05/11] 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@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit ccfe345fece0a5a44d766fb9426d43c2e046d040) >--- > lib/util/debug.h | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/lib/util/debug.h b/lib/util/debug.h >index 335a644718f..5433a585ec8 100644 >--- a/lib/util/debug.h >+++ b/lib/util/debug.h >@@ -269,12 +269,14 @@ void debuglevel_set_class(size_t idx, int level); > /* > * Debug levels matching RFC 3164 > */ >+#define DBGLVL_STARTUP_NOTICE -1 /* startup notice */ > #define DBGLVL_ERR 0 /* error conditions */ > #define DBGLVL_WARNING 1 /* warning conditions */ > #define DBGLVL_NOTICE 3 /* normal, but significant, condition */ > #define DBGLVL_INFO 5 /* informational message */ > #define DBGLVL_DEBUG 10 /* debug-level message */ > >+#define DBG_STARTUP_NOTICE(...) DBG_PREFIX(DBGLVL_STARTUP_NOTICE, (__VA_ARGS__)) > #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__)) >-- >2.38.0 > > >From 5f9662d4311d6f6c2e1ab200def4398d164ae85f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Mon, 5 Jun 2023 18:10:07 +0200 >Subject: [PATCH 06/11] logging: use DBG_STARTUP_NOTICE for startup message > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 > >Signed-off-by: Bjoern Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 159cfde446c95c387ef212be103b109ea0dca93d) >--- > source3/rpc_server/rpc_host.c | 6 +++--- > source3/rpc_server/rpc_worker.c | 8 ++++---- > source3/smbd/server.c | 5 +++-- > source3/winbindd/winbindd.c | 5 +++-- > source4/samba/server.c | 7 +++---- > 5 files changed, 16 insertions(+), 15 deletions(-) > >diff --git a/source3/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c >index b59916b5dda..9e64fa62d0c 100644 >--- a/source3/rpc_server/rpc_host.c >+++ b/source3/rpc_server/rpc_host.c >@@ -2840,10 +2840,10 @@ int main(int argc, const char *argv[]) > > reopen_logs(); > >- DEBUG(0, ("%s version %s started.\n", >+ DBG_STARTUP_NOTICE("%s version %s started.\n" >+ COPYRIGHT_STARTUP_MESSAGE "\n", > progname, >- samba_version_string())); >- DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); >+ samba_version_string()); > > (void)winbind_off(); > ok = init_guest_session_info(frame); >diff --git a/source3/rpc_server/rpc_worker.c b/source3/rpc_server/rpc_worker.c >index 2ef90547dd6..cde0e7bcd59 100644 >--- a/source3/rpc_server/rpc_worker.c >+++ b/source3/rpc_server/rpc_worker.c >@@ -1124,10 +1124,10 @@ int rpc_worker_main( > > reopen_logs(); > >- DEBUG(0, ("%s version %s started.\n", >- progname, >- samba_version_string())); >- DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); >+ DBG_STARTUP_NOTICE("%s version %s started.\n" >+ COPYRIGHT_STARTUP_MESSAGE "\n", >+ progname, >+ samba_version_string()); > > msg_ctx = global_messaging_context(); > if (msg_ctx == NULL) { >diff --git a/source3/smbd/server.c b/source3/smbd/server.c >index 18c79f9df35..ddef5b6de16 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" >+ COPYRIGHT_STARTUP_MESSAGE "\n", >+ samba_version_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..cdd6d4319cb 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" >+ COPYRIGHT_STARTUP_MESSAGE "\n", >+ samba_version_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/source4/samba/server.c b/source4/samba/server.c >index a66e1cf0363..e1ad646fae2 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", >+ DBG_STARTUP_NOTICE("%s version %s started.\n" >+ COPYRIGHT_STARTUP_MESSAGE "\n", > binary_name, >- SAMBA_VERSION_STRING)); >- DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team" >- " 1992-2023\n")); >+ SAMBA_VERSION_STRING); > > if (sizeof(uint16_t) < 2 || > sizeof(uint32_t) < 4 || >-- >2.38.0 > > >From dfaa1b45524294ea755957d04086bf6a643028c9 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Mon, 18 Sep 2023 14:34:29 +0200 >Subject: [PATCH 07/11] 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@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 50337acaa566b6696e035e38f6408f65805182a0) >--- > lib/util/become_daemon.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >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); > } >-- >2.38.0 > > >From a516b9a9b3784924a38c7cc378784cd019bdec8f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> >Date: Mon, 18 Sep 2023 14:35:55 +0200 >Subject: [PATCH 08/11] source3/nmbd/nmbd.c: use DBG_STARTUP_NOTICE > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 > >Signed-off-by: Bjoern Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit 72f20311acc4ab8851f18ac2b87f7ecc7803afad) >--- > source3/nmbd/nmbd.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c >index 7cdd9bd1303..1db16726851 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" >+ COPYRIGHT_STARTUP_MESSAGE "\n", >+ samba_version_string()); > > if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC > && !lp_parm_bool(-1, "server role check", "inhibit", false)) { >-- >2.38.0 > > >From 4bd3f993a2ae272fc826a84b0de404a85dc72799 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 22 Nov 2023 17:03:30 +0100 >Subject: [PATCH 09/11] lib/util: add debug_set_forced_log_priority() >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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@samba.org> >Reviewed-by: Björn Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit bd21a0cdefb30ef5522f81d865c03d11a182a63c) >--- > lib/util/debug.c | 10 ++++++++++ > lib/util/debug.h | 1 + > 2 files changed, 11 insertions(+) > >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 5433a585ec8..b62f2d19bcc 100644 >--- a/lib/util/debug.h >+++ b/lib/util/debug.h >@@ -356,6 +356,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 ); >-- >2.38.0 > > >From 53b5449bbcf2beca44c041c50c47dde68cfc1c6a Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 22 Nov 2023 17:18:29 +0100 >Subject: [PATCH 10/11] lib/util: convert DBG_STARTUP_NOTICE() to use > debug_set_forced_log_priority(DBGLVL_NOTICE) >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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@samba.org> >Reviewed-by: Björn Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit cd8dcff9e9cbfffab8c502c8701c00b0c8e3512b) >--- > lib/util/debug.h | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/lib/util/debug.h b/lib/util/debug.h >index b62f2d19bcc..d4bd8246b97 100644 >--- a/lib/util/debug.h >+++ b/lib/util/debug.h >@@ -269,14 +269,18 @@ void debuglevel_set_class(size_t idx, int level); > /* > * Debug levels matching RFC 3164 > */ >-#define DBGLVL_STARTUP_NOTICE -1 /* startup notice */ > #define DBGLVL_ERR 0 /* error conditions */ > #define DBGLVL_WARNING 1 /* warning conditions */ > #define DBGLVL_NOTICE 3 /* normal, but significant, condition */ > #define DBGLVL_INFO 5 /* informational message */ > #define DBGLVL_DEBUG 10 /* debug-level message */ > >-#define DBG_STARTUP_NOTICE(...) DBG_PREFIX(DBGLVL_STARTUP_NOTICE, (__VA_ARGS__)) >+#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__)) >-- >2.38.0 > > >From 05db11773c34d2ed5fe986019e02b536ce505973 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 14 Dec 2023 11:35:19 +0100 >Subject: [PATCH 11/11] VERSION: move COPYRIGHT_STARTUP_MESSAGE as > SAMBA_COPYRIGHT_STRING into version.h >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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@samba.org> >Reviewed-by: Björn Jacke <bjacke@samba.org> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> > >Autobuild-User(master): Stefan Metzmacher <metze@samba.org> >Autobuild-Date(master): Fri Dec 15 10:44:42 UTC 2023 on atb-devel-224 > >(cherry picked from commit d23d6145bf08c4765479951237e697c4b2b11aa2) >--- > VERSION | 2 ++ > buildtools/wafsamba/samba_patterns.py | 2 +- > buildtools/wafsamba/samba_version.py | 1 + > lib/param/param.h | 1 + > lib/util/copyright.h | 28 --------------------------- > source3/include/includes.h | 3 --- > source3/include/proto.h | 1 + > source3/lib/version.c | 5 +++++ > source3/nmbd/nmbd.c | 6 +++--- > source3/rpc_server/rpc_host.c | 8 ++++---- > source3/rpc_server/rpc_worker.c | 8 ++++---- > source3/smbd/server.c | 6 +++--- > source3/winbindd/winbindd.c | 6 +++--- > source3/wscript_build | 3 +-- > source4/include/includes.h | 3 --- > source4/samba/server.c | 8 ++++---- > 16 files changed, 33 insertions(+), 58 deletions(-) > delete mode 100644 lib/util/copyright.h > >diff --git a/VERSION b/VERSION >index 7da956b9a0f..a4cc3755b97 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/copyright.h b/lib/util/copyright.h >deleted file mode 100644 >index a29f2285d13..00000000000 >--- a/lib/util/copyright.h >+++ /dev/null >@@ -1,28 +0,0 @@ >-/* >- Unix SMB/CIFS implementation. >- >- Copyright (C) Björn Jacke 2023 >- >- This program is free software; you can redistribute it and/or modify >- it under the terms of the GNU General Public License as published by >- the Free Software Foundation; either version 3 of the License, or >- (at your option) any later version. >- >- This program is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >- GNU General Public License for more details. >- >- You should have received a copy of the GNU General Public License >- along with this program. If not, see <http://www.gnu.org/licenses/>. >-*/ >- >-#ifndef __LIB_UTIL_COPYRIGHT_H__ >-#define __LIB_UTIL_COPYRIGHT_H__ >- >-/* logged when starting the various Samba daemons */ >-#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2023" >- >-#endif /* __LIB_UTIL_COPYRIGHT_H__ */ >- >- >diff --git a/source3/include/includes.h b/source3/include/includes.h >index 8bb6ee88803..02beb0a0c88 100644 >--- a/source3/include/includes.h >+++ b/source3/include/includes.h >@@ -242,9 +242,6 @@ enum timestamp_set_resolution { > typedef char fstring[FSTRING_LEN]; > #endif > >-/* copyright define */ >-#include "../lib/util/copyright.h" >- > /* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */ > #include "../lib/util/debug.h" > >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/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 1db16726851..49ad382f8c5 100644 >--- a/source3/nmbd/nmbd.c >+++ b/source3/nmbd/nmbd.c >@@ -898,9 +898,9 @@ static bool open_sockets(bool isdaemon, int port) > > reopen_logs(); > >- DBG_STARTUP_NOTICE("nmbd version %s started.\n" >- COPYRIGHT_STARTUP_MESSAGE "\n", >- samba_version_string()); >+ 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/rpc_server/rpc_host.c b/source3/rpc_server/rpc_host.c >index 9e64fa62d0c..394c58436ab 100644 >--- a/source3/rpc_server/rpc_host.c >+++ b/source3/rpc_server/rpc_host.c >@@ -2840,10 +2840,10 @@ int main(int argc, const char *argv[]) > > reopen_logs(); > >- DBG_STARTUP_NOTICE("%s version %s started.\n" >- COPYRIGHT_STARTUP_MESSAGE "\n", >- progname, >- samba_version_string()); >+ 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); >diff --git a/source3/rpc_server/rpc_worker.c b/source3/rpc_server/rpc_worker.c >index cde0e7bcd59..56cba5a88f7 100644 >--- a/source3/rpc_server/rpc_worker.c >+++ b/source3/rpc_server/rpc_worker.c >@@ -1124,10 +1124,10 @@ int rpc_worker_main( > > reopen_logs(); > >- DBG_STARTUP_NOTICE("%s version %s started.\n" >- COPYRIGHT_STARTUP_MESSAGE "\n", >- progname, >- samba_version_string()); >+ 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 ddef5b6de16..42abfa948e6 100644 >--- a/source3/smbd/server.c >+++ b/source3/smbd/server.c >@@ -1743,9 +1743,9 @@ extern void build_options(bool screen); > > reopen_logs(); > >- DBG_STARTUP_NOTICE("smbd version %s started.\n" >- COPYRIGHT_STARTUP_MESSAGE "\n", >- samba_version_string()); >+ 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 cdd6d4319cb..04ba6778c1c 100644 >--- a/source3/winbindd/winbindd.c >+++ b/source3/winbindd/winbindd.c >@@ -1438,9 +1438,9 @@ int main(int argc, const char **argv) > > reopen_logs(); > >- DBG_STARTUP_NOTICE("winbindd version %s started.\n" >- COPYRIGHT_STARTUP_MESSAGE "\n", >- samba_version_string()); >+ 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/include/includes.h b/source4/include/includes.h >index 8832b97ed02..e7abf1a2492 100644 >--- a/source4/include/includes.h >+++ b/source4/include/includes.h >@@ -57,9 +57,6 @@ > #endif > #include "../lib/util/attr.h" > >-/* copyright define */ >-#include "../lib/util/copyright.h" >- > /* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */ > #include "../lib/util/debug.h" > #include "../lib/util/samba_util.h" >diff --git a/source4/samba/server.c b/source4/samba/server.c >index e1ad646fae2..84314447533 100644 >--- a/source4/samba/server.c >+++ b/source4/samba/server.c >@@ -630,10 +630,10 @@ static int binary_smbd_main(TALLOC_CTX *mem_ctx, > so set our umask to 0 */ > umask(0); > >- DBG_STARTUP_NOTICE("%s version %s started.\n" >- COPYRIGHT_STARTUP_MESSAGE "\n", >- binary_name, >- SAMBA_VERSION_STRING); >+ 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 || >-- >2.38.0 >
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
Flags:
metze
:
review+
bjacke
:
ci-passed+
Actions:
View
Attachments on
bug 15377
:
18190
|
18192
| 18202