From Jim McDonough
authorJeremy Allison <jra@samba.org>
Fri, 18 Jul 2008 03:01:13 +0000 (20:01 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 18 Jul 2008 03:01:13 +0000 (20:01 -0700)
In reloading the smb.conf, if a "log file" is specified in smb.conf,
winbind children will overwrite the logfile name to be the same as the
parent.

Jeremy.

source/winbindd/winbindd.c
source/winbindd/winbindd_dual.c

index 1bc2ffd95d4a059f5b41735b49d81f3cafd9f629..98d70ccbd3dd7066a14a0ef7ecede6f163b79c49 100644 (file)
@@ -56,7 +56,7 @@ struct messaging_context *winbind_messaging_context(void)
 
 /* Reload configuration */
 
-static bool reload_services_file(void)
+static bool reload_services_file(const char *logfile)
 {
        bool ret;
 
@@ -68,6 +68,12 @@ static bool reload_services_file(void)
                }
        }
 
+       /* if this is a child, restore the logfile to the special
+          name - <domain>, idmap, etc. */
+       if (logfile && *logfile) {
+               lp_set_logfile(logfile);
+       }
+
        reopen_logs();
        ret = lp_load(get_dyn_CONFIGFILE(),False,False,True,True);
 
@@ -205,7 +211,7 @@ static void msg_reload_services(struct messaging_context *msg,
 {
         /* Flush various caches */
        flush_caches();
-       reload_services_file();
+       reload_services_file((const char *) private_data);
 }
 
 /* React on 'smbcontrol winbindd shutdown' in the same way as on SIGTERM*/
@@ -801,14 +807,14 @@ static bool remove_idle_client(void)
 }
 
 /* check if HUP has been received and reload files */
-void winbind_check_sighup(void)
+void winbind_check_sighup(const char *logfile)
 {
        if (do_sighup) {
 
                DEBUG(3, ("got SIGHUP\n"));
 
                flush_caches();
-               reload_services_file();
+               reload_services_file(logfile);
 
                do_sighup = False;
        }
@@ -981,7 +987,7 @@ static void process_loop(void)
        /* Check signal handling things */
 
        winbind_check_sigterm(true);
-       winbind_check_sighup();
+       winbind_check_sighup(NULL);
 
        if (do_sigusr2) {
                print_winbindd_status();
@@ -1134,7 +1140,7 @@ int main(int argc, char **argv, char **envp)
 
        db_tdb2_setup_messaging(winbind_messaging_context(), true);
 
-       if (!reload_services_file()) {
+       if (!reload_services_file(NULL)) {
                DEBUG(0, ("error opening config file\n"));
                exit(1);
        }
index c3bcb715bb009044794512f697be9e3e8a151c40..57ab627a5bec4a4fcdb7f741f5f8b94a2d0e49db 100644 (file)
@@ -1148,7 +1148,8 @@ static bool fork_domain_child(struct winbindd_child *child)
 
                /* check for signals */
                winbind_check_sigterm(false);
-               winbind_check_sighup();
+               winbind_check_sighup(override_logfile ? NULL :
+                               child->logfilename);
 
                run_events(winbind_event_context(), 0, NULL, NULL);