/var/list/.bin/procbounce is in smartlist 3.15-25build1.
This file is owned by list:list, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | #! /bin/sh
:
# Copyright (c) 1993-1999, S.R. van den Berg, The Netherlands
# Copyright (c) 1999-2000, Philip Guenther, The United States of America
#$Id: procbounce,v 1.38 2000/05/09 06:36:32 guenther Exp $
test=test # /bin/test
echo=echo # /bin/echo
cat=cat # /bin/cat
mkdir=mkdir # /bin/mkdir
sed=sed # /bin/sed
ls=ls # /bin/ls
rm=rm # /bin/rm
expr=expr # /bin/expr
date=date # /bin/date
formail=formail # /usr/local/bin/formail
multigram=multigram # ../.bin/multigram
idhash=idhash # ../.bin/idhash
$test -z "$listaddr" &&
$echo "Don't start this script directly, it is used in rc.request" && exit 64
tmpfrom=tmp.from
tmprequest=tmp.request
dist=dist
bounces=bounces
$test -d $bounces || $mkdir $bounces
$formail -1 -kdem4 -xSubject: <$tmprequest -s |
$sed -e '/^[0-4][0-9][0-9] /d' -e '/^[ *]*Message-[Ii][Dd]:/d' \
-e '/^[ *]*To:/d' -e '/will retry/,/^[ ]*$/d' \
-e '/^Xsucceed:/d' \
-e '/^The mail system at .* unable to deliver/,/^-* Message Log Follows -/d'\
-e '/ent successfully/,/^[ ]*$/d' \
-e '/^Content-Type:.*message.rfc822/q' \
-e 's/^\([^ ]*\) @ /\1@/' >$tmpfrom
addr=''
# Special processing for DSNs
if $test ".$isadsn" = .yes
then
# Accept any number of 'exact' matches on Original-Receipient: lines
addr=`$sed -n \
-e 's/^Original-[Rr]ecipient:.*[Rr][Ff][Cc]822;//p' <$tmprequest |
$multigram -l$match_threshold -x$listaddr -x$listreq $dist`
# Accept just one close match on Final-Receipient: lines
test -z "$addr" &&
addr=`$sed -n \
-e 's/^Final-[Rr]ecipient:.*[Rr][Ff][Cc]822;//p' <$tmprequest |
$multigram -b1 -l$off_threshold -x$listaddr -x$listreq $dist`
# Ditto for X-Actual-Recipient: lines
test -z "$addr" &&
addr=`$sed -n \
-e 's/^X-[Aa]ctual-[Rr]ecipient:.*[Rr][Ff][Cc]822;//p' <$tmprequest |
$multigram -b1 -l$off_threshold -x$listaddr -x$listreq $dist`
fi
test -z "$addr" &&
addr=`sed -n -e '/^5[0-9][0-9] /p' <$tmpfrom |
$multigram -b1 -l$off_threshold -x$listaddr -x$listreq $dist`
test -z "$addr" &&
addr=`$multigram -b1 -l$off_threshold -x$listaddr -x$listreq $dist <$tmpfrom`
test -z "$addr" &&
addr=`$multigram -i -b1 -l16384 -x$domain $dist <$tmpfrom`
$test -z "$addr" &&
addr=`$formail -1 +1 -dem4 -XReceived: -uReceived: <$tmprequest -s |
$multigram -i -b1 -l16384 -x$domain $dist `
if $test ! -z "$addr"
then
addr=`$expr "X $addr" : 'X.* \([^ ]*\)$' `
serial=`$formail +1 -1 -m4 -zdexMessage-Id: -s $idhash <$tmprequest`
case "X$serial" in
X|X0) set dummy `LANG='' LC_TIME='' LC_ALL='' \
$date +'%y %m %d' 2>/dev/null`
serial=$3$4$2 ;;
esac
$echo "$addr" >>$bounces/$serial
$rm -f _dummy_ `$ls -td $bounces/* | $sed -e '1,'$maxhist' d' `
bounced=0
for a in $bounces/*
do
$test -f "$a" &&
$echo "From $addr" | $multigram -b1 -l$match_threshold $a >/dev/null &&
bounced=`$expr $bounced + 1`
done
addfield="X-Diagnostic: Mail to $addr bounced $bounced times"
if $expr $bounced \>= $minbounce >/dev/null
then
fieldcontent=`
if echo "From $addr" |
$multigram -b1 -l$auto_off_threshold -d $dist 2>/dev/null
then
:
else
$echo 'Not confident enough to autoremove the offending address'
$echo "From $addr" | $multigram -b2 -l0 $dist
fi | $sed -e '/^Removed:/ d' \
-e '1 s/^ *[0-9]* \([^ ]* *[0-9]*\).*$/Removed: \1/' \
-e 's/^ *[0-9]/ /'`
if realaddr=`$expr "X$fieldcontent" : 'XRemoved: \([^ ]*\)'`
then
$test ! -z "$subscribe_log" &&
$echo "procbounce: $fieldcontent" >>$subscribe_log
( $cat <<HERE
To: $realaddr
From: $listreq
Subject: You have been removed from the list
X-Loop: $listaddr (bounce)
X-Loop: $listaddr
Precedence: junk
Your mail address $realaddr has been removed
from the $listaddr mailinglist.
It generated an excessive amount of bounced mails.
Before sending in a subscription request to
$listreq again, please ensure that
this problem has been resolved. When in doubt, ask your system
administrator or send mail to "postmaster".
The last one of those bounced mails has been quoted below:
HERE
$sed -e 's/^/>/' $tmprequest
) | $SENDMAIL $sendmailOPT "$realaddr"
fi
addfield="$addfield
X-Diagnostic: Bounces exceed threshold of $minbounce
X-Diagnostic: $fieldcontent"
fi
$formail -A "$addfield"
else
$cat
fi
|