]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:winbindd: Fix winbindd child logfile name handling
authorPavel Filipenský <pfilipen@redhat.com>
Thu, 7 Oct 2021 10:08:22 +0000 (12:08 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 12 Oct 2021 08:40:34 +0000 (08:40 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14852

Handling of logfile name for main and child winbindd must ensure:

1) Log directory is selected in this order:
  * -l option of winbindd
  * "log file" parameter in smb.conf
  * compile time value '/usr/local/samba/var'

2) Log filename pattern
  * parent process uses log.winbindd
  * child uses log.wb-<name>

3) Log reopen works for both parent and child (i.e. log filename is not changed)
  * kill -HUP <pid>
  * smbcontrol <pid> reload-config

This commit removes 3 calls of is_default_dyn_LOGFILEBASE() to make sure that:
  - 1st removal: child uses log.wb-<name> after the fork
  - 2nd removal: child after HUP signal, does not switch to log.winbindd
  - 3rd removal: child after smbcontrol reload-config, does not switch to
    log.winbindd

Interesting commits: bfa1b2a8 1484b7f3 3b015a4c d1f7a371

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_dual.c

index e19dfafc52ffd48ad6314b88441af20997b8b683..b275dfb128c3c9c59033f28b5e05b457eb2b2671 100644 (file)
@@ -1544,15 +1544,16 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
 
        close_conns_after_fork();
 
-       if (is_default_dyn_LOGFILEBASE() && logfilename) {
+       if (logfilename != NULL) {
                lp_set_logfile(logfilename);
                reopen_logs();
        }
 
-       if (!winbindd_setup_sig_term_handler(false))
+       if (!winbindd_setup_sig_term_handler(false)) {
                return NT_STATUS_NO_MEMORY;
-       if (!winbindd_setup_sig_hup_handler(
-                   !is_default_dyn_LOGFILEBASE() ? NULL : logfilename)) {
+       }
+
+       if (!winbindd_setup_sig_hup_handler(logfilename)) {
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -1777,7 +1778,7 @@ static bool fork_domain_child(struct winbindd_child *child)
                           winbind_msg_disconnect_dc);
        messaging_register(
                global_messaging_context(),
-               !is_default_dyn_LOGFILEBASE() ? NULL : child->logfilename,
+               child->logfilename,
                MSG_SMB_CONF_UPDATED,
                winbindd_msg_reload_services_child);