From: Ralph Boehme Date: Tue, 5 Nov 2019 09:34:11 +0000 (+0100) Subject: smbdotconf: mark "logfile" with substitution="1" X-Git-Tag: ldb-2.1.0~543 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa5033cfb7e9b65c23fe2c0c391c59b70d8415c3;p=thirdparty%2Fsamba.git smbdotconf: mark "logfile" with substitution="1" Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- diff --git a/docs-xml/smbdotconf/logging/logfile.xml b/docs-xml/smbdotconf/logging/logfile.xml index eb751cb9732..07762ee06e0 100644 --- a/docs-xml/smbdotconf/logging/logfile.xml +++ b/docs-xml/smbdotconf/logging/logfile.xml @@ -3,6 +3,7 @@ type="string" function="logfile" handler="handle_logfile" + substitution="1" xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 5384ac1718a..82e8ef7fa7d 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -40,8 +40,10 @@ bool reopen_logs(void) .debug_uid = lp_debug_uid(), .debug_class = lp_debug_class(), }; + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); - debug_set_logfile(lp_logfile(talloc_tos())); + debug_set_logfile(lp_logfile(talloc_tos(), lp_sub)); debug_parse_levels(lp_log_level(talloc_tos())); debug_set_settings(&settings, lp_logging(talloc_tos()), diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index fa21668000e..d5b60c69ef7 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -101,7 +101,9 @@ static void popt_common_callback(poptContext con, } if (override_logfile) { - char *logfile = lp_logfile(mem_ctx); + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + char *logfile = lp_logfile(mem_ctx, lp_sub); if (logfile == NULL) { talloc_free(mem_ctx); exit(1); diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index b4097d1dc57..0b881d13f7b 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -851,6 +851,8 @@ static bool open_sockets(bool isdaemon, int port) POPT_COMMON_SAMBA POPT_TABLEEND }; + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); TALLOC_CTX *frame; NTSTATUS status; bool ok; @@ -916,7 +918,7 @@ static bool open_sockets(bool isdaemon, int port) } fault_setup(); - dump_core_setup("nmbd", lp_logfile(talloc_tos())); + dump_core_setup("nmbd", lp_logfile(talloc_tos(), lp_sub)); /* POSIX demands that signals are inherited. If the invoking process has * these signals masked, we will have problems, as we won't receive them. */ diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 427e31e0122..ebfeea4f76d 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -59,7 +59,9 @@ static struct pf_daemon_config pf_spoolss_cfg = { 0 }; static void spoolss_reopen_logs(int child_id) { - char *lfile = lp_logfile(talloc_tos()); + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + char *lfile = lp_logfile(talloc_tos(), lp_sub); char *ext; int rc; @@ -81,11 +83,11 @@ static void spoolss_reopen_logs(int child_id) if (strstr(lfile, ext) == NULL) { if (child_id) { rc = asprintf(&lfile, "%s.%d", - lp_logfile(talloc_tos()), + lp_logfile(talloc_tos(), lp_sub), child_id); } else { rc = asprintf(&lfile, "%s.%s", - lp_logfile(talloc_tos()), + lp_logfile(talloc_tos(), lp_sub), ext); } } @@ -580,14 +582,16 @@ static void print_queue_forward(struct messaging_context *msg, static char *get_bq_logfile(void) { - char *lfile = lp_logfile(talloc_tos()); + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + char *lfile = lp_logfile(talloc_tos(), lp_sub); int rc; if (lfile == NULL || lfile[0] == '\0') { rc = asprintf(&lfile, "%s/log.%s.bq", get_dyn_LOGFILEBASE(), DAEMON_NAME); } else { - rc = asprintf(&lfile, "%s.bq", lp_logfile(talloc_tos())); + rc = asprintf(&lfile, "%s.bq", lp_logfile(talloc_tos(), lp_sub)); } if (rc == -1) { lfile = NULL; diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index 2f41d22c97b..3e3bc6b4049 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -38,7 +38,9 @@ static void epmd_reopen_logs(void) { - char *lfile = lp_logfile(talloc_tos()); + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + char *lfile = lp_logfile(talloc_tos(), lp_sub); int rc; if (lfile == NULL || lfile[0] == '\0') { @@ -50,7 +52,7 @@ static void epmd_reopen_logs(void) } else { if (strstr(lfile, DAEMON_NAME) == NULL) { rc = asprintf(&lfile, "%s.%s", - lp_logfile(talloc_tos()), DAEMON_NAME); + lp_logfile(talloc_tos(), lp_sub), DAEMON_NAME); if (rc > 0) { lp_set_logfile(lfile); SAFE_FREE(lfile); diff --git a/source3/rpc_server/fssd.c b/source3/rpc_server/fssd.c index 9e5a6110ebc..8dc8b0e8e64 100644 --- a/source3/rpc_server/fssd.c +++ b/source3/rpc_server/fssd.c @@ -42,7 +42,9 @@ void start_fssd(struct tevent_context *ev_ctx, static void fssd_reopen_logs(void) { - char *lfile = lp_logfile(NULL); + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + char *lfile = lp_logfile(NULL, lp_sub); int rc; if (lfile == NULL || lfile[0] == '\0') { @@ -53,7 +55,7 @@ static void fssd_reopen_logs(void) } } else { if (strstr(lfile, DAEMON_NAME) == NULL) { - rc = asprintf(&lfile, "%s.%s", lp_logfile(NULL), DAEMON_NAME); + rc = asprintf(&lfile, "%s.%s", lp_logfile(NULL, lp_sub), DAEMON_NAME); if (rc > 0) { lp_set_logfile(lfile); SAFE_FREE(lfile); diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c index 850ee26036f..0d8ba304f67 100644 --- a/source3/rpc_server/lsasd.c +++ b/source3/rpc_server/lsasd.c @@ -62,7 +62,9 @@ static struct pf_daemon_config pf_lsasd_cfg = { 0 }; static void lsasd_reopen_logs(int child_id) { - char *lfile = lp_logfile(talloc_tos()); + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + char *lfile = lp_logfile(talloc_tos(), lp_sub); char *extension; int rc; @@ -83,11 +85,11 @@ static void lsasd_reopen_logs(int child_id) if (strstr(lfile, extension) == NULL) { if (child_id) { rc = asprintf(&lfile, "%s.%d", - lp_logfile(talloc_tos()), + lp_logfile(talloc_tos(), lp_sub), child_id); } else { rc = asprintf(&lfile, "%s.%s", - lp_logfile(talloc_tos()), + lp_logfile(talloc_tos(), lp_sub), extension); } } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 38fc36881f4..6e7292079c6 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1628,6 +1628,8 @@ extern void build_options(bool screen); struct tevent_signal *se; int profiling_level; char *np_dir = NULL; + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); static const struct smbd_shim smbd_shim_fns = { .send_stat_cache_delete_message = smbd_send_stat_cache_delete_message, @@ -1741,7 +1743,7 @@ extern void build_options(bool screen); gain_root_group_privilege(); fault_setup(); - dump_core_setup("smbd", lp_logfile(talloc_tos())); + dump_core_setup("smbd", lp_logfile(talloc_tos(), lp_sub)); /* we are never interested in SIGPIPE */ BlockSignals(True,SIGPIPE); diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index e839f0d19e3..57d93f5a769 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1652,6 +1652,8 @@ int main(int argc, const char **argv) POPT_COMMON_SAMBA POPT_TABLEEND }; + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); poptContext pc; int opt; TALLOC_CTX *frame; @@ -1681,7 +1683,7 @@ int main(int argc, const char **argv) CatchSignal(SIGUSR2, SIG_IGN); fault_setup(); - dump_core_setup("winbindd", lp_logfile(talloc_tos())); + dump_core_setup("winbindd", lp_logfile(talloc_tos(), lp_sub)); smb_init_locale(); @@ -1741,7 +1743,7 @@ int main(int argc, const char **argv) * is often not related to the path where winbindd is actually run * in production. */ - dump_core_setup("winbindd", lp_logfile(talloc_tos())); + dump_core_setup("winbindd", lp_logfile(talloc_tos(), lp_sub)); if (is_daemon && interactive) { d_fprintf(stderr,"\nERROR: " "Option -i|--interactive is not allowed together with -D|--daemon\n\n"); @@ -1785,7 +1787,7 @@ int main(int argc, const char **argv) * as the log file might have been set in the configuration and cores's * path is by default basename(lp_logfile()). */ - dump_core_setup("winbindd", lp_logfile(talloc_tos())); + dump_core_setup("winbindd", lp_logfile(talloc_tos(), lp_sub)); if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC && !lp_parm_bool(-1, "server role check", "inhibit", false)) { diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 6e3277e5529..8188ed097df 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -757,13 +757,16 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child, const char *logprefix, const char *logname) { + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + if (logprefix && logname) { char *logbase = NULL; - if (*lp_logfile(talloc_tos())) { + if (*lp_logfile(talloc_tos(), lp_sub)) { char *end = NULL; - if (asprintf(&logbase, "%s", lp_logfile(talloc_tos())) < 0) { + if (asprintf(&logbase, "%s", lp_logfile(talloc_tos(), lp_sub)) < 0) { smb_panic("Internal error: asprintf failed"); }