138032Speterdivert(-1)
238032Speter#
3261194Sgshapiro# Copyright (c) 1998-2000 Proofpoint, Inc. and its suppliers.
464562Sgshapiro#	All rights reserved.
538032Speter# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
638032Speter# Copyright (c) 1988, 1993
738032Speter#	The Regents of the University of California.  All rights reserved.
838032Speter#
938032Speter# By using this file, you agree to the terms and conditions set
1038032Speter# forth in the LICENSE file which can be found at the top level of
1138032Speter# the sendmail distribution.
1238032Speter#
1338032Speter#
1438032Speter
1538032Speterdivert(0)
16266527SgshapiroVERSIONID(`$Id: bestmx_is_local.m4,v 8.27 2013-11-22 20:51:11 ca Exp $')
1738032Speterdivert(-1)
1838032Speter
1990792Sgshapirodefine(`_BESTMX_IS_LOCAL_', _ARG_)
2042575Speter
2138032SpeterLOCAL_CONFIG
2238032Speter# turn on bestMX lookup table
2338032SpeterKbestmx bestmx
2464562Sgshapiroifelse(defn(`_ARG_'), `', `dnl',`
2538032Speter# limit bestmx to these domains
2638032SpeterCB`'_ARG_')
2738032Speter
2838032SpeterLOCAL_NET_CONFIG
2938032Speter
3038032Speter# If we are the best MX for a site, then we want to accept
3138032Speter# its mail as local.  We assume we've already weeded out mail to
3238032Speter# UUCP sites which are connected to us, which should also have
3338032Speter# listed us as their best MX.
3438032Speter#
3538032Speter# Warning: this may generate a lot of extra DNS traffic -- a
3638032Speter# lower cost method is to list all the expected best MX hosts
3738032Speter# in $=w.  This should be fine (and easier to administer) for
3838032Speter# low to medium traffic hosts.  If you use the limited bestmx
3938032Speter# by passing in a set of possible domains it will improve things.
4038032Speter
4164562Sgshapiroifelse(defn(`_ARG_'), `', `dnl
4238032Speter# unlimited bestmx
4338032SpeterR$* < @ $* > $*			$: $1 < @ $2 @@ $(bestmx $2 $) > $3',
4438032Speter`dnl
4538032Speter# limit bestmx to $=B
4638032SpeterR$* < @ $* $=B . > $*		$: $1 < @ $2 $3 . @@ $(bestmx $2 $3 . $) > $4')
4764562SgshapiroR$* $=O $* < @ $* @@ $=w . > $*	$@ $>Recurse $1 $2 $3
4864562SgshapiroR< @ $* @@ $=w . > : $*		$@ $>Recurse $3
4964562Sgshapirodnl we cannot use _LOCAL_ here since it is defined too late
5064562SgshapiroR$* < @ $* @@ $=w . > $*	$@ $>CanonLocal < $1 >
5138032SpeterR$* < @ $* @@ $* > $*		$: $1 < @ $2 > $4
52