]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r21868: Remove check_log_size from the central smbd processing loop. This can be...
authorVolker Lendecke <vlendec@samba.org>
Sun, 18 Mar 2007 10:13:35 +0000 (10:13 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:18:41 +0000 (12:18 -0500)
with a become_root/unbecome_root in debug.c.

source/lib/debug.c
source/smbd/process.c

index 62fda5741c9f9681111dbd696bb443c1707f9b10..a2e8574bbdd660b0bc0659d287622211e751b6a0 100644 (file)
@@ -688,20 +688,15 @@ void check_log_size( void )
        int         maxlog;
        SMB_STRUCT_STAT st;
 
-       /*
-        *  We need to be root to check/change log-file, skip this and let the main
-        *  loop check do a new check as root.
-        */
-
-       if( geteuid() != 0 )
-               return;
-
        if(log_overflow || !need_to_check_log_size() )
                return;
 
        maxlog = lp_max_log_size() * 1024;
 
        if( sys_fstat( x_fileno( dbf ), &st ) == 0 && st.st_size > maxlog ) {
+
+               become_root_uid_only();
+
                (void)reopen_logs();
                if( dbf && get_file_size( debugf ) > maxlog ) {
                        pstring name;
@@ -714,6 +709,8 @@ void check_log_size( void )
                                (void)rename(name, debugf);
                        }
                }
+
+               unbecome_root_uid_only();
        }
 
        /*
index 846f338ccf9e56a22988ad5b51a8239fc3beb5e4..83072817a381d3a973225ac428eb9c294f93b0c9 100644 (file)
@@ -1448,13 +1448,6 @@ machine %s in domain %s.\n", global_myname(), lp_workgroup()));
   
        update_monitored_printq_cache();
   
-       /*
-        * Now we are root, check if the log files need pruning.
-        * Force a log file check.
-        */
-       force_check_log_size();
-       check_log_size();
-
        /* Send any queued printer notify message to interested smbd's. */
 
        print_notify_send_messages(0);