divert(-1)
#
-# Copyright (c) 1983 Eric P. Allman
+# Copyright (c) 1983, 1995 Eric P. Allman
# Copyright (c) 1988, 1993
# The Regents of the University of California. All rights reserved.
#
-# %sccs.include.redist.sh%
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the University of
+# California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
#
divert(0)
-VERSIONID(`@(#)proto.m4 8.63 (Berkeley) %G%')
+VERSIONID(`@(#)proto.m4 8.80 (Berkeley) 6/10/95')
MAILER(local)dnl
V6/Berkeley
divert(-1)
+# do some sanity checking
+ifdef(`__OSTYPE__',,
+ `errprint(`*** ERROR: No system type defined (use OSTYPE macro)')')
+
# pick our default mailers
ifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')
ifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')
DB`'BITNET_RELAY
CPBITNET
+')dnl
+ifdef(`DECNET_RELAY',
+`define(`_USE_DECNET_SYNTAX_')dnl
+# DECnet relay host
+DC`'DECNET_RELAY
+CPDECNET
+
')dnl
ifdef(`FAX_RELAY',
`# FAX relay host
# class L: names that should be delivered locally, even if we have a relay
# class E: names that should be exposed as from this host, even if we masquerade
-# class D: dotted names, e.g., root.machinename
#CL root
CE root
undivert(5)dnl
-ifdef(`__DOTTED_USER_LIST__',
- `__DOTTED_USER_LIST__',
- `#CD postmaster')
# dequoting map
Kdequote dequote
_OPTION(SuperSafe, `confSAFE_QUEUE')
# status file
-_OPTION(StatusFile, `STATUS_FILE', /etc/sendmail.st)
+O StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', /etc/sendmail.st)
# time zone handling:
# if undefined, use system default
# work time factor
_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
-# do our SMTP peers choke on multi-line greeting messages?
-_OPTION(BrokenSmtpPeers, `confBROKEN_SMTP_PEERS')
-
# shall we sort the queue by hostname first?
_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
# chrooted environment for writing to files
_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch)
+# are colons OK in addresses?
+_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR')
+
+# how many jobs can you process in the queue?
+_OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', 10000)
+
+# shall I avoid expanding CNAMEs (violates protocols)?
+_OPTION(DontExpandCnames, `confDONT_EXPAND_CNAMES')
+
###########################
# Message precedences #
###########################
# handle null input (translate to <@> special case)
R$@ $@ <@>
+# strip group: syntax (not inside angle brackets!) and trailing semicolon
+R$* $: $1 <@> mark addresses
+R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
+R$* :: $* <@> $: $1 :: $2 unmark node::addr
+R:`include': $* <@> $: :`include': $1 unmark :`include':...
+R$* : $* <@> $: $2 strip colon if marked
+R$* <@> $: $1 unmark
+R$* ; $: $1 strip trailing semi
+
+# null input now results from list:; syntax
+R$@ $@ :; <@>
+
# basic textual canonicalization -- note RFC733 heuristic here
R$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <>
R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting
R$*<>$* $@ <@> MAIL FROM:<> case
R$*<$+>$* $2 basic RFC821/822 parsing
-# handle list:; syntax as special case
-R$*:;$* $@ $1 :; <@>
-
# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
R@ $+ , $+ @ $1 : $2 change all "," to ":"
`# convert old-style addresses to a domain-based address
R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains')
-
+R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
+')
+ifdef(`_USE_DECNET_SYNTAX_',
+`# convert node::user addresses into a domain-based address
+R$- :: $+ $@ $>96 $2 < @ $1 .DECNET > resolve DECnet names
+R$- . $- :: $+ $@ $>96 $3 < @ $1.$2 .DECNET > numeric DECnet addr
+',
+ `dnl')
# if we have % signs, take the rightmost one
R$* % $* $1 @ $2 First make them all @s.
R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
# else we must be a local name
+R$* $@ $>96 $1
################################################
### Ruleset 96 -- bottom half of ruleset 3 ###
################################################
-# At this point, everything should be in a "local_part<@domain>extra" format.
S96
# handle special cases for local names
##################################################
S4
-R$*<@> $@ $1 handle <> and list:;
+R$* <@> $@ handle <> and list:;
# strip trailing dot off possibly canonical name
R$* < @ $+ . > $* $1 < @ $2 > $3
`# UUCP must always be presented in old form
R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u')
+ifdef(`_USE_DECNET_SYNTAX_',
+`# put DECnet back in :: form
+R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u',
+ `dnl')
# delete duplicate local names
R$+ % $=w @ $=w $1 @ $j u%host@host => u@host
S0
R<@> $#_LOCAL_ $: <@> special case error msgs
-R$* : $* ; $#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
-R<@ $+> $#error $@ USAGE $: "user address required"
-R$* <$* : $* > $* $#error $@ USAGE $: "colon illegal in host name part"
-R$* < @ . > $* $#error $@ USAGE $: "invalid host name"
+R$* : $* ; <@> $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses"
+R<@ $+> $#error $@ 5.1.1 $: "user address required"
+R$* <$* : $* > $* $#error $@ 5.1.1 $: "colon illegal in host name part"
+R$* < @ . > $* $#error $@ 5.1.2 $: "invalid host name"
ifdef(`_MAILER_smtp_',
`# handle numeric address spec
R$* $: $>98 $1
# short circuit local delivery so forwarded email works
-R$* < @ $=w . > $: < $R @ $H > $1 < @ $2 . > if both relay & hub ...
-R<$+ @ $+ > $* < $+ > $: $>_SET_95_ < $H > $3 < $4 > ... send direct to hub
-R<$* @ $* > $* < $+ > $: $3 < $4 >
+ifdef(`_MAILER_usenet_',
+`R$+ . USENET < @ $=w . > $#usenet $: $1 handle usenet specially',
+ `dnl')
ifdef(`_STICKY_LOCAL_DOMAIN_',
`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub
-R< $+ > $+ < $+ > $#_LOCAL_ $: $2 yep ....
-R< > $=D . $+ < $+ > $#_LOCAL_ $: $1 . $2 dotted name?
+R< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep ....
R< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name?
R< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address',
-`R$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly',
-`R$+ < @ $=w . > $: $>_SET_95_ < $H > $1 < @ $2 . > sticky local names
-R$+ < @ $=w . > $#_LOCAL_ $: @ $1 sticky local names')
+`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names
+R$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name')
+ifdef(`MAILER_TABLE',
+`
+# not local -- try mailer table lookup
+R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name
+R< $+ . > $* $: < $1 > $2 strip trailing dot
+R< $+ > $* $: < $(mailertable $1 $) > $2 lookup
+R< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved?
+R< $+ > $* $: $>90 <$1> $2 try domain',
+`dnl')
undivert(4)dnl
ifdef(`_NO_UUCP_', `dnl',
`# resolve remotely connected UUCP links (if any)
ifdef(`_CLASS_V_',
-`R$* < @ $=V . UUCP > $* $#smtp $@ $V $: @ $V : $1 @ $2.UUCP $3',
+`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3',
`dnl')
ifdef(`_CLASS_W_',
-`R$* < @ $=W . UUCP > $* $#smtp $@ $W $: @ $W : $1 @ $2.UUCP $3',
+`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3',
`dnl')
ifdef(`_CLASS_X_',
-`R$* < @ $=X . UUCP > $* $#smtp $@ $X $: @ $X : $1 @ $2.UUCP $3',
+`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3',
`dnl')')
# resolve fake top level domains by forwarding to other hosts
ifdef(`BITNET_RELAY',
-`R$*<@$+.BITNET>$* $#smtp $@ $B $: $1 @ $2 . BITNET $3 user@host.BITNET',
-`R$*<@$+.CSNET>$* $#smtp $@ $C $: $1 @ $2 . CSNET $3 user@host.CSNET',
+`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET',
+ `dnl')
+ifdef(`DECNET_RELAY',
+`R$*<@$+.DECNET.>$* $: $>95 < $C > $1 <@$2.DECNET.> $3 user@host.DECNET',
`dnl')
ifdef(`_MAILER_pop_',
`R$+ < @ POP. > $#pop $: $1 user@POP',
ifdef(`_MAILER_fax_',
`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX',
`ifdef(`FAX_RELAY',
-`R$*<@$+.FAX>$* $#smtp $@ $F $: $1 @ $2 . FAX $3 user@host.FAX',
+`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX',
`dnl')')
ifdef(`UUCP_RELAY',
`# forward non-local UUCP traffic to our UUCP relay
-R$*<@$*.UUCP>$* $#smtp $@ $Y $: @ $Y : $1 @ $2.UUCP $3 uucp mail',
+R$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail',
`ifdef(`_MAILER_uucp_',
`# forward other UUCP traffic straight to UUCP
R$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP',
ifdef(`_LOCAL_RULES_',
`# figure out what should stay in our local mail system
-R$* < @ $* > $* $#smtp $@ $2 $: $1 @ $2 $3 user@host.domain')')
+undivert(1)', `dnl')
+
# pass names that still have a host to a smarthost (if defined)
R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
# deal with other remote names
ifdef(`_MAILER_smtp_',
`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain',
-`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2')
+`R$* < @$* > $* $#error $@ 5.1.2 $: Unrecognized host name $2')
# if this is quoted, strip the quotes and try again
R$+ $: $(dequote $1 $) strip quotes
R$+ $=O $+ $@ $>97 $1 $2 $3 try again
# handle locally delivered names
-R$=L $: $>_SET_95_ < $H > $1 special local names
R$=L $#_LOCAL_ $: @ $1 special local names
R$+ $#_LOCAL_ $: $1 regular local names
S5
-# if we have a "special dotted user", convert it back to the base name
-R$=D . * $#_LOCAL_ $: $1
-R$=D . $+ $#_LOCAL_ $: $1 . *
+# deal with plussed users so aliases work nicely
+R$+ + * $#_LOCAL_ $@ $&h $: $1
+R$+ + $* $#_LOCAL_ $@ $2 $: $1 + *
# prepend an empty "forward host" on the front
R$+ $: <> $1
R< > $+ + $* $#_LOCAL_ $@ $2 $: $1
# see if we have a relay or a hub
-R$+ $: $>_SET_95_ < $R > $1 try relay
-R$+ $: $>_SET_95_ < $H > $1 try hub')
+R< > $+ $: < $H > $1 try hub
+R< > $+ $: < $R > $1 try relay
+R< > $+ $@ $1 nope, give up
+R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
+R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
ifdef(`MAILER_TABLE',
`
###################################################################
S90
-R<$*> <$- $+ > $* $: < $1 . $2 > < $3 > $4
-R<. $+ > $+ $: < $1 > $2
-R< $+ > < > $+ $: < $1 > < . > $2
-R<$*> < $+ > $* $: <$1> < $(mailertable $2 $@ $1 $) > $3 lookup
-R<$+> <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved?
-R$* $: $>87 $1
-R<$+> < . $+ > $*<$*> $@ $>90 <$1> <$2> $3<$4> no -- strip & try again
-R$* $: $>88 $1
-R<$+> <$*> $* $@ $3 no match',
+R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
+R$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved?
+R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again
+R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "."
+R<$- : $+ > $* $# $1 $@ $2 $: $3 "." found?
+R< $* > $* $@ $2 no mailertable match',
`dnl')
###################################################################