Skip to content

Commit

Permalink
Ticket 47910 - logconv.pl - check that the end time is greater than t…
Browse files Browse the repository at this point in the history
…he start time

Bug Description:  There is no check if the end time is greater than the start time.
                  This leads to an empty report being generated, when an error
                  should be returned instead.

Fix Description:  If start and end time are used, validate that the end time is
                  greater than the start time.

                  Also, improved an error message when the tool options are not
                  correctly used.

https://fedorahosted.org/389/ticket/47910

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit 34ffa6c)
  • Loading branch information
mreynolds389 committed Jul 20, 2015
1 parent 23a3ff6 commit 16b95b1
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions ldap/admin/src/logconv.pl
Expand Up @@ -148,14 +148,13 @@
}

if($file_count == 0){
if($reportStatsSecFile or $reportStatsMinFile){
print "Usage error for option -m or -M, either the output file or access log is missing!\n\n";
} else {
print "There are no access logs specified!\n\n";
}
print "There are no access logs specified, or the tool options have not been used correctly!\n";
exit 1;
}

#
# Initialize the statistic blocks
#
if ($reportStatsSecFile) {
$s_stats = new_stats_block($reportStatsSecFile);
$reportStats = "-m";
Expand Down Expand Up @@ -357,6 +356,19 @@

);

#
# Validate start/end times (if specified)
#
if ($startTime and $endTime){
# Make sure the end time is not earlier than the start time
my $testStart = convertTimeToSeconds($startTime);
my $testEnd = convertTimeToSeconds($endTime);
if ($testStart > $testEnd){
print "Start time ($startTime) is greater than end time ($endTime)!\n";
exit 1;
}
}

my $linesProcessed;
my $lineBlockCount;
my $cursize = 0;
Expand Down

0 comments on commit 16b95b1

Please sign in to comment.