Blame SOURCES/0026-Ticket-47501-logconv.pl-uses-var-tmp-for-BDB-temp-fi.patch

ba46c7
From 86251b8a014583a39e365cf67c6db80197cdc608 Mon Sep 17 00:00:00 2001
ba46c7
From: Rich Megginson <rmeggins@redhat.com>
ba46c7
Date: Tue, 23 Jul 2013 17:05:32 -0600
ba46c7
Subject: [PATCH 26/28] Ticket #47501 logconv.pl uses /var/tmp for BDB temp files
ba46c7
ba46c7
https://fedorahosted.org/389/ticket/47501
ba46c7
Reviewed by: mreynolds (Thanks!)
ba46c7
Branch: master
ba46c7
Fix Description: Tied arrays with DB_RECNO require a backing text file.  By
ba46c7
default this goes in /var/tmp.  This can be controlled with RECNOINFO bfname.
ba46c7
However, the use of arrays was killing performance.  This patch replaces
ba46c7
all arrays with tied hashes.  In addition, this patch fixes the notes=U
ba46c7
handling to also handle notes=U,P and notes=A,P
ba46c7
Platforms tested: RHEL6 x86_64
ba46c7
Flag Day: no
ba46c7
Doc impact: no
ba46c7
(cherry picked from commit 4d20922423c9e22c858e0be7dd317591631cf357)
ba46c7
(cherry picked from commit d890e65b4ab15d0a836dbb248da8606867938630)
ba46c7
---
ba46c7
 ldap/admin/src/logconv.pl |  775 +++++++++++++++++++--------------------------
ba46c7
 1 files changed, 333 insertions(+), 442 deletions(-)
ba46c7
ba46c7
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
ba46c7
index 3a6fa01..ca07a3a 100755
ba46c7
--- a/ldap/admin/src/logconv.pl
ba46c7
+++ b/ldap/admin/src/logconv.pl
ba46c7
@@ -67,7 +67,7 @@ if ($#ARGV < 0){;
ba46c7
 
ba46c7
 my $file_count = 0;
ba46c7
 my $arg_count = 0;
ba46c7
-my $logversion = "7.0";
ba46c7
+my $logversion = "8.0";
ba46c7
 my $sizeCount = "20";
ba46c7
 my $startFlag = 0;
ba46c7
 my $startTime = 0;
ba46c7
@@ -76,6 +76,8 @@ my $endTime = 0;
ba46c7
 my $reportStats = "";
ba46c7
 my $dataLocation = "/tmp";
ba46c7
 my $startTLSoid = "1.3.6.1.4.1.1466.20037";
ba46c7
+my @statnames=qw(last last_str results srch add mod modrdn moddn cmp del abandon
ba46c7
+                 conns sslconns bind anonbind unbind notesA notesU etime);
ba46c7
 my $s_stats = new_stats_block( );
ba46c7
 my $m_stats = new_stats_block( );
ba46c7
 my $verb = "no";
ba46c7
@@ -95,8 +97,6 @@ my %connList;
ba46c7
 my %bindReport;
ba46c7
 my @vlvconn;
ba46c7
 my @vlvop;
ba46c7
-my @start_time_of_connection;
ba46c7
-my @end_time_of_connection;
ba46c7
 my @fds;
ba46c7
 my $fdds = 0;
ba46c7
 my $reportBinds = "no";
ba46c7
@@ -179,7 +179,7 @@ if ($sizeCount eq "all"){$sizeCount = "100000";}
ba46c7
 
ba46c7
 #######################################
ba46c7
 #                                     #
ba46c7
-# Initialize Arrays and variables     #
ba46c7
+# Initialize Hashes and variables     #
ba46c7
 #                                     #
ba46c7
 #######################################
ba46c7
 
ba46c7
@@ -255,21 +255,17 @@ map {$conn{$_} = $_} @conncodes;
ba46c7
 
ba46c7
 # hash db-backed hashes
ba46c7
 my @hashnames = qw(attr rc src rsrc excount conn_hash ip_hash conncount nentries
ba46c7
-                   filter base ds6xbadpwd saslmech bindlist etime oid);
ba46c7
+                   filter base ds6xbadpwd saslmech bindlist etime oid
ba46c7
+                   start_time_of_connection end_time_of_connection
ba46c7
+                   notesa_conn_op notesu_conn_op etime_conn_op nentries_conn_op
ba46c7
+                   optype_conn_op time_conn_op srch_conn_op del_conn_op mod_conn_op
ba46c7
+                   mdn_conn_op cmp_conn_op bind_conn_op unbind_conn_op ext_conn_op
ba46c7
+                   abandon_conn_op badpwd_conn_op);
ba46c7
 # need per connection code ip address counts - so use a hash table
ba46c7
 # for each connection code - key is ip, val is count
ba46c7
 push @hashnames, @conncodes;
ba46c7
 my $hashes = openHashFiles($dataLocation, @hashnames);
ba46c7
 
ba46c7
-# recno db-backed arrays/lists
ba46c7
-my @arraynames = qw(srchconn srchop delconn delop modconn modop addconn addop modrdnconn modrdnop
ba46c7
-                    cmpconn cmpop targetconn targetop msgid bindconn bindop binddn unbindconn unbindop
ba46c7
-                    extconn extop notesAetime notesAconn notesAop notesAtime notesAnentries
ba46c7
-                    notesUetime notesUconn notesUop notesUtime notesUnentries badpwdconn
ba46c7
-                    badpwdop badpwdip baseval baseconn baseop scopeval scopeconn scopeop
ba46c7
-                    filterval filterconn filterop);
ba46c7
-my $arrays = openArrayFiles($dataLocation, @arraynames);
ba46c7
-
ba46c7
 $needCleanup = 1;
ba46c7
 
ba46c7
 my @err;
ba46c7
@@ -636,6 +632,12 @@ Binds:                        @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ba46c7
 .
ba46c7
 write STDOUT;
ba46c7
 
ba46c7
+# format/write messes up emacs autoformatting - inserting this dummy function
ba46c7
+# fixes that
ba46c7
+sub dummy {
ba46c7
+	my $bar = shift;
ba46c7
+}
ba46c7
+
ba46c7
 print "\n";
ba46c7
 print "Proxied Auth Operations:      $proxiedAuthCount\n";
ba46c7
 print "Persistent Searches:          $persistentSrchCount\n";
ba46c7
@@ -658,115 +660,75 @@ print "Unindexed Components:         $unindexedSrchCountNotesU\n";
ba46c7
 if ($verb eq "yes" || $usage =~ /u/){
ba46c7
 	if ($unindexedSrchCountNotesA > 0){
ba46c7
 		my $conn_hash = $hashes->{conn_hash};
ba46c7
-		my $notesConn = $arrays->{notesAconn};
ba46c7
-		my $notesOp = $arrays->{notesAop};
ba46c7
-		my $notesEtime = $arrays->{notesAetime};
ba46c7
-		my $notesTime = $arrays->{notesAtime};
ba46c7
-		my $notesNentries = $arrays->{notesAnentries};
ba46c7
-		my $base_val = $arrays->{baseval};
ba46c7
-		my $base_conn = $arrays->{baseconn};
ba46c7
-		my $base_op = $arrays->{baseop};
ba46c7
-		my $scope_val = $arrays->{scopeval};
ba46c7
-		my $scope_conn = $arrays->{scopeconn};
ba46c7
-		my $scope_op = $arrays->{scopeop};
ba46c7
-		my $filter_val = $arrays->{filterval};
ba46c7
-		my $filter_conn = $arrays->{filterconn};
ba46c7
-		my $filter_op = $arrays->{filterop};
ba46c7
-		my $notesCount = "1";
ba46c7
+		my $notesa_conn_op = $hashes->{notesa_conn_op};
ba46c7
+		my $time_conn_op = $hashes->{time_conn_op};
ba46c7
+		my $etime_conn_op = $hashes->{etime_conn_op};
ba46c7
+		my $nentries_conn_op = $hashes->{nentries_conn_op};
ba46c7
+		my $base_conn_op = $hashes->{base_conn_op};
ba46c7
+		my $scope_conn_op = $hashes->{scope_conn_op};
ba46c7
+		my $filter_conn_op = $hashes->{filter_conn_op};
ba46c7
+
ba46c7
+		my $notesCount = 1;
ba46c7
 		my $unindexedIp;
ba46c7
-
ba46c7
-		for (my $n = 0; $n < scalar(@{$notesEtime}); $n++){
ba46c7
-			if(!$notesConn->[$n] || $notesConn->[$n] eq "" || 
ba46c7
-			   !$conn_hash->{$notesConn->[$n]} || $conn_hash->{$notesConn->[$n]} eq ""){
ba46c7
-				$unindexedIp = "?";
ba46c7
+		while (my ($conn_op, $count) = each %{$notesa_conn_op}) {
ba46c7
+			my ($conn, $op) = split(",", $conn_op);
ba46c7
+			if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) {
ba46c7
+				$unindexedIp = $conn_hash->{$conn};
ba46c7
 			} else {
ba46c7
-				$unindexedIp = $conn_hash->{$notesConn->[$n]};
ba46c7
+				$unindexedIp = "?";
ba46c7
 			}
ba46c7
-			print "\n  Unindexed Search #".$notesCount."\n"; $notesCount++;
ba46c7
-			print "  -  Date/Time:             $notesTime->[$n]\n";
ba46c7
-			print "  -  Connection Number:     $notesConn->[$n]\n";
ba46c7
-			print "  -  Operation Number:      $notesOp->[$n]\n";
ba46c7
-			print "  -  Etime:                 $notesEtime->[$n]\n";
ba46c7
-			print "  -  Nentries:              $notesNentries->[$n]\n";
ba46c7
+			print "\n  Unindexed Components #".$notesCount."\n"; $notesCount++;
ba46c7
+			print "  -  Date/Time:             $time_conn_op->{$conn_op}\n";
ba46c7
+			print "  -  Connection Number:     $conn\n";
ba46c7
+			print "  -  Operation Number:      $op\n";
ba46c7
+			print "  -  Etime:                 $etime_conn_op->{$conn_op}\n";
ba46c7
+			print "  -  Nentries:              $nentries_conn_op->{$conn_op}\n";
ba46c7
 			print "  -  IP Address:            $unindexedIp\n";
ba46c7
-
ba46c7
-			for (my $nnn = 0; $nnn < $baseCount; $nnn++){
ba46c7
-				if(!$base_conn->[$nnn] || !$base_op->[$nnn]){ next; }
ba46c7
-				if ($notesConn->[$n] eq $base_conn->[$nnn] && $notesOp->[$n] eq $base_op->[$nnn]){
ba46c7
-					print "  -  Search Base:           $base_val->[$nnn]\n";
ba46c7
-					last;
ba46c7
-				}
ba46c7
+			if (exists($base_conn_op->{$conn_op}) && defined($base_conn_op->{$conn_op})) {
ba46c7
+				print "  -  Search Base:           $base_conn_op->{$conn_op}\n";
ba46c7
 			}
ba46c7
-			for (my $nnn = 0; $nnn < $scopeCount; $nnn++){
ba46c7
-				if(!$scope_conn->[$nnn] || !$scope_op->[$nnn]){ next; }
ba46c7
-				if ($notesConn->[$n] eq $scope_conn->[$nnn] && $notesOp->[$n] eq $scope_op->[$nnn]){
ba46c7
-					print "  -  Search Scope:          $scope_val->[$nnn]\n";
ba46c7
-					last;
ba46c7
-				}
ba46c7
+			if (exists($scope_conn_op->{$conn_op}) && defined($scope_conn_op->{$conn_op})) {
ba46c7
+				print "  -  Search Scope:          $scope_conn_op->{$conn_op}\n";
ba46c7
 			}
ba46c7
-			for (my $nnn = 0; $nnn < $filterCount; $nnn++){	
ba46c7
-				if(!$filter_conn->[$nnn] || !$filter_op->[$nnn]){ next; }
ba46c7
-				if ($notesConn->[$n] eq $filter_conn->[$nnn] && $notesOp->[$n] eq $filter_op->[$nnn]){
ba46c7
-					print "  -  Search Filter:         $filter_val->[$nnn]\n";
ba46c7
-					last;
ba46c7
-				}	
ba46c7
+			if (exists($filter_conn_op->{$conn_op}) && defined($filter_conn_op->{$conn_op})) {
ba46c7
+				print "  -  Search Filter:         $filter_conn_op->{$conn_op}\n";
ba46c7
 			}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if ($unindexedSrchCountNotesU > 0){
ba46c7
 		my $conn_hash = $hashes->{conn_hash};
ba46c7
-		my $notesConn = $arrays->{notesUconn};
ba46c7
-		my $notesOp = $arrays->{notesUop};
ba46c7
-		my $notesEtime = $arrays->{notesUetime};
ba46c7
-		my $notesTime = $arrays->{notesUtime};
ba46c7
-		my $notesNentries = $arrays->{notesUnentries};
ba46c7
-		my $base_val = $arrays->{baseval};
ba46c7
-		my $base_conn = $arrays->{baseconn};
ba46c7
-		my $base_op = $arrays->{baseop};
ba46c7
-		my $scope_val = $arrays->{scopeval};
ba46c7
-		my $scope_conn = $arrays->{scopeconn};
ba46c7
-		my $scope_op = $arrays->{scopeop};
ba46c7
-		my $filter_val = $arrays->{filterval};
ba46c7
-		my $filter_conn = $arrays->{filterconn};
ba46c7
-		my $filter_op = $arrays->{filterop};
ba46c7
-
ba46c7
-		my $notesCount = "1";
ba46c7
+		my $notesu_conn_op = $hashes->{notesu_conn_op};
ba46c7
+		my $time_conn_op = $hashes->{time_conn_op};
ba46c7
+		my $etime_conn_op = $hashes->{etime_conn_op};
ba46c7
+		my $nentries_conn_op = $hashes->{nentries_conn_op};
ba46c7
+		my $base_conn_op = $hashes->{base_conn_op};
ba46c7
+		my $scope_conn_op = $hashes->{scope_conn_op};
ba46c7
+		my $filter_conn_op = $hashes->{filter_conn_op};
ba46c7
+
ba46c7
+		my $notesCount = 1;
ba46c7
 		my $unindexedIp;
ba46c7
-		for (my $n = 0; $n < scalar(@{$notesEtime}); $n++){
ba46c7
-			if(!$notesConn->[$n] || $notesConn->[$n] eq "" || 
ba46c7
-			   !$conn_hash->{$notesConn->[$n]} || $conn_hash->{$notesConn->[$n]} eq ""){
ba46c7
-				$unindexedIp = "?";
ba46c7
+		while (my ($conn_op, $count) = each %{$notesu_conn_op}) {
ba46c7
+			my ($conn, $op) = split(",", $conn_op);
ba46c7
+			if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) {
ba46c7
+				$unindexedIp = $conn_hash->{$conn};
ba46c7
 			} else {
ba46c7
-				$unindexedIp = $conn_hash->{$notesConn->[$n]};
ba46c7
+				$unindexedIp = "?";
ba46c7
 			}
ba46c7
 			print "\n  Unindexed Components #".$notesCount."\n"; $notesCount++;
ba46c7
-			print "  -  Date/Time:             $notesTime->[$n]\n";
ba46c7
-			print "  -  Connection Number:     $notesConn->[$n]\n";
ba46c7
-			print "  -  Operation Number:      $notesOp->[$n]\n";
ba46c7
-			print "  -  Etime:                 $notesEtime->[$n]\n";
ba46c7
-			print "  -  Nentries:              $notesNentries->[$n]\n";
ba46c7
+			print "  -  Date/Time:             $time_conn_op->{$conn_op}\n";
ba46c7
+			print "  -  Connection Number:     $conn\n";
ba46c7
+			print "  -  Operation Number:      $op\n";
ba46c7
+			print "  -  Etime:                 $etime_conn_op->{$conn_op}\n";
ba46c7
+			print "  -  Nentries:              $nentries_conn_op->{$conn_op}\n";
ba46c7
 			print "  -  IP Address:            $unindexedIp\n";
ba46c7
-
ba46c7
-			for (my $nnn = 0; $nnn < $baseCount; $nnn++){
ba46c7
-				if(!$base_conn->[$nnn] || !$base_op->[$nnn]){ next; }
ba46c7
-				if ($notesConn->[$n] eq $base_conn->[$nnn] && $notesOp->[$n] eq $base_op->[$nnn]){
ba46c7
-					print "  -  Search Base:           $base_val->[$nnn]\n";
ba46c7
-					last;
ba46c7
-				}
ba46c7
+			if (exists($base_conn_op->{$conn_op}) && defined($base_conn_op->{$conn_op})) {
ba46c7
+				print "  -  Search Base:           $base_conn_op->{$conn_op}\n";
ba46c7
 			}
ba46c7
-			for (my $nnn = 0; $nnn < $scopeCount; $nnn++){
ba46c7
-				if(!$scope_conn->[$nnn] || !$scope_op->[$nnn]){ next; }
ba46c7
-				if ($notesConn->[$n] eq $scope_conn->[$nnn] && $notesOp->[$n] eq $scope_op->[$nnn]){
ba46c7
-					print "  -  Search Scope:          $scope_val->[$nnn]\n";
ba46c7
-					last;
ba46c7
-				}
ba46c7
+			if (exists($scope_conn_op->{$conn_op}) && defined($scope_conn_op->{$conn_op})) {
ba46c7
+				print "  -  Search Scope:          $scope_conn_op->{$conn_op}\n";
ba46c7
 			}
ba46c7
-			for (my $nnn = 0; $nnn < $filterCount; $nnn++){	
ba46c7
-				if(!$filter_conn->[$nnn] || !$filter_op->[$nnn]){ next; }
ba46c7
-				if ($notesConn->[$n] eq $filter_conn->[$nnn] && $notesOp->[$n] eq $filter_op->[$nnn]){
ba46c7
-					print "  -  Search Filter:         $filter_val->[$nnn]\n";
ba46c7
-					last;
ba46c7
-				}	
ba46c7
+			if (exists($filter_conn_op->{$conn_op}) && defined($filter_conn_op->{$conn_op})) {
ba46c7
+				print "  -  Search Filter:         $filter_conn_op->{$conn_op}\n";
ba46c7
 			}
ba46c7
 		}
ba46c7
 	}
ba46c7
@@ -800,7 +762,7 @@ if ($connResetByPeerCount > 0){
ba46c7
 			push @retext, sprintf "     -  %-4s (%2s) %-40s\n",$src->{$key},$conn{$key},$connmsg{$key};
ba46c7
 		}
ba46c7
 	}
ba46c7
- 	print @retext;
ba46c7
+	print @retext;
ba46c7
 	print "\n";
ba46c7
 }
ba46c7
 
ba46c7
@@ -813,8 +775,8 @@ if ($resourceUnavailCount > 0){
ba46c7
 			if ($conn{$key} eq ""){$conn{$key} = "**Resource Issue**";}
ba46c7
 			push @rtext, sprintf "     -  %-4s (%2s) %-40s\n",$rsrc->{$key},$conn{$key},$connmsg{$key};
ba46c7
 		}
ba46c7
-  	}
ba46c7
-  	print @rtext;
ba46c7
+	}
ba46c7
+	print @rtext;
ba46c7
 }
ba46c7
 print "Max BER Size Exceeded:        $maxBerSizeCount\n";
ba46c7
 print "\n";
ba46c7
@@ -829,7 +791,7 @@ print " - SASL Binds:                $saslBindCount\n";
ba46c7
 if ($saslBindCount > 0){
ba46c7
 	my $saslmech = $hashes->{saslmech};
ba46c7
 	foreach my $saslb ( sort {$saslmech->{$b} <=> $saslmech->{$a} } (keys %{$saslmech}) ){
ba46c7
-		printf "    %-4s  %-12s\n",$saslmech->{$saslb}, $saslb;   
ba46c7
+		printf "    %-4s  %-12s\n",$saslmech->{$saslb}, $saslb;
ba46c7
 	}
ba46c7
 }
ba46c7
 
ba46c7
@@ -914,13 +876,13 @@ if ($usage =~ /e/i || $verb eq "yes"){
ba46c7
 	for (my $i = 0; $i <= $#errtext; $i++){
ba46c7
 		$errtext[$i] =~ s/\n//g;
ba46c7
 		print  "\n" . $errtext[$i];
ba46c7
-	} 
ba46c7
+	}
ba46c7
 }
ba46c7
 
ba46c7
 ####################################
ba46c7
-#            			   #
ba46c7
+#			   #
ba46c7
 #     Print Failed Logins          #
ba46c7
-# 				   #
ba46c7
+#				   #
ba46c7
 ####################################
ba46c7
 
ba46c7
 if ($verb eq "yes" || $usage =~ /f/ ){
ba46c7
@@ -936,19 +898,20 @@ if ($verb eq "yes" || $usage =~ /f/ ){
ba46c7
 				$ds6loop++;
ba46c7
 			}
ba46c7
 		} else {
ba46c7
-			my $bindVal = $arrays->{binddn};
ba46c7
-			my $bindConn = $arrays->{bindconn};
ba46c7
-			my $bindOp = $arrays->{bindop};
ba46c7
-			my $badPasswordConn = $arrays->{badpwdconn};
ba46c7
-			my $badPasswordOp = $arrays->{badpwdop};
ba46c7
-			my $badPasswordIp = $arrays->{badpwdip};
ba46c7
+			# key is conn,op - val is binddn
ba46c7
+			my $bind_conn_op = $hashes->{bind_conn_op};
ba46c7
+			# key is conn,op - val is count
ba46c7
+			my $badpwd_conn_op = $hashes->{badpwd_conn_op};
ba46c7
+			# key is binddn - val is count
ba46c7
 			my %badPassword = ();
ba46c7
-			for (my $ii =0 ; $ii < $badPwdCount; $ii++){
ba46c7
-		 		for (my $i = 0; $i < $bindCount; $i++){
ba46c7
-					if ($badPasswordConn->[$ii] eq $bindConn->[$i] && $badPasswordOp->[$ii] eq $bindOp->[$i] ){
ba46c7
-						$badPassword{ $bindVal->[$i] }++;
ba46c7
-					}
ba46c7
-		 		}
ba46c7
+			my @badPasswordIp = ();
ba46c7
+			while (my ($conn_op, $count) = each %{$badpwd_conn_op}) {
ba46c7
+				my ($conn, $op) = split(",", $conn_op);
ba46c7
+				if (exists($bind_conn_op->{$conn_op}) && defined($bind_conn_op->{$conn_op})) {
ba46c7
+					my $binddn = $bind_conn_op->{$conn_op};
ba46c7
+					$badPassword{$binddn}++;
ba46c7
+					push @badPasswordIp, getIPfromConn($conn);
ba46c7
+				}
ba46c7
 			}
ba46c7
 			# sort the new hash of $badPassword{}
ba46c7
 			my $bpTotal = 0;
ba46c7
@@ -961,7 +924,7 @@ if ($verb eq "yes" || $usage =~ /f/ ){
ba46c7
 			}
ba46c7
 			print "\nFrom the IP address(s) :\n\n";
ba46c7
 			for (my $i=0; $i<$badPwdCount; $i++) {
ba46c7
-				print "\t\t$badPasswordIp->[$i]\n";
ba46c7
+				print "\t\t$badPasswordIp[$i]\n";
ba46c7
 			}
ba46c7
 			if ($bpTotal > $badPwdCount){
ba46c7
 				print "\n** Warning : Wrongly reported failed login attempts : ". ($bpTotal - $badPwdCount) . "\n";
ba46c7
@@ -982,11 +945,11 @@ if ($connCodeCount > 0){
ba46c7
 		print "\n\n----- Total Connection Codes -----\n\n";
ba46c7
 		my $conncount = $hashes->{conncount};
ba46c7
 		my @conntext;
ba46c7
-	  	foreach my $key (sort { $conncount->{$b} <=> $conncount->{$a} } keys %{$conncount}) {
ba46c7
-		  	if ($conncount->{$key} > 0){
ba46c7
+		foreach my $key (sort { $conncount->{$b} <=> $conncount->{$a} } keys %{$conncount}) {
ba46c7
+			if ($conncount->{$key} > 0){
ba46c7
 				push @conntext, sprintf "%-4s %6s   %-40s\n",$key,$conncount->{$key},$connmsg{ $key };
ba46c7
-		  	}
ba46c7
-	  	}
ba46c7
+			}
ba46c7
+		}
ba46c7
 		print @conntext;
ba46c7
 	}
ba46c7
 }
ba46c7
@@ -1005,8 +968,8 @@ if ($usage =~ /i/i || $verb eq "yes"){
ba46c7
 	my $ip_count = ($#ipkeys + 1)-($#exxCount + 1);
ba46c7
 	my $ccount = 0;
ba46c7
 	if ($ip_count > 0){
ba46c7
-	 	print "\n\n----- Top $sizeCount Clients -----\n\n";
ba46c7
-	 	print "Number of Clients:  $ip_count\n\n";
ba46c7
+		print "\n\n----- Top $sizeCount Clients -----\n\n";
ba46c7
+		print "Number of Clients:  $ip_count\n\n";
ba46c7
 		foreach my $key (sort { $ip_hash->{$b} <=> $ip_hash->{$a} } @ipkeys) {
ba46c7
 			my $exc = "no";
ba46c7
 			if ($ccount > $sizeCount){ last;}
ba46c7
@@ -1021,7 +984,7 @@ if ($usage =~ /i/i || $verb eq "yes"){
ba46c7
 				my %counts;
ba46c7
 				map { $counts{$_} = $hashes->{$_}->{$key} if (defined($hashes->{$_}->{$key})) } @conncodes;
ba46c7
 				foreach my $code (sort { $counts{$b} <=> $counts{$a} } keys %counts) {
ba46c7
-		 			if ($code eq 'count' ) { next; }
ba46c7
+					if ($code eq 'count' ) { next; }
ba46c7
 					printf "%10s - %s (%s)\n", $counts{ $code }, $code, $connmsg{ $code };
ba46c7
 				}
ba46c7
 				print "\n";
ba46c7
@@ -1042,14 +1005,14 @@ if ($usage =~ /b/i || $verb eq "yes"){
ba46c7
 	my $bind_count = $#bindkeys + 1;
ba46c7
 	if ($bind_count > 0){
ba46c7
 		print "\n\n----- Top $sizeCount Bind DN's -----\n\n";
ba46c7
-		print "Number of Unique Bind DN's: $bind_count\n\n"; 
ba46c7
+		print "Number of Unique Bind DN's: $bind_count\n\n";
ba46c7
 		my $bindcount = 0;
ba46c7
 		foreach my $dn (sort { $bindlist->{$b} <=> $bindlist->{$a} } @bindkeys) {
ba46c7
-            if ($bindcount < $sizeCount){
ba46c7
+			if ($bindcount < $sizeCount){
ba46c7
 				printf "%-8s        %-40s\n", $bindlist->{ $dn },$dn;
ba46c7
 			} else {
ba46c7
-                last;
ba46c7
-            }
ba46c7
+				last;
ba46c7
+			}
ba46c7
 			$bindcount++;
ba46c7
 		}
ba46c7
 	}
ba46c7
@@ -1070,16 +1033,16 @@ if ($usage =~ /a/i || $verb eq "yes"){
ba46c7
 		print "Number of Unique Search Bases: $base_count\n\n";
ba46c7
 		my $basecount = 0;
ba46c7
 		foreach my $bas (sort { $base->{$b} <=> $base->{$a} } @basekeys) {
ba46c7
-		        if ($basecount < $sizeCount){
ba46c7
-                    printf "%-8s        %-40s\n", $base->{ $bas },$bas;
ba46c7
-		        } else {
ba46c7
-                    last;
ba46c7
-                }
ba46c7
-		        $basecount++;
ba46c7
+			if ($basecount < $sizeCount){
ba46c7
+				printf "%-8s        %-40s\n", $base->{ $bas },$bas;
ba46c7
+			} else {
ba46c7
+				last;
ba46c7
+			}
ba46c7
+			$basecount++;
ba46c7
 		}
ba46c7
 	}
ba46c7
 }
ba46c7
- 
ba46c7
+
ba46c7
 #########################################
ba46c7
 #                                       #
ba46c7
 #   Gather and process search filters   #
ba46c7
@@ -1091,15 +1054,15 @@ if ($usage =~ /l/ || $verb eq "yes"){
ba46c7
 	my @filterkeys = keys %{$filter};
ba46c7
 	my $filter_count = $#filterkeys + 1;
ba46c7
 	if ($filter_count > 0){
ba46c7
-		print "\n\n----- Top $sizeCount Search Filters -----\n";  
ba46c7
+		print "\n\n----- Top $sizeCount Search Filters -----\n";
ba46c7
 		print "\nNumber of Unique Search Filters: $filter_count\n\n";
ba46c7
 		my $filtercount = 0;
ba46c7
 		foreach my $filt (sort { $filter->{$b} <=> $filter->{$a} } @filterkeys){
ba46c7
 			if ($filtercount < $sizeCount){
ba46c7
 				printf "%-8s        %-40s\n", $filter->{$filt}, $filt;
ba46c7
 			} else {
ba46c7
-                last;
ba46c7
-            }
ba46c7
+				last;
ba46c7
+			}
ba46c7
 			$filtercount++;
ba46c7
 		}
ba46c7
 	}
ba46c7
@@ -1108,7 +1071,7 @@ if ($usage =~ /l/ || $verb eq "yes"){
ba46c7
 #########################################
ba46c7
 #                                       #
ba46c7
 # Gather and Process the unique etimes  #
ba46c7
-#                                       # 
ba46c7
+#                                       #
ba46c7
 #########################################
ba46c7
 
ba46c7
 my $first;
ba46c7
@@ -1139,7 +1102,7 @@ if ($usage =~ /t/i || $verb eq "yes"){
ba46c7
 		if ($eloop == $sizeCount) { last; }
ba46c7
 		printf "%-12s    %-10s\n","etime=$et",$etime->{ $et };
ba46c7
 		$eloop++;
ba46c7
-	}   
ba46c7
+	}
ba46c7
 }
ba46c7
 
ba46c7
 #######################################
ba46c7
@@ -1156,7 +1119,7 @@ if ($usage =~ /n/i || $verb eq "yes"){
ba46c7
 	my $eloop = 0;
ba46c7
 	foreach my $nentry (sort { $b <=> $a } @nkeys){
ba46c7
 		if ($eloop == $sizeCount) { last; }
ba46c7
-	    	printf "%-18s   %12s\n","nentries=$nentry", $nentries->{ $nentry };
ba46c7
+		printf "%-18s   %12s\n","nentries=$nentry", $nentries->{ $nentry };
ba46c7
 		$eloop++;
ba46c7
 	}
ba46c7
 	print "\n\n----- Top $sizeCount Most returned nentries -----\n\n";
ba46c7
@@ -1216,7 +1179,7 @@ if ($usage =~ /x/i || $verb eq "yes"){
ba46c7
 }
ba46c7
 
ba46c7
 ############################################
ba46c7
-#                                          #	
ba46c7
+#                                          #
ba46c7
 # Print most commonly requested attributes #
ba46c7
 #                                          #
ba46c7
 ############################################
ba46c7
@@ -1235,7 +1198,7 @@ if ($usage =~ /r/i || $verb eq "yes"){
ba46c7
 }
ba46c7
 
ba46c7
 #############################
ba46c7
-#                           # 
ba46c7
+#                           #
ba46c7
 # abandoned operation stats #
ba46c7
 #                           #
ba46c7
 #############################
ba46c7
@@ -1244,66 +1207,49 @@ if ($usage =~ /g/i || $verb eq "yes"){
ba46c7
 	my $abandonTotal = $srchCount + $delCount + $modCount + $addCount + $modrdnCount + $bindCount + $extopCount + $cmpCount;
ba46c7
 	if ($verb eq "yes" && $abandonCount > 0 && $abandonTotal > 0){
ba46c7
 		my $conn_hash = $hashes->{conn_hash};
ba46c7
+		my $abandon_conn_op = $hashes->{abandon_conn_op};
ba46c7
+		my $srch_conn_op = $hashes->{srch_conn_op};
ba46c7
+		my $del_conn_op = $hashes->{del_conn_op};
ba46c7
+		my $add_conn_op = $hashes->{add_conn_op};
ba46c7
+		my $mod_conn_op = $hashes->{mod_conn_op};
ba46c7
+		my $cmp_conn_op = $hashes->{cmp_conn_op};
ba46c7
+		my $mdn_conn_op = $hashes->{mdn_conn_op};
ba46c7
+		my $bind_conn_op = $hashes->{bind_conn_op};
ba46c7
+		my $unbind_conn_op = $hashes->{unbind_conn_op};
ba46c7
+		my $ext_conn_op = $hashes->{ext_conn_op};
ba46c7
 
ba46c7
 		print "\n\n----- Abandon Request Stats -----\n\n";
ba46c7
 
ba46c7
-		for (my $g = 0; $g < $abandonCount; $g++){
ba46c7
-			my $conn = $arrays->{targetconn}->[$g];
ba46c7
-			my $op = $arrays->{targetop}->[$g];
ba46c7
-			my $msgid = $arrays->{msgid}->[$g];
ba46c7
-			for (my $sc = 0; $sc < $srchCount; $sc++){
ba46c7
-				if (($arrays->{srchconn}->[$sc] && $arrays->{srchop}->[$sc]) && 
ba46c7
-				    ($arrays->{srchconn}->[$sc] eq $conn && $arrays->{srchop}->[$sc] eq $op )){
ba46c7
-					print " - SRCH conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";	
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $dc = 0; $dc < $delCount; $dc++){
ba46c7
-				if (($arrays->{delconn}->[$dc] && $arrays->{delop}->[$dc]) &&
ba46c7
-				    ($arrays->{delconn}->[$dc] eq $conn && $arrays->{delop}->[$dc] eq $op)){
ba46c7
-					print " - DEL  conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $adc = 0; $adc < $addCount; $adc++){
ba46c7
-				if (($arrays->{addconn}->[$adc] && $arrays->{addop}->[$adc]) &&
ba46c7
-				    ($arrays->{addconn}->[$adc] eq $conn && $arrays->{addop}->[$adc] eq $op)){
ba46c7
-					print " - ADD  conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $mc = 0; $mc < $modCount; $mc++){
ba46c7
-				if (($arrays->{modconn}->[$mc] && $arrays->{modop}->[$mc]) &&
ba46c7
-				    ($arrays->{modconn}->[$mc] eq $conn && $arrays->{modop}->[$mc] eq $op)){
ba46c7
-					print " - MOD  conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $cc = 0; $cc < $cmpCount; $cc++){
ba46c7
-				if (($arrays->{cmpconn}->[$cc] && $arrays->{cmpop}->[$cc]) &&
ba46c7
-				    ($arrays->{cmpconn}->[$cc] eq $conn && $arrays->{cmpop}->[$cc] eq $op)){
ba46c7
-					print " - CMP  conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $mdc = 0; $mdc < $modrdnCount; $mdc++){
ba46c7
-				if (($arrays->{modrdnconn}->[$mdc] && $arrays->{modrdnop}->[$mdc]) &&
ba46c7
-				    ($arrays->{modrdnconn}->[$mdc] eq $conn && $arrays->{modrdnop}->[$mdc] eq $op)){
ba46c7
-					print " - MODRDN conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $bcb = 0; $bcb < $bindCount; $bcb++){
ba46c7
-				if (($arrays->{bindconn}->[$bcb] && $arrays->{bindop}->[$bcb]) &&
ba46c7
-				    ($arrays->{bindconn}->[$bcb] eq $conn && $arrays->{bindop}->[$bcb] eq $op)){
ba46c7
-					print " - BIND conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
-			}
ba46c7
-			for (my $ubc = 0; $ubc < $unbindCount; $ubc++){
ba46c7
-				if (($arrays->{unbindconn}->[$ubc] && $arrays->{unbindop}->[$ubc]) &&
ba46c7
-				    ($arrays->{unbindconn}->[$ubc] eq $conn && $arrays->{unbindop}->[$ubc] eq $op)){
ba46c7
-					print " - UNBIND conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
+		while (my ($conn_op, $targ_msgid) = each %{$abandon_conn_op}) {
ba46c7
+			my ($conn, $op) = split(",", $conn_op);
ba46c7
+			my ($targetop, $msgid) = split(",", $targ_msgid);
ba46c7
+			my $conn_targ = "$conn,$targetop";
ba46c7
+			my $clientIP;
ba46c7
+			if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) {
ba46c7
+				$clientIP = $conn_hash->{$conn};
ba46c7
+			} else {
ba46c7
+				$clientIP = "Unknown";
ba46c7
 			}
ba46c7
-			for (my $ec = 0; $ec < $extopCount; $ec++){
ba46c7
-				if (($arrays->{extconn}->[$ec] && $arrays->{extop}->[$ec]) &&
ba46c7
-				    ($arrays->{extconn}->[$ec] eq $conn && $arrays->{extop}->[$ec] eq $op)){
ba46c7
-					print " - EXT  conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n";
ba46c7
-				}
ba46c7
+			if (exists($srch_conn_op->{$conn_targ}) && defined($srch_conn_op->{$conn_targ})) {
ba46c7
+				print " - SRCH conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($del_conn_op->{$conn_targ}) && defined($del_conn_op->{$conn_targ})) {
ba46c7
+				print " - DEL  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($add_conn_op->{$conn_targ}) && defined($add_conn_op->{$conn_targ})) {
ba46c7
+				print " - ADD  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($mod_conn_op->{$conn_targ}) && defined($mod_conn_op->{$conn_targ})) {
ba46c7
+				print " - MOD  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($cmp_conn_op->{$conn_targ}) && defined($cmp_conn_op->{$conn_targ})) {
ba46c7
+				print " - CMP  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($mdn_conn_op->{$conn_targ}) && defined($mdn_conn_op->{$conn_targ})) {
ba46c7
+				print " - MODRDN conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($bind_conn_op->{$conn_targ}) && defined($bind_conn_op->{$conn_targ})) {
ba46c7
+				print " - BIND conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($unbind_conn_op->{$conn_targ}) && defined($unbind_conn_op->{$conn_targ})) {
ba46c7
+				print " - UNBIND conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} elsif (exists($ext_conn_op->{$conn_targ}) && defined($ext_conn_op->{$conn_targ})) {
ba46c7
+				print " - EXT  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
+			} else {
ba46c7
+				print " - UNKNOWN conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
ba46c7
 			}
ba46c7
 		}
ba46c7
 	}
ba46c7
@@ -1390,8 +1336,8 @@ sub displayUsage {
ba46c7
 	print "Usage:\n\n";
ba46c7
 
ba46c7
 	print " ./logconv.pl [-h] [-d|--rootdn <rootDN>] [-s|--sizeLimit <size limit>] [-v|verison] [-Vi|verbose]\n";
ba46c7
-	print " [-S|--startTime <start time>] [-E|--endTime <end time>] \n"; 
ba46c7
-	print " [-efcibaltnxrgjuyp] [ access log ... ... ]\n\n"; 
ba46c7
+	print " [-S|--startTime <start time>] [-E|--endTime <end time>] \n";
ba46c7
+	print " [-efcibaltnxrgjuyp] [ access log ... ... ]\n\n";
ba46c7
 
ba46c7
 	print "- Commandline Switches:\n\n";
ba46c7
 
ba46c7
@@ -1400,7 +1346,7 @@ sub displayUsage {
ba46c7
 	print "         -D, --data         <Location for temporary data files>  default is \"/tmp\"\n";    
ba46c7
 	print "         -s, --sizeLimit    <Number of results to return per catagory>  default is 20\n";
ba46c7
 	print "         -X, --excludeIP    <IP address to exclude from connection stats>  E.g. Load balancers\n";
ba46c7
-	print "         -v, --version      show version of tool\n"; 
ba46c7
+	print "         -v, --version      show version of tool\n";
ba46c7
 	print "         -S, --startTime    <time to begin analyzing logfile from>\n";
ba46c7
 	print "             E.g. \"[28/Mar/2002:13:14:22 -0800]\"\n";
ba46c7
 	print "         -E, --endTime      <time to stop analyzing logfile>\n";
ba46c7
@@ -1450,7 +1396,7 @@ sub displayUsage {
ba46c7
 sub
ba46c7
 parseLine {
ba46c7
 	if($reportBinds eq "yes"){
ba46c7
-		&parseLineBind();		
ba46c7
+		&parseLineBind();
ba46c7
 	} else {
ba46c7
 		&parseLineNormal();
ba46c7
 	}
ba46c7
@@ -1469,26 +1415,26 @@ parseLineBind {
ba46c7
 	return if $_ =~ /^\s/;
ba46c7
 
ba46c7
 	if($firstFile == 1 && $_ =~ /^\[/){
ba46c7
-        	$start = $_;
ba46c7
-        	if ($start =~ / *([0-9a-z:\/]+)/i){$start=$1;}
ba46c7
-        	$firstFile = 0;
ba46c7
+		$start = $_;
ba46c7
+		if ($start =~ / *([0-9a-z:\/]+)/i){$start=$1;}
ba46c7
+		$firstFile = 0;
ba46c7
 	}
ba46c7
 	if ($endFlag != 1 && $_ =~ /^\[/ && $_ =~ / *([0-9a-z:\/]+)/i){
ba46c7
 		$end =$1;
ba46c7
 	}
ba46c7
 	if ($startTime && !$startFlag) {
ba46c7
-        	if (index($_, $startTime) == 0) {
ba46c7
-                	$startFlag = 1;
ba46c7
-                	($start) = $startTime =~ /\D*(\S*)/;
ba46c7
-        	} else {
ba46c7
-                	return;
ba46c7
-        	}
ba46c7
+		if (index($_, $startTime) == 0) {
ba46c7
+			$startFlag = 1;
ba46c7
+			($start) = $startTime =~ /\D*(\S*)/;
ba46c7
+		} else {
ba46c7
+			return;
ba46c7
+		}
ba46c7
 	}
ba46c7
 	if ($endTime && !$endFlag) {
ba46c7
-        	if (index($_, $endTime) == 0) {
ba46c7
-                	$endFlag = 1;
ba46c7
-                	($end) = $endTime =~ /\D*(\S*)/;
ba46c7
-        	}
ba46c7
+		if (index($_, $endTime) == 0) {
ba46c7
+			$endFlag = 1;
ba46c7
+			($end) = $endTime =~ /\D*(\S*)/;
ba46c7
+		}
ba46c7
 	}
ba46c7
 	if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ) {
ba46c7
 		my $skip = "yes";
ba46c7
@@ -1497,8 +1443,8 @@ parseLineBind {
ba46c7
 				$skip = "yes";
ba46c7
 				last;
ba46c7
 			}
ba46c7
-                }
ba46c7
-                if ($skip eq "yes"){
ba46c7
+		}
ba46c7
+		if ($skip eq "yes"){
ba46c7
 			return ;
ba46c7
 		}
ba46c7
 		$ip = $1;
ba46c7
@@ -1507,9 +1453,9 @@ parseLineBind {
ba46c7
 		}
ba46c7
 		return;
ba46c7
 	}
ba46c7
- 	if (/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
ba46c7
+	if (/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
ba46c7
 		my $dn;
ba46c7
-        	if ($1 eq ""){
ba46c7
+		if ($1 eq ""){
ba46c7
 			$dn = "Anonymous";
ba46c7
 		} else {
ba46c7
 			$dn = $1;
ba46c7
@@ -1522,7 +1468,7 @@ parseLineBind {
ba46c7
 			}
ba46c7
 		}
ba46c7
 		$bindReport{$dn}{"binds"}++;
ba46c7
-        	if ($bindReport{$dn}{"binds"} == 1){
ba46c7
+		if ($bindReport{$dn}{"binds"} == 1){
ba46c7
 			# For hashes we need to init the counters
ba46c7
 			$bindReport{$dn}{"srch"} = 0;
ba46c7
 			$bindReport{$dn}{"add"} = 0;
ba46c7
@@ -1537,7 +1483,7 @@ parseLineBind {
ba46c7
 			$bindReport{$dn}{"conn"} = $bindReport{$dn}{"conn"} . " $1 ";
ba46c7
 		}
ba46c7
 		return;
ba46c7
- 	}
ba46c7
+	}
ba46c7
 	if (/ RESULT err=49 /){
ba46c7
 		processOpForBindReport("failedBind",$logline);
ba46c7
 	}
ba46c7
@@ -1547,7 +1493,7 @@ parseLineBind {
ba46c7
 		processOpForBindReport("add",$logline);
ba46c7
 	} elsif (/ MOD dn=/){
ba46c7
 		processOpForBindReport("mod",$logline);
ba46c7
-	} elsif (/ DEL dn=/){                
ba46c7
+	} elsif (/ DEL dn=/){
ba46c7
 		processOpForBindReport("del",$logline);
ba46c7
 	} elsif (/ MODRDN dn=/){
ba46c7
 		processOpForBindReport("modrdn",$logline);
ba46c7
@@ -1555,7 +1501,7 @@ parseLineBind {
ba46c7
 		processOpForBindReport("cmp",$logline);
ba46c7
 	} elsif (/ EXT oid=/){
ba46c7
 		processOpForBindReport("ext",$logline);
ba46c7
-	} 
ba46c7
+	}
ba46c7
 }
ba46c7
 
ba46c7
 sub
ba46c7
@@ -1625,13 +1571,13 @@ sub parseLineNormal
ba46c7
 
ba46c7
 		if(!defined($lastzone) or $tzone ne $lastzone)
ba46c7
 		{
ba46c7
-		    # tz offset change
ba46c7
-		    $lastzone=$tzone;
ba46c7
-		    my ($sign,$hr,$min) = $tzone =~ m/(.)(\d\d)(\d\d)/;
ba46c7
-		    $tzoff = $hr*3600 + $min*60;
ba46c7
-		    $tzoff *= -1
ba46c7
-		    if $sign eq '-';
ba46c7
-		    # to be subtracted from converted values.
ba46c7
+			# tz offset change
ba46c7
+			$lastzone=$tzone;
ba46c7
+			my ($sign,$hr,$min) = $tzone =~ m/(.)(\d\d)(\d\d)/;
ba46c7
+			$tzoff = $hr*3600 + $min*60;
ba46c7
+			$tzoff *= -1
ba46c7
+				if $sign eq '-';
ba46c7
+			# to be subtracted from converted values.
ba46c7
 		}
ba46c7
 		my ($date, $hr, $min, $sec) = split (':', $time);
ba46c7
 		my ($day, $mon, $yr) = split ('/', $date);
ba46c7
@@ -1641,15 +1587,15 @@ sub parseLineNormal
ba46c7
 		reset_stats_block( $s_stats, $gmtime, $time.' '.$tzone );
ba46c7
 		if (!defined($last_min) or $newmin != $last_min)
ba46c7
 		{
ba46c7
-		    print_stats_block( $m_stats );
ba46c7
-		    $time =~ s/\d\d$/00/;
ba46c7
-		    reset_stats_block( $m_stats, $newmin, $time.' '.$tzone );
ba46c7
-		    $last_min = $newmin;
ba46c7
+			print_stats_block( $m_stats );
ba46c7
+			$time =~ s/\d\d$/00/;
ba46c7
+			reset_stats_block( $m_stats, $newmin, $time.' '.$tzone );
ba46c7
+			$last_min = $newmin;
ba46c7
 		}
ba46c7
 	}
ba46c7
 
ba46c7
-	if (m/ RESULT err/){ 
ba46c7
-		$allResults++; 
ba46c7
+	if (m/ RESULT err/){
ba46c7
+		$allResults++;
ba46c7
 		if($reportStats){ inc_stats('results',$s_stats,$m_stats); }
ba46c7
 	}
ba46c7
 	if (m/ SRCH/){
ba46c7
@@ -1666,58 +1612,57 @@ sub parseLineNormal
ba46c7
 			$anyAttrs++;
ba46c7
 		}
ba46c7
 		if ($verb eq "yes"){
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{srchconn}}, $1;}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{srchop}}, $1;}
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{srch_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ DEL/){
ba46c7
 		$delCount++;
ba46c7
 		if($reportStats){ inc_stats('del',$s_stats,$m_stats); }
ba46c7
 		if ($verb eq "yes"){
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{delconn}}, $1;}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{delop}}, $1;}
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{del_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ MOD dn=/){
ba46c7
 		$modCount++;
ba46c7
 		if($reportStats){ inc_stats('mod',$s_stats,$m_stats); }
ba46c7
 		if ($verb eq "yes"){
ba46c7
-		        if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{modconn}}, $1;}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{modop}}, $1; }
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{mod_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ ADD/){
ba46c7
 		$addCount++;
ba46c7
 		if($reportStats){ inc_stats('add',$s_stats,$m_stats); }
ba46c7
 		if ($verb eq "yes"){
ba46c7
-		        if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{addconn}}, $1; }
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{addop}}, $1; }
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{add_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ MODRDN/){
ba46c7
 		$modrdnCount++;
ba46c7
 		if($reportStats){ inc_stats('modrdn',$s_stats,$m_stats); }
ba46c7
 		if ($verb eq "yes"){
ba46c7
-		        if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{modrdnconn}}, $1; }
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{modrdnop}}, $1; }
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{mdn_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ CMP dn=/){
ba46c7
 		$cmpCount++;
ba46c7
 		if($reportStats){ inc_stats('cmp',$s_stats,$m_stats); }
ba46c7
 		if ($verb eq "yes"  || $usage =~ /g/i){
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{cmpconn}}, $1;}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{cmpop}}, $1;}
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{cmp_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ ABANDON /){
ba46c7
+		# there are two cases for abandon
ba46c7
+		# [17/Sep/2013:01:52:11 -0400] conn=1482074 op=4 ABANDON targetop=3 msgid=4
ba46c7
+		# [17/Sep/2013:01:52:11 -0400] conn=1482074 op=4 ABANDON targetop=NOTFOUND msgid=4
ba46c7
+		# if the op to be abandoned completes before the abandon request can be processed
ba46c7
+		# the server will use NOTFOUND as the op number
ba46c7
 		$abandonCount++;
ba46c7
 		if($reportStats){ inc_stats('abandon',$s_stats,$m_stats); }
ba46c7
 		$allResults++;
ba46c7
-		if ($_ =~ /targetop= *([0-9a-zA-Z]+)/i ){
ba46c7
-			push @{$arrays->{targetop}}, $1;
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{targetconn}}, $1; }
ba46c7
-			if ($_ =~ /msgid= *([0-9\-]+)/i){ push @{$arrays->{msgid}}, $1; }
ba46c7
+		if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+) +ABANDON +targetop= *([0-9a-zA-Z]+) +msgid= *([0-9\-]+)/i ){
ba46c7
+			# abandon_conn_op - key is the conn,op of the ABANDON request
ba46c7
+			# the value is the targetop,msgid of the ABANDON request
ba46c7
+			$hashes->{abandon_conn_op}->{"$1,$2"} = "$3,$4"; # targetop,msgid
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ VLV /){
ba46c7
@@ -1738,11 +1683,11 @@ sub parseLineNormal
ba46c7
 		$autobindCount++;
ba46c7
 		$bindCount++;
ba46c7
 		if($reportStats){ inc_stats('bind',$s_stats,$m_stats); }
ba46c7
-		if ($1 ne ""){ 
ba46c7
+		if ($1 ne ""){
ba46c7
 			$tmpp = $1;
ba46c7
 			$tmpp =~ tr/A-Z/a-z/;
ba46c7
 			$hashes->{bindlist}->{$tmpp}++;
ba46c7
-			if($1 eq $rootDN){ 
ba46c7
+			if($1 eq $rootDN){
ba46c7
 				$rootDNBindCount++;
ba46c7
 			}
ba46c7
 		} else {
ba46c7
@@ -1752,7 +1697,7 @@ sub parseLineNormal
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ connection from/){
ba46c7
-		if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ){ 
ba46c7
+		if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ){
ba46c7
 			for (my $xxx =0; $xxx < $#excludeIP; $xxx++){
ba46c7
 				if ($excludeIP[$xxx] eq $1){$exc = "yes";}
ba46c7
 			}
ba46c7
@@ -1763,7 +1708,7 @@ sub parseLineNormal
ba46c7
 		}
ba46c7
 		$simConnection++;
ba46c7
 		if ($simConnection > $maxsimConnection) {
ba46c7
-		 	$maxsimConnection = $simConnection;
ba46c7
+			$maxsimConnection = $simConnection;
ba46c7
 		}
ba46c7
 		($connID) = $_ =~ /conn=(\d*)\s/;
ba46c7
 		$openConnection[$connID]++;
ba46c7
@@ -1772,7 +1717,7 @@ sub parseLineNormal
ba46c7
 			my ($date, $hr, $min, $sec) = split (':', $time);
ba46c7
 			my ($day, $mon, $yr) = split ('/', $date);
ba46c7
 			$day =~ s/\[//;
ba46c7
-			$start_time_of_connection[$connID] = timegm($sec, $min, $hr, $day, $monthname{$mon}, $yr);
ba46c7
+			$hashes->{start_time_of_connection}->{$connID} = timegm($sec, $min, $hr, $day, $monthname{$mon}, $yr);
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ SSL client bound as /){$sslClientBindCount++;}
ba46c7
@@ -1788,10 +1733,10 @@ sub parseLineNormal
ba46c7
 			# if we didn't see the start time of this connection
ba46c7
 			# i.e. due to truncation or log rotation
ba46c7
 			# then just set to 0
ba46c7
-			my $stoc = $start_time_of_connection[$connID] || 0;
ba46c7
-			$end_time_of_connection[$connID] = $gmtime || 0;
ba46c7
-			my $diff = $end_time_of_connection[$connID] - $stoc;
ba46c7
-			$start_time_of_connection[$connID] =  $end_time_of_connection[$connID] = 0;
ba46c7
+			my $stoc = $hashes->{start_time_of_connection}->{$connID} || 0;
ba46c7
+			$hashes->{end_time_of_connection}->{$connID} = $gmtime || 0;
ba46c7
+			my $diff = $hashes->{end_time_of_connection}->{$connID} - $stoc;
ba46c7
+			$hashes->{start_time_of_connection}->{$connID} = $hashes->{end_time_of_connection}->{$connID} = 0;
ba46c7
 			if ($diff <= 1) { $latency[0]++;}
ba46c7
 			if ($diff == 2) { $latency[1]++;}
ba46c7
 			if ($diff == 3) { $latency[2]++;}
ba46c7
@@ -1802,85 +1747,82 @@ sub parseLineNormal
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
ba46c7
+		my $binddn = $1;
ba46c7
 		if($reportStats){ inc_stats('bind',$s_stats,$m_stats); }
ba46c7
 		$bindCount++;
ba46c7
-		if ($1 ne ""){ 
ba46c7
-			if($1 eq $rootDN){$rootDNBindCount++;}
ba46c7
-			$tmpp = $1;
ba46c7
+		my ($conn, $op);
ba46c7
+		if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){
ba46c7
+			$conn = $1;
ba46c7
+			$op = $2;
ba46c7
+		}
ba46c7
+		if ($binddn ne ""){
ba46c7
+			if($binddn eq $rootDN){$rootDNBindCount++;}
ba46c7
+			$tmpp = $binddn;
ba46c7
 			$tmpp =~ tr/A-Z/a-z/;
ba46c7
 			$hashes->{bindlist}->{$tmpp}++;
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i) { push @{$arrays->{bindconn}}, $1;}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i) { push @{$arrays->{bindop}}, $1;}
ba46c7
 			if($usage =~ /f/ || $verb eq "yes"){
ba46c7
-				push @{$arrays->{binddn}}, $tmpp;
ba46c7
+				$hashes->{bind_conn_op}->{"$conn,$op"} = $tmpp;
ba46c7
 			}
ba46c7
 		} else {
ba46c7
 			$anonymousBindCount++;
ba46c7
 			$hashes->{bindlist}->{"Anonymous Binds"}++;
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i) { push @{$arrays->{bindconn}}, $1;}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i) { push @{$arrays->{bindop}}, $1;}
ba46c7
-			push @{$arrays->{binddn}}, "";
ba46c7
+			if($usage =~ /f/ || $verb eq "yes"){
ba46c7
+				$hashes->{bind_conn_op}->{"$conn,$op"} = "";
ba46c7
+			}
ba46c7
 			inc_stats('anonbind',$s_stats,$m_stats);
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (m/ UNBIND/){
ba46c7
 		$unbindCount++;
ba46c7
 		if ($verb eq "yes"){
ba46c7
-		        if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{unbindconn}}, $1; }
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{unbindop}}, $1; }
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{unbind_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
-	if (m/ RESULT err=/ && m/ notes=P/){
ba46c7
+	if (m/ RESULT err=/ && m/ notes=[A-Z,]*P/){
ba46c7
 		$pagedSearchCount++;
ba46c7
 	}
ba46c7
-	if (m/ notes=A/){
ba46c7
+	if (m/ notes=[A-Z,]*A/){
ba46c7
 		$con = "";
ba46c7
 		if ($_ =~ /conn= *([0-9A-Z]+)/i){
ba46c7
-		        $con = $1;
ba46c7
-		        if ($_ =~ /op= *([0-9\-]+)/i){ $op = $1;}
ba46c7
+			$con = $1;
ba46c7
+			if ($_ =~ /op= *([0-9\-]+)/i){ $op = $1;}
ba46c7
 		}
ba46c7
 		for (my $i=0; $i < $vlvCount;$i++){
ba46c7
-		        if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesACount++; $isVlvNotes="1";}
ba46c7
+			if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesACount++; $isVlvNotes="1";}
ba46c7
 		}
ba46c7
 		if($isVlvNotes == 0){
ba46c7
 			#  We don't want to record vlv unindexed searches for our regular "bad" 
ba46c7
 			#  unindexed search stat, as VLV unindexed searches aren't that bad
ba46c7
 			$unindexedSrchCountNotesA++;
ba46c7
 			if($reportStats){ inc_stats('notesA',$s_stats,$m_stats); }
ba46c7
-		}
ba46c7
-		if ($usage =~ /u/ || $verb eq "yes"){
ba46c7
-			if ($isVlvNotes == 0 ){
ba46c7
-		        	if ($_ =~ /etime= *([0-9.]+)/i ){ push @{$arrays->{notesAetime}}, $1; }
ba46c7
-		        	if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{notesAconn}}, $1; }
ba46c7
-		        	if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{notesAop}}, $1; }
ba46c7
-		        	if ($_ =~ / *([0-9a-z:\/]+)/i){ push @{$arrays->{notesAtime}}, $1; }
ba46c7
-				if ($_ =~ /nentries= *([0-9]+)/i ){ push @{$arrays->{notesAnentries}}, $1; }
ba46c7
+			if ($usage =~ /u/ || $verb eq "yes"){
ba46c7
+				$hashes->{notesa_conn_op}->{"$con,$op"}++;
ba46c7
+				if ($_ =~ /etime= *([0-9.]+)/i ){ $hashes->{etime_conn_op}->{"$con,$op"} = $1; }
ba46c7
+				if ($_ =~ / *([0-9a-z:\/]+)/i){ $hashes->{time_conn_op}->{"$con,$op"} = $1; }
ba46c7
+				if ($_ =~ /nentries= *([0-9]+)/i ){ $hashes->{nentries_conn_op}->{"$con,$op"} = $1; }
ba46c7
 			}
ba46c7
 		}
ba46c7
 		$isVlvNotes = 0;
ba46c7
 	}
ba46c7
-	if (m/ notes=U/){
ba46c7
+	if (m/ notes=[A-Z,]*U/){
ba46c7
 		$con = "";
ba46c7
 		if ($_ =~ /conn= *([0-9A-Z]+)/i){
ba46c7
-		        $con = $1;
ba46c7
-		        if ($_ =~ /op= *([0-9\-]+)/i){ $op = $1;}
ba46c7
+			$con = $1;
ba46c7
+			if ($_ =~ /op= *([0-9\-]+)/i){ $op = $1;}
ba46c7
 		}
ba46c7
 		for (my $i=0; $i < $vlvCount;$i++){
ba46c7
-		        if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesUCount++; $isVlvNotes="1";}
ba46c7
+			if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesUCount++; $isVlvNotes="1";}
ba46c7
 		}
ba46c7
 		if($isVlvNotes == 0){
ba46c7
 			#  We don't want to record vlv unindexed searches for our regular "bad" 
ba46c7
 			#  unindexed search stat, as VLV unindexed searches aren't that bad
ba46c7
 			$unindexedSrchCountNotesU++;
ba46c7
 			if($reportStats){ inc_stats('notesU',$s_stats,$m_stats); }
ba46c7
-		}
ba46c7
-		if ($usage =~ /u/ || $verb eq "yes"){
ba46c7
-			if ($isVlvNotes == 0 ){
ba46c7
-		        	if ($_ =~ /etime= *([0-9.]+)/i ){ push @{$arrays->{notesUetime}}, $1; }
ba46c7
-		        	if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{notesUconn}}, $1; }
ba46c7
-		        	if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{notesUop}}, $1; }
ba46c7
-		        	if ($_ =~ / *([0-9a-z:\/]+)/i){ push @{$arrays->{notesUtime}}, $1; }
ba46c7
-				if ($_ =~ /nentries= *([0-9]+)/i ){ push @{$arrays->{notesUnentries}}, $1; }
ba46c7
+			if ($usage =~ /u/ || $verb eq "yes"){
ba46c7
+				$hashes->{notesu_conn_op}->{"$con,$op"}++;
ba46c7
+				if ($_ =~ /etime= *([0-9.]+)/i ){ $hashes->{etime_conn_op}->{"$con,$op"} = $1; }
ba46c7
+				if ($_ =~ / *([0-9a-z:\/]+)/i){ $hashes->{time_conn_op}->{"$con,$op"} = $1; }
ba46c7
+				if ($_ =~ /nentries= *([0-9]+)/i ){ $hashes->{nentries_conn_op}->{"$con,$op"} = $1; }
ba46c7
 			}
ba46c7
 		}
ba46c7
 		$isVlvNotes = 0;
ba46c7
@@ -1941,8 +1883,8 @@ sub parseLineNormal
ba46c7
 			}
ba46c7
 			$ip = $1;
ba46c7
 			$hashes->{ip_hash}->{$ip}++;
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i ){ 
ba46c7
-				if ($exc ne "yes"){	
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+)/i ){
ba46c7
+				if ($exc ne "yes"){
ba46c7
 					$hashes->{conn_hash}->{$1} = $ip;
ba46c7
 				}
ba46c7
 			}
ba46c7
@@ -1951,7 +1893,6 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
@@ -1966,14 +1907,13 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{B1}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"B1"}++;
ba46c7
-					$connCodeCount++;	
ba46c7
+					$connCodeCount++;
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -1981,44 +1921,41 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{B4}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"B4"}++;
ba46c7
 					$connCodeCount++;
ba46c7
 				}
ba46c7
-		    	}
ba46c7
+			}
ba46c7
 		}
ba46c7
 		if (m/- T1/){
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
-			       	$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
+				$ip = getIPfromConn($1);
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{T1}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"T1"}++;
ba46c7
-					$connCodeCount++;	
ba46c7
+					$connCodeCount++;
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
 		if (m/- T2/){
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
-				$exc = "no"; 
ba46c7
+				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{T2}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"T2"}++;
ba46c7
-					$connCodeCount++;	
ba46c7
+					$connCodeCount++;
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -2027,14 +1964,13 @@ sub parseLineNormal
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
 				$maxBerSizeCount++;
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{B2}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"B2"}++;
ba46c7
-					$connCodeCount++;	
ba46c7
+					$connCodeCount++;
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -2042,14 +1978,13 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{B3}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"B3"}++;
ba46c7
-					$connCodeCount++;	
ba46c7
+					$connCodeCount++;
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -2057,9 +1992,8 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{R1}->{$ip}++;
ba46c7
@@ -2072,14 +2006,13 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{P1}->{$ip}++;
ba46c7
 					$hashes->{conncount}->{"P1"}++;
ba46c7
-					$connCodeCount++;	
ba46c7
+					$connCodeCount++;
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -2087,9 +2020,8 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{P2}->{$ip}++;
ba46c7
@@ -2102,9 +2034,8 @@ sub parseLineNormal
ba46c7
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
 				$exc = "no";
ba46c7
 				$ip = getIPfromConn($1);
ba46c7
-				if ($ip eq ""){$ip = "Unknown_Host";}
ba46c7
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
ba46c7
-				        if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
+					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
ba46c7
 				}
ba46c7
 				if ($exc ne "yes"){
ba46c7
 					$hashes->{U1}->{$ip}++;
ba46c7
@@ -2131,8 +2062,7 @@ sub parseLineNormal
ba46c7
 		if ($_ =~ /oid=\" *([0-9\.]+)/i ){ $hashes->{oid}->{$1}++; }
ba46c7
 		if ($1 && $1 eq $startTLSoid){$startTLSCount++;}
ba46c7
 		if ($verb eq "yes"){
ba46c7
-		        if ($_ =~ /conn= *([0-9A-Z]+)/i){ push @{$arrays->{extconn}}, $1; }
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i){ push @{$arrays->{extop}}, $1; }
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{ext_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (($usage =~ /l/ || $verb eq "yes") and / SRCH /){
ba46c7
@@ -2155,14 +2085,12 @@ sub parseLineNormal
ba46c7
 		$filterCount++;
ba46c7
 		if($usage =~ /u/ || $verb eq "yes"){
ba46c7
 			# we only need this for the unindexed search report
ba46c7
-			push @{$arrays->{filterval}}, $tmpp;
ba46c7
-			push @{$arrays->{filterconn}}, $filterConn;
ba46c7
-			push @{$arrays->{filterop}}, $filterOp;
ba46c7
+			$hashes->{filter_conn_op}->{"$filterConn,$filterOp"} = $tmpp;
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if ($usage =~ /a/ || $verb eq "yes"){
ba46c7
 		if (/ SRCH /   && $_ =~ /base=\"(.*)\" scope/i ){
ba46c7
-			my ($baseConn, $baseOp, $scopeVal, $scopeConn, $scopeOp);
ba46c7
+			my ($conn, $op, $scopeVal);
ba46c7
 			if ($1 eq ""){
ba46c7
 				$tmpp = "Root DSE";
ba46c7
 			} else {
ba46c7
@@ -2173,25 +2101,19 @@ sub parseLineNormal
ba46c7
 			#
ba46c7
 			# grab the search bases & scope for potential unindexed searches
ba46c7
 			#
ba46c7
-			if ($_ =~ /scope= *([0-9]+)/i) { 
ba46c7
-				$scopeVal = $1; 
ba46c7
+			if ($_ =~ /scope= *([0-9]+)/i) {
ba46c7
+				$scopeVal = $1;
ba46c7
 			}
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i) { 
ba46c7
-				$baseConn = $1; 
ba46c7
-				$scopeConn = $1;	
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
ba46c7
+				$conn = $1;
ba46c7
 			}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i) { 
ba46c7
-				$baseOp = $1;
ba46c7
-				$scopeOp = $1;
ba46c7
+			if ($_ =~ /op= *([0-9\-]+)/i) {
ba46c7
+				$op = $1;
ba46c7
 			}
ba46c7
 			if($usage =~ /u/ || $verb eq "yes"){
ba46c7
 				# we only need this for the unindexed search report
ba46c7
-				push @{$arrays->{baseval}}, $tmpp;
ba46c7
-				push @{$arrays->{baseconn}}, $baseConn;
ba46c7
-				push @{$arrays->{baseop}}, $baseOp;
ba46c7
-				push @{$arrays->{scopeval}}, $scopeTxt[$scopeVal]; 
ba46c7
-				push @{$arrays->{scopeconn}}, $scopeConn; 
ba46c7
-				push @{$arrays->{scopeop}}, $scopeOp; 
ba46c7
+				$hashes->{base_conn_op}->{"$conn,$op"} = $tmpp;
ba46c7
+				$hashes->{scope_conn_op}->{"$conn,$op"} = $scopeTxt[$scopeVal];
ba46c7
 			}
ba46c7
 			$baseCount++;
ba46c7
 			$scopeCount++;
ba46c7
@@ -2210,15 +2132,8 @@ sub parseLineNormal
ba46c7
 			$ds6x = "true";
ba46c7
 			$badPwdCount++;
ba46c7
 		} elsif (/ err=49 tag=/ ){
ba46c7
-			if ($_ =~ /conn= *([0-9A-Z]+)/i ){
ba46c7
-				push @{$arrays->{badpwdconn}}, $1;
ba46c7
-				$ip = getIPfromConn($1);
ba46c7
-				$badPwdCount++;
ba46c7
-			}
ba46c7
-			if ($_ =~ /op= *([0-9\-]+)/i ){
ba46c7
-				push @{$arrays->{badpwdop}}, $1;
ba46c7
-			}
ba46c7
-			push @{$arrays->{badpwdip}}, $ip;
ba46c7
+			$badPwdCount++;
ba46c7
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{badpwd_conn_op}->{"$1,$2"}++;}
ba46c7
 		}
ba46c7
 	}
ba46c7
 	if (/ BIND / && /method=sasl/i){
ba46c7
@@ -2259,29 +2174,17 @@ sub parseLineNormal
ba46c7
 sub
ba46c7
 reset_stats_block
ba46c7
 {
ba46c7
-    my $stats = shift;
ba46c7
-
ba46c7
-    $stats->{'last'} = shift || 0;
ba46c7
-    $stats->{'last_str'} = shift || '';
ba46c7
-
ba46c7
-    $stats->{'results'}=0;
ba46c7
-    $stats->{'srch'}=0;
ba46c7
-    $stats->{'add'}=0;
ba46c7
-    $stats->{'mod'}=0;
ba46c7
-    $stats->{'modrdn'}=0;
ba46c7
-    $stats->{'moddn'}=0;
ba46c7
-    $stats->{'cmp'}=0;
ba46c7
-    $stats->{'del'}=0;
ba46c7
-    $stats->{'abandon'}=0;
ba46c7
-    $stats->{'conns'}=0;
ba46c7
-    $stats->{'sslconns'}=0;
ba46c7
-    $stats->{'bind'}=0;
ba46c7
-    $stats->{'anonbind'}=0;
ba46c7
-    $stats->{'unbind'}=0;
ba46c7
-    $stats->{'notesA'}=0;
ba46c7
-    $stats->{'notesU'}=0;
ba46c7
-    $stats->{'etime'}=0;
ba46c7
-    return;
ba46c7
+	my $stats = shift;
ba46c7
+
ba46c7
+	$stats->{'last'} = shift || 0;
ba46c7
+	$stats->{'last_str'} = shift || '';
ba46c7
+
ba46c7
+	for my $sn (@statnames) {
ba46c7
+		next if ($sn eq 'last' or $sn eq 'last_str');
ba46c7
+		$stats->{$sn}=0;
ba46c7
+	}
ba46c7
+
ba46c7
+	return;
ba46c7
 }
ba46c7
 
ba46c7
 sub
ba46c7
@@ -2292,6 +2195,7 @@ new_stats_block
ba46c7
 		'active' => 0,
ba46c7
 	};
ba46c7
 	if ($name){
ba46c7
+		$stats = openHashFiles($dataLocation, @statnames);
ba46c7
 		$stats->{'filename'} = $name;
ba46c7
 		$stats->{'fh'} = new IO::File;
ba46c7
 		$stats->{'active'} = open($stats->{'fh'},">$name");
ba46c7
@@ -2308,32 +2212,32 @@ print_stats_block
ba46c7
 		if ($stats->{'active'}){
ba46c7
 			if ($stats->{'last'}){
ba46c7
 				$stats->{'fh'}->print(
ba46c7
-			    		join(',',
ba46c7
-					    $stats->{'last_str'},
ba46c7
-					    $stats->{'last'},
ba46c7
-					    $stats->{'results'},
ba46c7
-					    $stats->{'srch'},
ba46c7
-					    $stats->{'add'},
ba46c7
-					    $stats->{'mod'},
ba46c7
-					    $stats->{'modrdn'},
ba46c7
-					    $stats->{'moddn'},
ba46c7
-					    $stats->{'cmp'},
ba46c7
-					    $stats->{'del'},
ba46c7
-					    $stats->{'abandon'},
ba46c7
-					    $stats->{'conns'},
ba46c7
-					    $stats->{'sslconns'},
ba46c7
-					    $stats->{'bind'},
ba46c7
-					    $stats->{'anonbind'},
ba46c7
-					    $stats->{'unbind'},
ba46c7
-					    $stats->{'notesA'},
ba46c7
-					    $stats->{'notesU'},
ba46c7
-					    $stats->{'etime'}),
ba46c7
-			    		"\n" );
ba46c7
+					join(',',
ba46c7
+						 $stats->{'last_str'},
ba46c7
+						 $stats->{'last'},
ba46c7
+						 $stats->{'results'},
ba46c7
+						 $stats->{'srch'},
ba46c7
+						 $stats->{'add'},
ba46c7
+						 $stats->{'mod'},
ba46c7
+						 $stats->{'modrdn'},
ba46c7
+						 $stats->{'moddn'},
ba46c7
+						 $stats->{'cmp'},
ba46c7
+						 $stats->{'del'},
ba46c7
+						 $stats->{'abandon'},
ba46c7
+						 $stats->{'conns'},
ba46c7
+						 $stats->{'sslconns'},
ba46c7
+						 $stats->{'bind'},
ba46c7
+						 $stats->{'anonbind'},
ba46c7
+						 $stats->{'unbind'},
ba46c7
+						 $stats->{'notesA'},
ba46c7
+						 $stats->{'notesU'},
ba46c7
+						 $stats->{'etime'}),
ba46c7
+					"\n" );
ba46c7
 			} else {
ba46c7
 				$stats->{'fh'}->print(
ba46c7
-			    		"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
ba46c7
-			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed search,Unindexed component,ElapsedTime\n"
ba46c7
-			    	);
ba46c7
+					"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
ba46c7
+					"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed search,Unindexed component,ElapsedTime\n"
ba46c7
+					);
ba46c7
 			}
ba46c7
 		}
ba46c7
 	}
ba46c7
@@ -2346,7 +2250,7 @@ inc_stats
ba46c7
 	my $n = shift;
ba46c7
 	foreach(@_){
ba46c7
 		$_->{$n}++
ba46c7
-	    	if exists $_->{$n};
ba46c7
+			if exists $_->{$n};
ba46c7
 	}
ba46c7
 	return;
ba46c7
 }
ba46c7
@@ -2360,7 +2264,7 @@ inc_stats_val
ba46c7
 	my $val = shift;
ba46c7
 	foreach(@_){
ba46c7
 		$_->{$n} += $val
ba46c7
-	    	if exists $_->{$n};
ba46c7
+			if exists $_->{$n};
ba46c7
 	}
ba46c7
 	return;
ba46c7
 }
ba46c7
@@ -2383,7 +2287,7 @@ displayBindReport
ba46c7
 		&printClients($bindReport{$bindDN}{"conn"});
ba46c7
 		print("\n   Operations Performed:\n\n");
ba46c7
 		&printOpStats($bindDN);
ba46c7
-		print("\n");	
ba46c7
+		print("\n");
ba46c7
 	}
ba46c7
 	print "Done.\n";
ba46c7
 	exit (0);
ba46c7
@@ -2391,13 +2295,13 @@ displayBindReport
ba46c7
 
ba46c7
 sub
ba46c7
 printClients
ba46c7
-{ 
ba46c7
+{
ba46c7
 	my @bindConns = &cleanConns(split(' ', $_[0]));
ba46c7
 	my $IPcount = "1";
ba46c7
 
ba46c7
 	foreach my $ip ( keys %connList ){   # Loop over all the IP addresses
ba46c7
 		foreach my $bc (@bindConns){ # Loop over each bind conn number and compare it 
ba46c7
-			if($connList{$ip} =~ / $bc /){ 
ba46c7
+			if($connList{$ip} =~ / $bc /){
ba46c7
 				print("        [$IPcount]  $ip\n");
ba46c7
 				$IPcount++;
ba46c7
 				last;
ba46c7
@@ -2417,7 +2321,7 @@ cleanConns
ba46c7
 		if($dirtyConns[$i] ne ""){
ba46c7
 			$retConns[$c++] = $dirtyConns[$i];
ba46c7
 		}
ba46c7
-	}	
ba46c7
+	}
ba46c7
 	return @retConns;
ba46c7
 }
ba46c7
 
ba46c7
@@ -2443,7 +2347,7 @@ printOpStats
ba46c7
 #######################
ba46c7
 #                     #
ba46c7
 # Hash File Functions #
ba46c7
-#                     #  
ba46c7
+#                     #
ba46c7
 #######################
ba46c7
 
ba46c7
 sub
ba46c7
@@ -2471,35 +2375,17 @@ openHashFiles
ba46c7
 }
ba46c7
 
ba46c7
 sub
ba46c7
-openArrayFiles
ba46c7
-{
ba46c7
-	my $dir = shift;
ba46c7
-	my %arrays = ();
ba46c7
-	for my $an (@_) {
ba46c7
-		my @ary = (); # using my in inner loop will create brand new array every time through for tie
ba46c7
-		my $fn = "$dir/$an.logconv.db";
ba46c7
-		push @removefiles, $fn;
ba46c7
-		tie @ary, "DB_File", $fn, O_CREAT|O_RDWR, 0600, $DB_RECNO or do { openFailed($!, $fn) };
ba46c7
-		$arrays{$an} = \@ary;
ba46c7
-	}
ba46c7
-	return \%arrays;
ba46c7
-}
ba46c7
-
ba46c7
-sub
ba46c7
 removeDataFiles
ba46c7
 {
ba46c7
-    if (!$needCleanup) { return ; }
ba46c7
+	if (!$needCleanup) { return ; }
ba46c7
 
ba46c7
 	for my $h (keys %{$hashes}) {
ba46c7
 		untie %{$hashes->{$h}};
ba46c7
 	}
ba46c7
-	for my $a (keys %{$arrays}) {
ba46c7
-		untie @{$arrays->{$a}};
ba46c7
-	}
ba46c7
 	for my $file (@removefiles) {
ba46c7
 		unlink $file;
ba46c7
 	}
ba46c7
-    $needCleanup = 0;
ba46c7
+	$needCleanup = 0;
ba46c7
 }
ba46c7
 
ba46c7
 END { print "Cleaning up temp files . . .\n"; removeDataFiles(); print "Done\n"; }
ba46c7
@@ -2508,7 +2394,12 @@ sub
ba46c7
 getIPfromConn
ba46c7
 {
ba46c7
 	my $connid = shift;
ba46c7
-	return $hashes->{conn_hash}->{$connid};
ba46c7
+	if (exists($hashes->{conn_hash}->{$connid}) &&
ba46c7
+		defined($hashes->{conn_hash}->{$connid})) {
ba46c7
+		return $hashes->{conn_hash}->{$connid};
ba46c7
+	}
ba46c7
+
ba46c7
+	return "Unknown_Host";
ba46c7
 }
ba46c7
 
ba46c7
 #######################################
ba46c7
-- 
ba46c7
1.7.1
ba46c7