1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

smbdotconf: mark "logfile" with substitution="1"

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2019-11-05 10:34:11 +01:00 committed by Stefan Metzmacher
parent f2a1f0c705
commit fa5033cfb7
11 changed files with 45 additions and 21 deletions

View File

@ -3,6 +3,7 @@
type="string"
function="logfile"
handler="handle_logfile"
substitution="1"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>

View File

@ -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()),

View File

@ -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);

View File

@ -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. */

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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)) {

View File

@ -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");
}