From: boyd@sdgm.net
To: 9fans@cse.psu.edu
Subject: [9fans] spamoff
Date: Mon, 1 Sep 2003 10:54:09 -0400 [thread overview]
Message-ID: <cc176eaba96adc7d2d5a64edf3653a26@sdgm.net> (raw)
#!/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: $*
}
next reply other threads:[~2003-09-01 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-01 14:54 boyd [this message]
2003-09-26 0:58 boyd
2003-09-26 2:26 ` ron minnich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc176eaba96adc7d2d5a64edf3653a26@sdgm.net \
--to=boyd@sdgm.net \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).