svn commit: samba r22213 - in branches/SAMBA_3_0/source: lib smbd

vlendec at samba.org vlendec at samba.org
Sat Apr 14 06:40:47 GMT 2007


Author: vlendec
Date: 2007-04-14 06:40:47 +0000 (Sat, 14 Apr 2007)
New Revision: 22213

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22213

Log:
We can't use become_root() here, as it does DEBUG()
itself. become_root_uid_only did not :-)

Revert 21868, we need to find a better way.

Volker

Modified:
   branches/SAMBA_3_0/source/lib/debug.c
   branches/SAMBA_3_0/source/smbd/process.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/debug.c
===================================================================
--- branches/SAMBA_3_0/source/lib/debug.c	2007-04-14 00:53:38 UTC (rev 22212)
+++ branches/SAMBA_3_0/source/lib/debug.c	2007-04-14 06:40:47 UTC (rev 22213)
@@ -688,15 +688,20 @@
 	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)rename(name, debugf);
 			}
 		}
-
-		unbecome_root();
 	}
 
 	/*

Modified: branches/SAMBA_3_0/source/smbd/process.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/process.c	2007-04-14 00:53:38 UTC (rev 22212)
+++ branches/SAMBA_3_0/source/smbd/process.c	2007-04-14 06:40:47 UTC (rev 22213)
@@ -1406,6 +1406,13 @@
   
 	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);



More information about the samba-cvs mailing list