From 690a5eae396438205bfd645f09c35cef34561ee4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Feb 2010 21:36:12 +0000 Subject: [PATCH] Sends rejection copies to record etc. --- .gitignore | 1 + forward-suffix.part.INO | 2 +- get-settings | 2 +- stump/etc/modenv.INO | 3 +++ xlog/bin/record | 28 +++++++++++++++++++++++++++- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 180fe79..8dc5a05 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ /xlog/log/*/event.log /xlog/log/*/event.log.[0-9] /xlog/log/*/event.log.[0-9].gz +/xlog/log/*/nr-*.txt /crontab.part /stump/etc/modenv /stump/etc/added-headers diff --git a/forward-suffix.part.INO b/forward-suffix.part.INO index def37b3..bf5121a 100644 --- a/forward-suffix.part.INO +++ b/forward-suffix.part.INO @@ -36,6 +36,6 @@ endif if $local_part_suffix is +%ABBREV%-internal-reject-copy then - seen deliver %ABBREV%-rejections@chiark.greenend.org.uk + seen deliver %REJECTIONSLIST% finish endif diff --git a/get-settings b/get-settings index dda3f51..f9b3d6f 100644 --- a/get-settings +++ b/get-settings @@ -5,7 +5,7 @@ pas="$paskeys" for k in $pas; do eval "$k=''"; export $k; done . settings -export GROUP ABBREV INFOHEADER MODEMAIL GROUPURL +export GROUP ABBREV INFOHEADER MODEMAIL GROUPURL REJECTIONSLIST . ../global-settings export ROOTBASEDIR CGIBASEURL DOMAIN SLIMYDOMAIN OURUSER ADMIN diff --git a/stump/etc/modenv.INO b/stump/etc/modenv.INO index e403b42..ed322f6 100755 --- a/stump/etc/modenv.INO +++ b/stump/etc/modenv.INO @@ -50,6 +50,9 @@ MAILOUT_REJECT_FORMAIL_ARGS=' -I Bcc:%OURUSER%+%ABBREV%-internal-log+mailout@%DOMAIN% -I Bcc:%OURUSER%+%ABBREV%-internal-reject-copy@%DOMAIN% ' +export MAILOUT_RECVACK_FORMAIL_ARGS +export MAILOUT_ACCEPTACK_FORMAIL_ARGS +export MAILOUT_REJECT_FORMAIL_ARGS ####################################################################### # STUMP enforces limitations on the maximum number of newsgroups diff --git a/xlog/bin/record b/xlog/bin/record index 27ca36b..a628195 100755 --- a/xlog/bin/record +++ b/xlog/bin/record @@ -11,6 +11,8 @@ $dir =~ s,/[^/]+$,,; $dir =~ s,/bin$,/log,; $dir .= "/$ARGV[1]"; +my $message; + sub parse__headerline () { $f{Subject}= $' if m/^Subject:\s*/i; #'; $f{MessageID}= $' if m/^Message\-ID:\s*/i; #'; @@ -71,12 +73,29 @@ sub parse_webstump2stump () { } sub parse_mailout () { + my $keepheader= 1; while () { + $keepheader= 1 unless m/^[ \t]/; + $keepheader= 0 + if m/^(?: received )/ix; + $keepheader= 'mangle' + if m/^(?: to + | from + | return-path + | reply-to + | errors-to + )/ix; + if ($keepheader) { + my $line= $_; + $line =~ s/\@.{0,2}/ at ../g if $keepheader eq 'mangle'; + $message .= $line; + } chomp; $f{Event}= "notify $'" if m/^X-Webstump-Event:\s*/i; #'; last if m/^$/; } while () { + $message .= $_; chomp; next unless s/^\> //; last if m/^$/; @@ -86,11 +105,18 @@ sub parse_mailout () { $f{Event}= '?'; &{"parse_$ARGV[0]"}; -while () { } +while () { $message .= $_; } STDIN->error and die $!; $f{Now}= time; +if ($f{Event} =~ m/^notify reject /) { + #$ref= $f{MessageID} + open I, ">$dir/nr-$f{MessageNum}.txt" or die $!; + print I $message or die $!; + close I or die $!; +} + open L, ">>$dir/event.log" or die $!; my @s= map { -- 2.30.2