From: Volker Lendecke Date: Sun, 18 Mar 2007 10:13:35 +0000 (+0000) Subject: r21868: Remove check_log_size from the central smbd processing loop. This can be... X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~924 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4632a0caaf251d9cc7b9d84cbd20362d37f0e4e0;p=thirdparty%2Fsamba.git r21868: Remove check_log_size from the central smbd processing loop. This can be done with a become_root/unbecome_root in debug.c. --- diff --git a/source/lib/debug.c b/source/lib/debug.c index 62fda5741c9..a2e8574bbdd 100644 --- a/source/lib/debug.c +++ b/source/lib/debug.c @@ -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(); } /* diff --git a/source/smbd/process.c b/source/smbd/process.c index 846f338ccf9..83072817a38 100644 --- a/source/smbd/process.c +++ b/source/smbd/process.c @@ -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);