r22213: We can't use become_root() here, as it does DEBUG()
authorVolker Lendecke <vlendec@samba.org>
Sat, 14 Apr 2007 06:40:47 +0000 (06:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:20 +0000 (12:19 -0500)
itself. become_root_uid_only did not :-)

Revert 21868, we need to find a better way.

Volker
(This used to be commit 629f966714c7a8d96b06027d514b86cde81b69b9)

source3/lib/debug.c
source3/smbd/process.c

index 138c52cdceaad095880e72b62bc715f84c846df6..62fda5741c9f9681111dbd696bb443c1707f9b10 100644 (file)
@@ -688,15 +688,20 @@ 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();
-
                (void)reopen_logs();
                if( dbf && get_file_size( debugf ) > maxlog ) {
                        pstring name;
@@ -709,8 +714,6 @@ void check_log_size( void )
                                (void)rename(name, debugf);
                        }
                }
-
-               unbecome_root();
        }
 
        /*
index c5db00752577a5aff609acec38adcdba28b5d2a5..6f3ad9884c1ecbc8a998e4f704a82f8198a3ef13 100644 (file)
@@ -1406,6 +1406,13 @@ 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);