bestmx_is_local.m4 revision 266692
1divert(-1)
2#
3# Copyright (c) 1998-2000 Proofpoint, 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
15divert(0)
16VERSIONID(`$Id: bestmx_is_local.m4,v 8.27 2013-11-22 20:51:11 ca Exp $')
17divert(-1)
18
19define(`_BESTMX_IS_LOCAL_', _ARG_)
20
21LOCAL_CONFIG
22# turn on bestMX lookup table
23Kbestmx bestmx
24ifelse(defn(`_ARG_'), `', `dnl',`
25# limit bestmx to these domains
26CB`'_ARG_')
27
28LOCAL_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
41ifelse(defn(`_ARG_'), `', `dnl
42# unlimited bestmx
43R$* < @ $* > $*			$: $1 < @ $2 @@ $(bestmx $2 $) > $3',
44`dnl
45# limit bestmx to $=B
46R$* < @ $* $=B . > $*		$: $1 < @ $2 $3 . @@ $(bestmx $2 $3 . $) > $4')
47R$* $=O $* < @ $* @@ $=w . > $*	$@ $>Recurse $1 $2 $3
48R< @ $* @@ $=w . > : $*		$@ $>Recurse $3
49dnl we cannot use _LOCAL_ here since it is defined too late
50R$* < @ $* @@ $=w . > $*	$@ $>CanonLocal < $1 >
51R$* < @ $* @@ $* > $*		$: $1 < @ $2 > $4
52