smmapdfw/smmapd_prototype/verifysender.m4
2004-09-20 19:34:09 +00:00

111 lines
3.3 KiB
Plaintext

VERSIONID(`$Id$')
divert(-1)
define(`_USAGE_', `dnl
errprint(`*** ERROR: missing argument for FEATURE(verifysender):
Usage: FEATURE(`verifysender', `_mode_', `_return_')
_mode_: black or white
_return_: temp or perm
found: $1
')')
ifelse(_ARG_, `black', `', `
ifelse(_ARG_, `white', `', `
_USAGE_(`_mode_: ('_ARG_`)
')
')')
ifelse(_ARG2_, `temp', `', `
ifelse(_ARG2_, `perm', `', `
_USAGE_(`_return_: ('_ARG2_`)
')
')')
define(`_mode_', _ARG_)
define(`_return_', _ARG2_)
errprint(`*** _mode_: '_mode_`
')
errprint(`*** _return_: '_return_`
')
define(`_T_DSN_', `4.1.0')
define(`_T_REPLY', `451')
ifelse(_return_, `temp', `
define(`_DSN_', _T_DSN_)
define(`_REPLY_', _T_REPLY)', `dnl
define(`_DSN_', `5.1.0')
define(`_REPLY_', `550')')
ifelse(defn(`confVERIFIER_MAP'), `', `
define(`_VERIFIER_MAP_', `inet:8884@127.0.0.1')', `
define(`_VERIFIER_MAP_', confVERIFIER_MAP)')
ifelse(defn(`confVERIFIER_BLACKLIST'), `', `
define(`_VERIFIER_BLACKLIST_', `/etc/mail/verifier-black-list')', `
define(`_VERIFIER_BLACKLIST_', confVERIFIER_BLACKLIST)')
ifelse(defn(`confVERIFIER_WHITELIST'), `', `
define(`_VERIFIER_WHITELIST_', `/etc/mail/verifier-white-list')', `
define(`_VERIFIER_WHITELIST_', confVERIFIER_WHITELIST)')
divert(0)
LOCAL_CONFIG
# Adjust the port
Kverifier socket -T<temp> _VERIFIER_MAP_
ifelse(_mode_, `white', `dnl
Kverifier_helper hash -o _VERIFIER_WHITELIST_', `dnl
Kverifier_helper hash _VERIFIER_BLACKLIST_')
C{verifier_fix_white} postmaster
LOCAL_RULESETS
# This ruleset can be used to test the verifier in -bt mode
Svt
R$+ $: < $(verifier $1 $:none $) >
Sverifier0
R< $={verifier_fix_white} @ $+ > $@ < ok >
R< $+ @ $+ > $: < $2 > < $(verifier_helper $1 @ $2 $: $) >
R< $+ > < > $: < $(verifier_helper $1 $: $) >
ifelse(_mode_, `white', `dnl
dnl if we found nothing in the whitelist, we continue with checking
R< > $@ < cont >
dnl if we found something in the whitelist, we skip further verifications
R< $+ > $@ < ok >', `dnl
dnl if we found nothing in the blacklist, we skip further verifications
R< > $@ < ok >
dnl if we found something in the blacklist, we continue with checking
R< $+ > $@ < cont >')
Sverifier1
R< $+ > $: < $(verifier $1 $:none $) >
R< $* < temp > > $#error $@ _T_DSN_ $: "_T_REPLY_ Sender Address could currently not be verified (1)"
R< none > $#error $@ _T_DSN_ $: "_T_REPLY_ Sender Address could currently not be verified (2)"
R< <OK> $* > $@ < ok >
R< <NOK> < $* > > $#error $@ _DSN_ $: "_REPLY_ Sender Address was verified as bad: " $1
R< <TNOK> < $* > > $#error $@ _T_DSN_ $: "_T_REPLY_ Sender Address could currently not be verified (3): " $1
dnl if we get here, some is wrong with our code
R$* $#error $@ 4.7.1 $: "451 Local configuration error <sv1>"
SLocal_check_mail
dnl MAILER-DAEMON address must not be verified
R<> $@ <>
dnl try to focus
R$+ $: <> $>3 $1
R<> $+ < @ $+ . > $: < $1 @ $2 >
R<> $+ < @ $+ > $: < $1 @ $2 >
dnl if unable to focus, rest of check_mail should take care (may be we should reject)
R<> $* $@ OK
R< $+ @ $+ > $: < $1 @ $2 > $>verifier0 < $1 @ $2 >
R< $+ @ $+ > < cont > $: < $1 @ $2 > $>verifier1 < $1 @ $2 >
R< $+ @ $+ > $# $* $# $3
R< $+ @ $+ > < ok > $@ OK
dnl if we get here, some is wrong with our code
R$* $#error $@ 4.7.1 $: "451 Local configuration error <sv2>"