diff -urN smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats smeserver-mailstats-1.1/root/etc/cron.d/mailstats --- smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-mailstats-1.1/root/etc/cron.d/mailstats 2021-04-02 10:20:03.578882758 +0100 @@ -0,0 +1 @@ +0 0 * * * root sleep $[ $RANDOM \% 3600 ]; /usr/bin/runmailstats.sh diff -urN smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats.cron smeserver-mailstats-1.1/root/etc/cron.d/mailstats.cron --- smeserver-mailstats-1.1.old/root/etc/cron.d/mailstats.cron 2021-04-02 10:01:02.017494160 +0100 +++ smeserver-mailstats-1.1/root/etc/cron.d/mailstats.cron 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -0 0 * * * root sleep $[ $RANDOM \% 3600 ]; perl /usr/bin/mailstats.pl /var/log/qpsmtpd/\@* /var/log/qpsmtpd/current /var/log/sqpsmtpd/\@* /var/log/sqpsmtpd/current - diff -urN smeserver-mailstats-1.1.old/root/usr/bin/mailstats.pl smeserver-mailstats-1.1/root/usr/bin/mailstats.pl --- smeserver-mailstats-1.1.old/root/usr/bin/mailstats.pl 2021-04-02 10:01:02.026494244 +0100 +++ smeserver-mailstats-1.1/root/usr/bin/mailstats.pl 2021-04-02 12:02:01.776104517 +0100 @@ -1,4 +1,5 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl +use strict; ############################################################################# # @@ -13,7 +14,7 @@ # - Sort out geoip failure status as per Bug 4262 # - change final message about the DB (it is created automatically these days by the rpm) # bjr - 17Jun15 - Add annotation showing Badcountries being eliminated -# - correct Spamfilter details extract, as per Bug 8656 +# - correct Spamfilter details extract, as per Bug 8656 # - Add analysis table of Geoip results # bjr - 19Jun15 - Add totals for the League tables # bjr and Unnilennium - 08Apr16 - Add in else for unrecognised plugin detection @@ -30,6 +31,7 @@ # bjr - 18Dec19 - Sort out a few format problems and also remove some debugging crud - Bug 10858 # bjr - 18Dec19 - change to fix truncation of email address in by email table - bug 10327 # bjr - 18Oct20 - Alter use of lc to avoid uninitialised messages - bug 11044 +# bjr - 02Apr21 - Fix up lc to try to avoif uninit messages - and alter warning status - bug 11519 # ############################################################################# # @@ -102,7 +104,7 @@ #Configuration section my %opt = ( - version => '0.7.14', # please update at each change. + version => '0.7.15', # 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 @@ -386,7 +388,7 @@ $counts{$PERCENT}{$categs[$ncateg]} = 0; if ($cdb->get('mailstats')){ - $display[$ncateg] = lc($cdb->get('mailstats')->prop($categs[$ncateg]) || "auto"); + $display[$ncateg] = lc($cdb->get_prop('mailstats',$categs[$ncateg]) || "auto"); } else { $display[$ncateg] = 'auto' } @@ -783,7 +785,7 @@ if ($localflag == 0) { if (length($log_items[4]) > 0){ # Need to check here for multiple email addresses - my @emails = split(",",lc($log_items[4])); + my @emails = split(",",lc($log_items[4] || ' ')); if (scalar(@emails) > 1) { #Just pick the first local address to hang it on. # TEMP - just go for the first address until I can work out how to spot the 1st "local" one @@ -796,11 +798,13 @@ my $fullemail = $email; $email = s/.*\@(.*)$/$1/; #and see if it is local - if ($email =~ m/$alldomains/){ - $usercounts{lc($fullemail)}{$result}++; - $usercounts{lc($fullemail)}{"proc"} = $proc; - $gotone = $true; - last; + if (length($fullemail)>0) { + if ($email =~ m/$alldomains/){ + $usercounts{lc($fullemail || ' ')}{$result}++; + $usercounts{lc($fullemail || ' ')}{"proc"} = $proc; + $gotone = $true; + last; + } } } if (!$gotone) { diff -urN smeserver-mailstats-1.1.old/root/usr/bin/runmailstats.sh smeserver-mailstats-1.1/root/usr/bin/runmailstats.sh --- smeserver-mailstats-1.1.old/root/usr/bin/runmailstats.sh 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-mailstats-1.1/root/usr/bin/runmailstats.sh 2021-04-02 10:12:16.681578199 +0100 @@ -0,0 +1,3 @@ +#!/bin/bash +exec 1> >(logger -t $(basename $0)) 2>&1 +perl /usr/bin/mailstats.pl /var/log/qpsmtpd/\@* /var/log/qpsmtpd/current /var/log/sqpsmtpd/\@* /var/log/sqpsmtpd/current