xref: /illumos-gate/usr/src/cmd/sendmail/cf/feature/bestmx_is_local.m4 (revision 628e3cbed6489fa1db545d8524a06cd6535af456)
1divert(-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#ident	"%Z%%M%	%I%	%E% SMI"
14#
15
16divert(0)
17VERSIONID(`$Id: bestmx_is_local.m4,v 8.26 2000/09/17 17:30:00 gshapiro Exp $')
18divert(-1)
19
20define(`_BESTMX_IS_LOCAL_', _ARG_)
21
22LOCAL_CONFIG
23# turn on bestMX lookup table
24Kbestmx bestmx
25ifelse(defn(`_ARG_'), `', `dnl',`
26# limit bestmx to these domains
27CB`'_ARG_')
28
29LOCAL_NET_CONFIG
30
31# If we are the best MX for a site, then we want to accept
32# its mail as local.  We assume we've already weeded out mail to
33# UUCP sites which are connected to us, which should also have
34# listed us as their best MX.
35#
36# Warning: this may generate a lot of extra DNS traffic -- a
37# lower cost method is to list all the expected best MX hosts
38# in $=w.  This should be fine (and easier to administer) for
39# low to medium traffic hosts.  If you use the limited bestmx
40# by passing in a set of possible domains it will improve things.
41
42ifelse(defn(`_ARG_'), `', `dnl
43# unlimited bestmx
44R$* < @ $* > $*			$: $1 < @ $2 @@ $(bestmx $2 $) > $3',
45`dnl
46# limit bestmx to $=B
47R$* < @ $* $=B . > $*		$: $1 < @ $2 $3 . @@ $(bestmx $2 $3 . $) > $4')
48R$* $=O $* < @ $* @@ $=w . > $*	$@ $>Recurse $1 $2 $3
49R< @ $* @@ $=w . > : $*		$@ $>Recurse $3
50dnl we cannot use _LOCAL_ here since it is defined too late
51R$* < @ $* @@ $=w . > $*	$@ $>CanonLocal < $1 >
52R$* < @ $* @@ $* > $*		$: $1 < @ $2 > $4
53