From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: boyd@sdgm.net To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] spamoff Date: Mon, 1 Sep 2003 10:54:09 -0400 Topicbox-Message-UUID: 2827b634-eacc-11e9-9e20-41e7f4b1d025 #!/bin/rc # spamoff addr mbox # set user to be you user=boyd mdir=/usr/$user/lib/mail # somewhere to put the below allow=$mdir/allow # addr's you'll accept mail from audit=$mdir/audit # audit trail errors=$mdir/errors # error log myname=`{basename $0} { echo $myname $* cat /dev/user echo lc /env pwd ls -l ls -l /tmp echo } > $audit fn err { echo $myname: $* > $errors exit $"* } fn match { addr=$1 awk -v 'addr='$addr ' BEGIN { addr=tolower(addr) # 822 addresses are case insensitive e = 1 } tolower($0) == addr { e=0 exit } END { exit e } ' $allow } fn bitch { addr=$1 mbox=$2 if (match $addr) { cat > $mbox exit } code=`{echo $myname$user$pid | md5sum} echo $code # apart from the rc here document bug we probably don't have a /tmp { echo Either you''''re a spammer or I don''''t like you or I don''''t know you. echo echo Email me this rejected message with: echo echo ' '$code echo echo in the Subject: line and I''''ll decide if I''''ll add you to my list echo of people I''''ll accept mail from. } | cat /fd/0 > $audit err rejected mail from $addr $code } #if (! test -w $errors -a -A $errors -a -L $errors) { if (! test -w $errors -a -A $errors) { exit $myname:' '$errors:' existance/mode/permission problem' } if (! test -r $allow) { err $allow:' existance/permission problem' } switch ($#*) { case 0 err no args case 1 err args: $* case 2 bitch $* case * err args: $* }