Merge from vendor branch SENDMAIL:
[dragonfly.git] / contrib / sendmail-8.13.7 / cf / feature / bestmx_is_local.m4
1 divert(-1)
2 #
3 # Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
4 #       All rights reserved.
5 # Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6 # Copyright (c) 1988, 1993
7 #       The Regents of the University of California.  All rights reserved.
8 #
9 # By using this file, you agree to the terms and conditions set
10 # forth in the LICENSE file which can be found at the top level of
11 # the sendmail distribution.
12 #
13 #
14
15 divert(0)
16 VERSIONID(`$Id: bestmx_is_local.m4,v 8.26 2000/09/17 17:30:00 gshapiro Exp $')
17 divert(-1)
18
19 define(`_BESTMX_IS_LOCAL_', _ARG_)
20
21 LOCAL_CONFIG
22 # turn on bestMX lookup table
23 Kbestmx bestmx
24 ifelse(defn(`_ARG_'), `', `dnl',`
25 # limit bestmx to these domains
26 CB`'_ARG_')
27
28 LOCAL_NET_CONFIG
29
30 # If we are the best MX for a site, then we want to accept
31 # its mail as local.  We assume we've already weeded out mail to
32 # UUCP sites which are connected to us, which should also have
33 # listed us as their best MX.
34 #
35 # Warning: this may generate a lot of extra DNS traffic -- a
36 # lower cost method is to list all the expected best MX hosts
37 # in $=w.  This should be fine (and easier to administer) for
38 # low to medium traffic hosts.  If you use the limited bestmx
39 # by passing in a set of possible domains it will improve things.
40
41 ifelse(defn(`_ARG_'), `', `dnl
42 # unlimited bestmx
43 R$* < @ $* > $*                 $: $1 < @ $2 @@ $(bestmx $2 $) > $3',
44 `dnl
45 # limit bestmx to $=B
46 R$* < @ $* $=B . > $*           $: $1 < @ $2 $3 . @@ $(bestmx $2 $3 . $) > $4')
47 R$* $=O $* < @ $* @@ $=w . > $* $@ $>Recurse $1 $2 $3
48 R< @ $* @@ $=w . > : $*         $@ $>Recurse $3
49 dnl we cannot use _LOCAL_ here since it is defined too late
50 R$* < @ $* @@ $=w . > $*        $@ $>CanonLocal < $1 >
51 R$* < @ $* @@ $* > $*           $: $1 < @ $2 > $4