andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 272f7c558b16d8764c0cb82a547b94333f1b6294 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Tue, 8 Jan 2013 13:47:25 -0500
dc8c34
Subject: [PATCH 123/225] Ticket 471 - logconv.pl tool removes the access logs
dc8c34
 contents if "-M" is not correctly used
dc8c34
dc8c34
Bug Description:  If you fail to specifiy the output file, the access log is overwritten.
dc8c34
dc8c34
Fix Description:  Check if the proper files have been provbided to the script, and report error otherwise.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/471
dc8c34
dc8c34
Reviewed by: nhosoi(Thanks!)
dc8c34
(cherry picked from commit 89fb3420c9137cb2c9813fec527b89fec3b6d63e)
dc8c34
(cherry picked from commit 9f0c9392ac7e27193831098f1efd4b7047432cd7)
dc8c34
(cherry picked from commit 96cdf89f5cb160b5906c36cb3c43013582577595)
dc8c34
---
dc8c34
 ldap/admin/src/logconv.pl | 16 +++++++++++++---
dc8c34
 1 file changed, 13 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
dc8c34
index f5342af..0ec596a 100755
dc8c34
--- a/ldap/admin/src/logconv.pl
dc8c34
+++ b/ldap/admin/src/logconv.pl
dc8c34
@@ -71,6 +71,7 @@ $endFlag = 0;
dc8c34
 $endTime = 0;
dc8c34
 $s_stats = new_stats_block( );
dc8c34
 $m_stats = new_stats_block( );
dc8c34
+$report_opt = "";
dc8c34
 
dc8c34
 GetOptions(
dc8c34
 	'd|rootDN=s' => \$manager,
dc8c34
@@ -81,8 +82,8 @@ GetOptions(
dc8c34
 	'S|startTime=s' => \$startTime,
dc8c34
 	'E|endTime=s' => \$endTime,
dc8c34
 	'B|bind=s' => sub { $reportBinds = "yes"; $bindReportDN=($_[1]) },
dc8c34
-	'm|reportFileSecs=s' => sub { my ($opt,$value) = @_; $s_stats = new_stats_block($value); },
dc8c34
-	'M|reportFileMins=s' =>  sub { my ($opt,$value) = @_; $m_stats = new_stats_block($value); },
dc8c34
+	'm|reportFileSecs=s' => sub { my ($opt,$value) = @_; $s_stats = new_stats_block($value); $report_opt = "-m"; },
dc8c34
+	'M|reportFileMins=s' =>  sub { my ($opt,$value) = @_; $m_stats = new_stats_block($value); $report_opt = "-M"; },
dc8c34
 	'h|help' => sub { displayUsage() },
dc8c34
 	# usage options '-efcibaltnxgjuiryp'
dc8c34
 	'e' => sub { $usage = $usage . "e"; },
dc8c34
@@ -132,6 +133,15 @@ while($sn <= $#ARGV){
dc8c34
 	$sn++;
dc8c34
 }
dc8c34
 
dc8c34
+if($fc == 0){
dc8c34
+	if($report_opt ne ""){
dc8c34
+		print "Usage error for option $report_opt, either the output file or access log is missing!\n\n";
dc8c34
+	} else {
dc8c34
+		print "There are no access logs specified!\n\n";
dc8c34
+	}
dc8c34
+	exit 1;
dc8c34
+}
dc8c34
+
dc8c34
 if ($sizeCount eq "all"){$sizeCount = "100000";}
dc8c34
 
dc8c34
 #######################################
dc8c34
@@ -261,7 +271,7 @@ $err[68] = "Already Exists\n";
dc8c34
 $err[69] = "No Objectclass Mods\n";
dc8c34
 $err[70] = "Results Too Large\n";
dc8c34
 $err[71] = "Effect Multiple DSA's\n";
dc8c34
-$err[80] = "Other :-)\n";
dc8c34
+$err[80] = "Other\n";
dc8c34
 $err[81] = "Server Down\n";
dc8c34
 $err[82] = "Local Error\n";
dc8c34
 $err[83] = "Encoding Error\n";
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34