Initial import from FreeBSD RELENG_4:
[games.git] / contrib / sendmail / cf / feature / dnsbl.m4
1 divert(-1)
2 #
3 # Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
4 #       All rights reserved.
5 #
6 # By using this file, you agree to the terms and conditions set
7 # forth in the LICENSE file which can be found at the top level of
8 # the sendmail distribution.
9 #
10 #
11
12 dnl 8.13: ifdef(`DNSBL_MAP', `', `define(`DNSBL_MAP', `dns -R A')')
13 ifdef(`DNSBL_MAP', `', `define(`DNSBL_MAP', `host')')
14 divert(0)
15 ifdef(`_DNSBL_R_',`dnl',`dnl
16 VERSIONID(`$Id: dnsbl.m4,v 8.28 2002/05/19 21:22:40 gshapiro Exp $')
17 define(`_DNSBL_R_',`')
18 LOCAL_CONFIG
19 # map for DNS based blacklist lookups
20 Kdnsbl DNSBL_MAP -T<TMP>ifdef(`DNSBL_MAP_OPT',` DNSBL_MAP_OPT')')
21 divert(-1)
22 define(`_DNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
23 define(`_DNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Rejected: " $`'&{client_addr} " listed at '_DNSBL_SRV_`"',`_ARG2_')')dnl
24 define(`_DNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{client_addr} " at '_DNSBL_SRV_`"',`_ARG3_')')dnl
25 divert(8)
26 # DNS based IP address spam list _DNSBL_SRV_
27 R$*                     $: $&{client_addr}
28 R$-.$-.$-.$-            $: <?> $(dnsbl $4.$3.$2.$1._DNSBL_SRV_. $: OK $)
29 R<?>OK                  $: OKSOFAR
30 ifelse(len(X`'_ARG3_),`1',
31 `R<?>$+<TMP>            $: TMPOK',
32 `R<?>$+<TMP>            $#error $@ 4.7.1 $: _DNSBL_MSG_TMP_')
33 R<?>$+                  $#error $@ 5.7.1 $: _DNSBL_MSG_
34 divert(-1)