diff -Nur smeserver-mailstats-1.1.old/root/usr/bin/spamfilter-stats-7.pl smeserver-mailstats-1.1/root/usr/bin/spamfilter-stats-7.pl --- smeserver-mailstats-1.1.old/root/usr/bin/spamfilter-stats-7.pl 2019-10-18 20:55:55.893000000 -0400 +++ smeserver-mailstats-1.1/root/usr/bin/spamfilter-stats-7.pl 2019-10-18 20:56:24.097000000 -0400 @@ -24,6 +24,9 @@ # bjr - 04Aug16 - Add code to expand the junkmail table to include daily ham and spam and deleted spam for each user - (NFR bugzilla 9716) # bjr - 05Aug16 - Add code to log remote relay incoming emails # bjr - 10Oct16 - Add code to show stats for the smeoptimizer package +# bjr - 16dec16 - Fix dnsbl code to deal with psbl.surriel.com - Bug 9717 +# bjr - 16Dec16 - Change geopip table code to show even if no exclusions found (assuming geoip data found) - Bug 9888 +# bjr - 30Apr17 - Change Categ index code - Bug 9888 again # ############################################################################# # @@ -95,7 +98,7 @@ #Configuration section my %opt = ( - version => '0.7.10', # please update at each change. + version => '0.7.12', # please update at each change. debug => 0, # guess what ? sendmail => '/usr/sbin/sendmail', # Path to sendmail stub from => 'spamfilter-stats', # Who is the mail from @@ -192,9 +195,15 @@ # # Index for certain columns - check these do not move if we add columns # -my $BadCountryCateg=9; -my $DMARCcateg = 5; #Not used. -my $KarmaCateg=$BadCountryCateg+3; +#my $BadCountryCateg=9; +#my $DMARCcateg = 5; #Not used. +#my $KarmaCateg=$BadCountryCateg+3; + +my %categindex; +@categindex{@categs} = (0..$#categs); +my $BadCountryCateg=$categindex{$CATBADCOUNTRIES}; +my $DMARCcateg = $categindex{$CATDMARC}; #Not used. +my $KarmaCateg=$categindex{$CATKARMA}; my $above15 = 0; my $RBLcount = 0; @@ -1228,7 +1237,7 @@ if ($enableSARules) {show_SARules_codes();} - if ($enableGeoiptable and $finaldisplay[$BadCountryCateg]){show_Geoip_results();} + if ($enableGeoiptable and (($total_countries > 0) or $finaldisplay[$BadCountryCateg])){show_Geoip_results();} if ($enablejunkMailList) {List_Junkmail();} @@ -1439,12 +1448,12 @@ sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; sub get_domain -{ #my $url= URI->new(shift); - #my $domain = $url->host; - my $url = shift; +{ my $url = shift; + $url =~ s!^\(dnsbl\)\s!!; $url =~ s!^.*https?://(?:www\.)?!!i; $url =~ s!/.*!!; $url =~ s/[\?\#\:].*//; + $url =~ s/^([\d]{1,3}.){4}//; my $domain = trim($url); return $domain; }