Blame SOURCES/0087-Ticket-471-logconv.pl-tool-removes-the-access-logs-c.patch

cc3dff
From 7dc5c28a3beeeb90cdae084ae6d1fa338c09c50f Mon Sep 17 00:00:00 2001
cc3dff
From: Rich Megginson <rmeggins@redhat.com>
cc3dff
Date: Fri, 31 Jan 2014 16:49:58 -0700
cc3dff
Subject: [PATCH 87/87] Ticket #471 logconv.pl tool removes the access logs
cc3dff
 contents if "-M" is not correctly used
cc3dff
cc3dff
https://fedorahosted.org/389/ticket/471
cc3dff
Reviewed by: nhosoi (Thanks!)
cc3dff
Branch: rhel-7.0
cc3dff
Fix Description: Do not call new_stats_block() until we verify that it is safe
cc3dff
to call it.  It will wipe out the file.
cc3dff
Platforms tested: RHEL6 x86_64
cc3dff
Flag Day: no
cc3dff
Doc impact: no
cc3dff
(cherry picked from commit 7447050f572fb8865145d020e9eab64032f667be)
cc3dff
(cherry picked from commit cfbda421535451d99d3ee774a49fc099cfb902f0)
cc3dff
(cherry picked from commit 811300f30264a82b6cd9d0e1d7594a066458912c)
cc3dff
---
cc3dff
 ldap/admin/src/logconv.pl | 19 +++++++++++++++----
cc3dff
 1 file changed, 15 insertions(+), 4 deletions(-)
cc3dff
cc3dff
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
cc3dff
index e7d7507..99e0efd 100755
cc3dff
--- a/ldap/admin/src/logconv.pl
cc3dff
+++ b/ldap/admin/src/logconv.pl
cc3dff
@@ -104,6 +104,8 @@ my $reportBinds = "no";
cc3dff
 my $rootDN = "";
cc3dff
 my $needCleanup = 0;
cc3dff
 my @scopeTxt = ("0 (base)", "1 (one)", "2 (subtree)");
cc3dff
+my $reportStatsSecFile;
cc3dff
+my $reportStatsMinFile;
cc3dff
 
cc3dff
 GetOptions(
cc3dff
 	'd|rootDN=s' => \$rootDN,
cc3dff
@@ -115,8 +117,8 @@ GetOptions(
cc3dff
 	'S|startTime=s' => \$startTime,
cc3dff
 	'E|endTime=s' => \$endTime,
cc3dff
 	'B|bind=s' => sub { $reportBinds = "yes"; $bindReportDN=($_[1]) },
cc3dff
-	'm|reportFileSecs=s' => sub { my ($opt,$value) = @_; $s_stats = new_stats_block($value); $reportStats = "-m";},
cc3dff
-	'M|reportFileMins=s' =>  sub { my ($opt,$value) = @_; $m_stats = new_stats_block($value); $reportStats = "-M";},
cc3dff
+	'm|reportFileSecs=s' => \$reportStatsSecFile,
cc3dff
+	'M|reportFileMins=s' =>  \$reportStatsMinFile,
cc3dff
 	'h|help' => sub { displayUsage() },
cc3dff
 	# usage options '-efcibaltnxgjuiryp'
cc3dff
 	'e' => sub { $usage = $usage . "e"; },
cc3dff
@@ -169,14 +171,23 @@ while($arg_count <= $#ARGV){
cc3dff
 }
cc3dff
 
cc3dff
 if($file_count == 0){
cc3dff
-	if($reportStats){
cc3dff
-		print "Usage error for option $reportStats, either the output file or access log is missing!\n\n";
cc3dff
+	if($reportStatsSecFile or $reportStatsMinFile){
cc3dff
+		print "Usage error for option -m or -M, either the output file or access log is missing!\n\n";
cc3dff
 	} else {
cc3dff
 		print "There are no access logs specified!\n\n";
cc3dff
 	}
cc3dff
 	exit 1;
cc3dff
 }
cc3dff
 
cc3dff
+if ($reportStatsSecFile) {
cc3dff
+	$s_stats = new_stats_block($reportStatsSecFile);
cc3dff
+	$reportStats = "-m";
cc3dff
+}
cc3dff
+if ($reportStatsMinFile) {
cc3dff
+	$m_stats = new_stats_block($reportStatsMinFile);
cc3dff
+	$reportStats = "-M";
cc3dff
+}
cc3dff
+
cc3dff
 if ($sizeCount eq "all"){$sizeCount = "100000";}
cc3dff
 
cc3dff
 #######################################
cc3dff
-- 
cc3dff
1.8.1.4
cc3dff