This involves storing a glob pattern for each mailing list in the CDB.
Current version doesn't reject: it just logs that it would have done,
and then accepts anyway.
set -e
kind=${1?kind}
tail=${2?tail}
-if cdb -q groups.cdb "$kind:$tail" >/dev/null 2>&1; then
- echo +
-else
- echo "-bad tag $tail"
-fi
+sender=${3?sender}
+
+##bad () { echo "-$*"; exit 0; }
+bad () {
+ echo "consider reject to $kind:$tail from $sender ($*)" >>addrcheck.log"
+ echo "+just this once"
+ exit 0
+}
+
+entry=`cdb -q groups.cdb "$kind:$tail"` || bad "bad tag $tail"
+set -- $entry
+case $kind in
+ g)
+ SENDER=$sender check-sender <auth.cdb 2>/dev/null ||
+ bad "invalid sender $sender"
+ ;;
+ t)
+ echo $sender
+ echo "$4"
+ case "$sender" in $4) ;; *) bad "incorrect sender $sender" ;; esac
+ ;;
+esac
+echo +
i += 1
if rx_comment.match(line): continue
f = line.split()
- if len(f) != 3: die('bad info line %d.' % i)
+ if len(f) != 4: die('bad info line %d.' % i)
l = ' '.join(f)
- tag, group, addr = f
+ tag, group, addr, sender = f
group = group.replace('.', '-')
cdb.add('t:%s' % tag, l)
cdb.add('g:%s' % group, l)