Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 2009 01:11:10 +0000 (UTC)
From:      Brian Somers <brian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r194411 - in stable/7/etc: . periodic/daily
Message-ID:  <200906180111.n5I1BA2F093456@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brian
Date: Thu Jun 18 01:11:10 2009
New Revision: 194411
URL: http://svn.freebsd.org/changeset/base/194411

Log:
  MFC: r192970: Handle different rulesets.
  
  PR:		35018

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/periodic/daily/460.status-mail-rejects

Modified: stable/7/etc/periodic/daily/460.status-mail-rejects
==============================================================================
--- stable/7/etc/periodic/daily/460.status-mail-rejects	Wed Jun 17 23:34:58 2009	(r194410)
+++ stable/7/etc/periodic/daily/460.status-mail-rejects	Thu Jun 18 01:11:10 2009	(r194411)
@@ -12,10 +12,8 @@ then
 fi
 
 case "$daily_status_mail_rejects_shorten" in
-[Yy][Ee][Ss])
-    sed_output='\4 \3...';;
-*)
-    sed_output='\2 (\3... \4)';;
+[Yy][Ee][Ss])	shorten='cut -d" " -f2,3';;
+*)		shorten=cat;;
 esac
 
 case "$daily_status_mail_rejects_enable" in
@@ -39,7 +37,8 @@ case "$daily_status_mail_rejects_enable"
 	    echo
 	    echo Checking for rejected mail hosts:
 
-	    start=`date -v-1d '+%b %e'`
+	    yesterday=$(date -v-1d '+%b %e')
+	    today=$(date '+%b %e')
 	    n=$(($daily_status_mail_rejects_logs - 2))
 	    rc=$({
 		while [ $n -ge 0 ]
@@ -57,9 +56,14 @@ case "$daily_status_mail_rejects_enable"
 		    n=$(($n - 1))
 		done
 		cat /var/log/maillog
-	    } |
-		sed -n -E "s/^$start"'.*ruleset=check_[^ ]+, +arg1=<?([^@]+@)?([^>,]+).*reject=([^ ]+) .* ([^ ]+)$/'"$sed_output"'/p' |
-		sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l)
+	    } | sed -Ene "/^$today/q" -e "/^$yesterday/{"'
+		    s/.*ruleset=check_relay,.* relay=([^,]+), reject=([^ ]*).*/\2 check_relay \1/p
+		    t end
+                    s/.*ruleset=check_rcpt,.* arg1=<?([^>,]+).* reject=([^ ]+) .* ([^ ]+)/\2 check_rcpt \1 \3/p
+		    t end
+                    s/.*ruleset=check_([^,]+),.* arg1=<?([^@]+@)?([^>,]+).* reject=([^ ]+) .* ([^ ]+)/\4 check_\1 \3 \5/p
+		    :end
+		}' | eval $shorten | sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l)
 	    [ $rc -gt 0 ] && rc=1
 	fi;;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906180111.n5I1BA2F093456>