divert(-1) # # Copyright (c) 1998 Claus Assmann # # In short: you can do whatever you want with this, but don't blame me! # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # ifdef(`_JUNK_INCL_',`dnl', `define(`SM89_LOCAL',`ifdef(`SM89',`Local_',`')') define(`tokenize',`ifdef(`SM89',`$1',`$`'(dequote "" $1 $`')')')') define(`_JUNK_INCL_',`1') define(`_JUNK_IP_RULES_',`R$`'+ $`'| $`'+ $`': $`'1 $`'| $`'>junkIP $`'2 R$`'+ $`'| JUNK@JUNK $`'#error $`'@ 5.7.1 $`': _ERR_MSG_IP_ R$`'+ $`'| $`'*@JUNK $`'#error $`'@ 5.7.1 $`': $`'2') ifdef(`_ERR_MSG_DOM_',`',`define(`_ERR_MSG_DOM_',`"501 This domain (" $`'2 ") is banned, contact your local admin."')') ifdef(`_ERR_MSG_USER_',`',`define(`_ERR_MSG_USER_',`"501 You are banned, contact your local admin."')') ifdef(`_ERR_MSG_USER_JUNK_',`',`define(`_ERR_MSG_USER_JUNK_',`"501 You (" $`'2 ") are banned, contact your local admin."')') ifdef(`_ERR_MSG_REGEX_',`',`define(`_ERR_MSG_REGEX_',`"501 spam address, go away."')') ifdef(`_ERR_MSG_IP_',`',`define(`_ERR_MSG_IP_',`"550 access from your IP address denied."')')dnl ifdef(`_ERR_MSG_HOST_',`',`define(`_ERR_MSG_HOST_',`"550 access from your hostname denied."')')dnl ifdef(`_ERR_MSG_URRH_',`',`define(`_ERR_MSG_URRH_',`"451 unresolvable relay host name [" $`'2 "]; check your reverse-IP configuration."')')dnl ifdef(`_CHECK_MAP_TYPE_',`',`define(`_CHECK_MAP_TYPE_',`dbm')')dnl ifdef(`_MARK_',`define(`_MARK_NET_',`:net')',`define(`_MARK_NET_',`')')dnl ifdef(`_MARK_',`define(`_MARK_DOM_',`:dom')',`define(`_MARK_DOM_',`')')dnl ifdef(`_MARK_',`define(`_MARK_LOC_',`:loc')',`define(`_MARK_LOC_',`@')')dnl ifdef(`_JUNK_MAP_LOC_',,`define(`_JUNK_MAP_LOC_',`/etc/mail/junk')')dnl divert(0) VERSIONID(`@(#)junk.m4 1.0.9 (Claus Assmann) 1998-08-24') PUSHDIVERT(6) ifdef(`_JUNK_MAP_REQ_',`ifdef(`_JUNK_MAP_',`dnl',` # file containing full e-mail addresses of spammers (for check_mail): # spammer@address.domain`'_MARK_DOM_ "Error-Code Error-Text" # spammer@address.domain`'_MARK_DOM_ SPAMMER # or junk domains (for check_mail, check_relay): # junk.domain`'_MARK_DOM_ "Error-Code Error-Text" # junk.domain`'_MARK_DOM_ JUNK # or IP addresses (for check_relay): # D.X.Y.Z`'_MARK_NET_ "Error-Code Error-Text" # C.X.Y`'_MARK_NET_ "Error-Code Error-Text" # B.X`'_MARK_NET_ "Error-Code Error-Text" # A`'_MARK_NET_ "Error-Code Error-Text" Kjunk ifelse(_ARG_, `', `_CHECK_MAP_TYPE_ -a@JUNK _JUNK_MAP_LOC_', `_ARG_') define(`_JUNK_MAP_',`1')dnl')',`dnl') POPDIVERT divert(2) LOCAL_RULESETS ifdef(`_CHECK_JUNK_IP_REQ_',`ifdef(`_CHECK_JUNK_IP_',`dnl',`SjunkIP # lookup IP in database # full IP address R$-.$-.$-.$- $: $(junk $1.$2.$3.$4`'_MARK_NET_ $: $1.$2.$3.$4 $) # class C net R$-.$-.$-.$- $: $(junk $1.$2.$3`'_MARK_NET_ $: $1.$2.$3.$4 $) # class B net R$-.$-.$-.$- $: $(junk $1.$2`'_MARK_NET_ $: $1.$2.$3.$4 $) # class A net R$-.$-.$-.$- $: $(junk $1`'_MARK_NET_ $: $1.$2.$3.$4 $) define(`_CHECK_JUNK_IP_',`1')dnl')',`dnl') ifdef(`_CHECK_JUNK_REQ_',`ifdef(`_CHECK_JUNK_',`dnl',`Sjunk # check for junk domain/spammers # lookup domain in database R$*<@$+> $:$1<@$(junk $2`'_MARK_DOM_ $:$2 $)> $| $2 # exists? return R$*<@JUNK@JUNK> $| $* $@$1<@ _ERR_MSG_DOM_ @JUNK> R$*<@$*@JUNK> $| $* $@$1<@$2@JUNK> # lookup address in database R$*<@$+> $| $* $:$1<@$(junk $1@$2`'_MARK_DOM_ $:$2$)> $| $1@$2 # exists? return R$*<@SPAMMER@JUNK> $| $* $@$1<@ _ERR_MSG_USER_JUNK_ @JUNK> R$*<@JUNK@JUNK> $| $* $@$1<@ _ERR_MSG_USER_JUNK_ @JUNK> R$*<@$*@JUNK> $| $* $@$1<@$2@JUNK> # remove one subdomain, try again ifdef(`_CHECK_TOPLEVEL_',dnl R$*<@$+.$+> $| $* $: $>junk $1<@$3>, R$*<@$+.$+.$+> $| $* $: $>junk $1<@$3.$4>) define(`_CHECK_JUNK_',`1')dnl')',`dnl') ifdef(`_CHECK_DOMAINMAP_REQ_',`ifdef(`_CHECK_DOMAINMAP_',`dnl',`SDomainMap # lookup domain in database (given as @map, must have -a@MATCH) R$*<@$+>@$- $:$1<@$($3 $2`'_MARK_DOM_ $:$2 $)>@$3 # exists? return R$*<@$+@MATCH>@$- $@$1<@$2@MATCH> # lookup address in database R$*<@$+>@$- $:$1<@$($3 $1@$2`'_MARK_DOM_ $:$2$)>@$3 # exists? return R$*<@$+@MATCH>@$- $@$1<@$2@MATCH> # remove one subdomain, try again ifdef(`_CHECK_TOPLEVEL_',dnl R$*<@$+.$+>@$- $: $>DomainMap $1<@$3>@$4, R$*<@$+.$+.$+>@$- $: $>DomainMap $1<@$3.$4>@$5) define(`_CHECK_DOMAINMAP_',`1')dnl')',`dnl') ifdef(`_CHECK_IPMAP_REQ_',`ifdef(`_CHECK_IPMAP_',`dnl',` SIPMap # lookup IP in database (given as .map) # full IP address R$-.$-.$-.$-.$- $: $($5 $1.$2.$3.$4`'_MARK_NET_ $: $1.$2.$3.$4.$5$) # class C net R$-.$-.$-.$-.$- $: $($5 $1.$2.$3`'_MARK_NET_ $: $1.$2.$3.$4.$5 $) # class B net R$-.$-.$-.$-.$- $: $($5 $1.$2`'_MARK_NET_ $: $1.$2.$3.$4.$5 $) # class A net R$-.$-.$-.$-.$- $: $($5 $1`'_MARK_NET_ $: $1.$2.$3.$4.$5 $) # remove name of map (attention: -a is not allowed to start with . !) R$-.$-.$-.$-.$- $: $1.$2.$3.$4 define(`_CHECK_IPMAP_',`1')dnl')',`dnl') divert(0)