BSD 4_4_Lite2 release
[unix-history] / usr / src / usr.sbin / sendmail / cf / m4 / proto.m4
index fb4e903..c72d3f0 100644 (file)
@@ -1,40 +1,86 @@
 divert(-1)
 #
 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.
 #
 # 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)
 
 #
 divert(0)
 
-VERSIONID(`@(#)proto.m4        8.17 (Berkeley) %G%')
+VERSIONID(`@(#)proto.m4        8.80 (Berkeley) 6/10/95')
 
 MAILER(local)dnl
 
 
 MAILER(local)dnl
 
-ifdef(`_OLD_SENDMAIL_',
-`define(`_SET_95_', 5)dnl
-define(`_SET_96_', 6)dnl
-define(`_SET_97_', 7)dnl
-define(`_SET_98_', 8)dnl
-define(`confDOMAIN_NAME',
-       `ifdef(`NEED_DOMAIN', `$w.$d', `$w')')dnl',
-`# level 5 config file format
-V5
-define(`_SET_95_', 95)dnl
-define(`_SET_96_', 96)dnl
-define(`_SET_97_', 97)dnl
-define(`_SET_98_', 98)dnl')
-ifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl
-ifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl
+# level 6 config file format
+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')')
 ifdef(`confRELAY_MAILER',,
        `define(`confRELAY_MAILER',
                `ifdef(`_MAILER_smtp_', `relay',
 ifdef(`confRELAY_MAILER',,
        `define(`confRELAY_MAILER',
                `ifdef(`_MAILER_smtp_', `relay',
-                       `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl
+                       `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')
 define(`_SMTP_', `confSMTP_MAILER')dnl         for readability only
 define(`_LOCAL_', `confLOCAL_MAILER')dnl       for readability only
 define(`_RELAY_', `confRELAY_MAILER')dnl       for readability only
 
 define(`_SMTP_', `confSMTP_MAILER')dnl         for readability only
 define(`_LOCAL_', `confLOCAL_MAILER')dnl       for readability only
 define(`_RELAY_', `confRELAY_MAILER')dnl       for readability only
 
+# back compatibility with old config files
+ifdef(`confDEF_GROUP_ID',
+       `errprint(`*** confDEF_GROUP_ID is obsolete.')
+        errprint(`    Use confDEF_USER_ID with a colon in the value instead.')')
+ifdef(`confREAD_TIMEOUT',
+       `errprint(`*** confREAD_TIMEOUT is obsolete.')
+        errprint(`    Use individual confTO_<timeout> parameters instead.')')
+ifdef(`confMESSAGE_TIMEOUT',
+       `define(`_ARG_', index(confMESSAGE_TIMEOUT, /))
+        ifelse(_ARG_, -1,
+               `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)',
+               `define(`confTO_QUEUERETURN',
+                       substr(confMESSAGE_TIMEOUT, 0, _ARG_))
+                define(`confTO_QUEUEWARN',
+                       substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')')
+ifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,,
+       `errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.')
+        errprint(`    Use confMAX_MESSAGE_SIZE for the second part of the value.')')')
+
+# clean option definitions below....
+define(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl
+
+divert(0)dnl
+
 ##################
 #   local info   #
 ##################
 ##################
 #   local info   #
 ##################
@@ -44,14 +90,12 @@ ifdef(`USE_CW_FILE',
 `# file containing names of hosts for which we receive email
 Fw`'confCW_FILE',
        `dnl')
 `# file containing names of hosts for which we receive email
 Fw`'confCW_FILE',
        `dnl')
-ifdef(`confDOMAIN_NAME', `
+
 # my official domain name
 # my official domain name
-Dj`'confDOMAIN_NAME',
-       `dnl')
+# ... define this only if sendmail cannot automatically determine your domain
+ifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM')
 
 
-ifdef(`_NULL_CLIENT_ONLY_',
-`include(../m4/nullrelay.m4)m4exit',
-       `dnl')
+ifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl
 
 CP.
 
 
 CP.
 
@@ -67,10 +111,11 @@ DB`'BITNET_RELAY
 CPBITNET
 
 ')dnl
 CPBITNET
 
 ')dnl
-ifdef(`CSNET_RELAY',
-`# CSNET relay host
-DC`'CSNET_RELAY
-CPCSNET
+ifdef(`DECNET_RELAY',
+`define(`_USE_DECNET_SYNTAX_')dnl
+# DECnet relay host
+DC`'DECNET_RELAY
+CPDECNET
 
 ')dnl
 ifdef(`FAX_RELAY',
 
 ')dnl
 ifdef(`FAX_RELAY',
@@ -82,6 +127,18 @@ CPFAX
 # "Smart" relay host (may be null)
 DS`'ifdef(`SMART_HOST', SMART_HOST)
 
 # "Smart" relay host (may be null)
 DS`'ifdef(`SMART_HOST', SMART_HOST)
 
+ifdef(`LUSER_RELAY',
+`# place to which unknown users should be forwarded
+Kuser user -m -a<>
+DL`'LUSER_RELAY
+', `dnl')
+
+# operators that cannot be in local usernames (i.e., network indicators)
+CO @ % ifdef(`_NO_UUCP_', `', `!')
+
+# a class with just dot (for identifying canonical names)
+C..
+
 ifdef(`MAILER_TABLE',
 `# Mailer table (overriding domains)
 Kmailertable MAILER_TABLE
 ifdef(`MAILER_TABLE',
 `# Mailer table (overriding domains)
 Kmailertable MAILER_TABLE
@@ -98,24 +155,18 @@ DR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
 # who gets all local email traffic ($R has precedence for unqualified names)
 DH`'ifdef(`MAIL_HUB', MAIL_HUB)
 
 # who gets all local email traffic ($R has precedence for unqualified names)
 DH`'ifdef(`MAIL_HUB', MAIL_HUB)
 
-# who I masquerade as (can be $j)
-DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)
-
 # 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 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
-CLroot
-CEroot
+#CL root
+CE root
 undivert(5)dnl
 
 undivert(5)dnl
 
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % ifdef(`_NO_UUCP_', `', `!')
-
-# a class with just dot (for identifying canonical names)
-C..
+# dequoting map
+Kdequote dequote
 
 
-ifdef(`_OLD_SENDMAIL_', `dnl',
-`# dequoting map
-Kdequote dequote')
+divert(0)dnl
+# who I masquerade as (null for no masquerading)
+DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
 
 undivert(6)dnl
 
 
 undivert(6)dnl
 
@@ -136,8 +187,7 @@ Dn`'confMAILER_NAME
 Do`'confOPERATORS
 
 # format of a total name
 Do`'confOPERATORS
 
 # format of a total name
-Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER,
-       ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))
+Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.')
 include(`../m4/version.m4')
 
 ###############
 include(`../m4/version.m4')
 
 ###############
@@ -145,177 +195,206 @@ include(`../m4/version.m4')
 ###############
 
 # strip message body to 7 bits on input?
 ###############
 
 # strip message body to 7 bits on input?
-O7`'confSEVEN_BIT_INPUT
+_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT')
+
+# 8-bit data handling
+_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive)
 
 
-# wait (in minutes) for alias file rebuild
-Oa`'confALIAS_WAIT
+# wait for alias file rebuild (default units: minutes)
+_OPTION(AliasWait, `confALIAS_WAIT', 5m)
 
 # location of alias file
 
 # location of alias file
-OA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)
+O AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
 
 # minimum number of free blocks on filesystem
 
 # minimum number of free blocks on filesystem
-Ob`'confMIN_FREE_BLOCKS
+_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100)
+
+# maximum message size
+_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000)
 
 # substitution for space (blank) characters
 
 # substitution for space (blank) characters
-OB`'confBLANK_SUB
+_OPTION(BlankSub, `confBLANK_SUB', _)
 
 
-# connect to "expensive" mailers on initial submission?
-Oc`'confCON_EXPENSIVE
+# avoid connecting to "expensive" mailers on initial submission?
+_OPTION(HoldExpensive, `confCON_EXPENSIVE')
 
 # checkpoint queue runs after every N successful deliveries
 
 # checkpoint queue runs after every N successful deliveries
-OC`'confCHECKPOINT_INTERVAL
+_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10)
 
 # default delivery mode
 
 # default delivery mode
-Od`'confDELIVERY_MODE
+_OPTION(DeliveryMode, `confDELIVERY_MODE', background)
 
 # automatically rebuild the alias database?
 
 # automatically rebuild the alias database?
-OD`'confAUTO_REBUILD
+_OPTION(AutoRebuildAliases, `confAUTO_REBUILD')
 
 # error message header/file
 
 # error message header/file
-ifdef(`confERROR_MESSAGE',
-       OE`'confERROR_MESSAGE,
-       #OE/etc/sendmail.oE)
+_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE)
 
 # error mode
 
 # error mode
-ifdef(`confERROR_MODE',
-       Oe`'confERROR_MODE,
-       #Oep)
+_OPTION(ErrorMode, `confERROR_MODE', print)
 
 # save Unix-style "From_" lines at top of header?
 
 # save Unix-style "From_" lines at top of header?
-Of`'confSAVE_FROM_LINES
+_OPTION(SaveFromLine, `confSAVE_FROM_LINES')
 
 # temporary file mode
 
 # temporary file mode
-OF`'confTEMP_FILE_MODE
+_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600)
 
 # match recipients against GECOS field?
 
 # match recipients against GECOS field?
-OG`'confMATCH_GECOS
-
-# default GID
-Og`'confDEF_GROUP_ID
+_OPTION(MatchGECOS, `confMATCH_GECOS')
 
 # maximum hop count
 
 # maximum hop count
-Oh`'confMAX_HOP
+_OPTION(MaxHopCount, `confMAX_HOP', 17)
 
 # location of help file
 
 # location of help file
-OH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
+O HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
 
 # ignore dots as terminators in incoming messages?
 
 # ignore dots as terminators in incoming messages?
-Oi`'confIGNORE_DOTS
+_OPTION(IgnoreDots, `confIGNORE_DOTS')
 
 
-# Insist that the BIND name server be running to resolve names
-ifdef(`confBIND_OPTS',
-       OI`'confBIND_OPTS,
-       #OI)
+# name resolver options
+_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY)
 
 # deliver MIME-encapsulated error messages?
 
 # deliver MIME-encapsulated error messages?
-Oj`'confMIME_FORMAT_ERRORS
+_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS')
 
 # Forward file search path
 
 # Forward file search path
-ifdef(`confFORWARD_PATH',
-       OJ`'confFORWARD_PATH,
-       #OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
+_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)
 
 # open connection cache size
 
 # open connection cache size
-Ok`'confMCI_CACHE_SIZE
+_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2)
 
 # open connection cache timeout
 
 # open connection cache timeout
-OK`'confMCI_CACHE_TIMEOUT
+_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m)
 
 # use Errors-To: header?
 
 # use Errors-To: header?
-Ol`'confUSE_ERRORS_TO
+_OPTION(UseErrorsTo, `confUSE_ERRORS_TO')
 
 # log level
 
 # log level
-OL`'confLOG_LEVEL
+_OPTION(LogLevel, `confLOG_LEVEL', 10)
 
 # send to me too, even in an alias expansion?
 
 # send to me too, even in an alias expansion?
-Om`'confME_TOO
+_OPTION(MeToo, `confME_TOO')
 
 # verify RHS in newaliases?
 
 # verify RHS in newaliases?
-On`'confCHECK_ALIASES
+_OPTION(CheckAliases, `confCHECK_ALIASES')
 
 # default messages to old style headers if no special punctuation?
 
 # default messages to old style headers if no special punctuation?
-Oo`'confOLD_STYLE_HEADERS
+_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS')
 
 # SMTP daemon options
 
 # SMTP daemon options
-ifdef(`confDAEMON_OPTIONS',
-       OO`'confDAEMON_OPTIONS,
-       #OOPort=esmtp)
+_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp)
 
 # privacy flags
 
 # privacy flags
-Op`'confPRIVACY_FLAGS
+_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings)
 
 # who (if anyone) should get extra copies of error messages
 
 # who (if anyone) should get extra copies of error messages
-ifdef(`confCOPY_ERRORS_TO',
-       OP`'confCOPY_ERRORS_TO,
-       #OPPostmaster)
+_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster)
 
 # slope of queue-only function
 
 # slope of queue-only function
-ifdef(`confQUEUE_FACTOR',
-       Oq`'confQUEUE_FACTOR,
-       #Oq600000)
+_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000)
 
 # queue directory
 
 # queue directory
-OQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
-
-# read timeout -- now OK per RFC 1123 section 5.3.2
-ifdef(`confREAD_TIMEOUT',
-       Or`'confREAD_TIMEOUT,
-       #Ordatablock=10m)
+O QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
+
+# timeouts (many of these)
+_OPTION(Timeout.initial, `confTO_INITIAL', 5m)
+_OPTION(Timeout.helo, `confTO_HELO', 5m)
+_OPTION(Timeout.mail, `confTO_MAIL', 10m)
+_OPTION(Timeout.rcpt, `confTO_RCPT', 1h)
+_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m)
+_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h)
+_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h)
+_OPTION(Timeout.rset, `confTO_RSET', 5m)
+_OPTION(Timeout.quit, `confTO_QUIT', 2m)
+_OPTION(Timeout.misc, `confTO_MISC', 2m)
+_OPTION(Timeout.command, `confTO_COMMAND', 1h)
+_OPTION(Timeout.ident, `confTO_IDENT', 30s)
+_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s)
+_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d)
+_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d)
+_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d)
+_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d)
+_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h)
+_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h)
+_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h)
+_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h)
+
+# should we not prune routes in route-addr syntax addresses?
+_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES')
 
 # queue up everything before forking?
 
 # queue up everything before forking?
-Os`'confSAFE_QUEUE
+_OPTION(SuperSafe, `confSAFE_QUEUE')
 
 # status file
 
 # status file
-OS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
-
-# default message timeout interval
-OT`'confMESSAGE_TIMEOUT
+O StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', /etc/sendmail.st)
 
 # time zone handling:
 #  if undefined, use system default
 #  if defined but null, use TZ envariable passed in
 #  if defined and non-null, use that info
 
 # time zone handling:
 #  if undefined, use system default
 #  if defined but null, use TZ envariable passed in
 #  if defined and non-null, use that info
-ifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
-       confTIME_ZONE, `USE_TZ', `Ot',
-       `Ot`'confTIME_ZONE')
+ifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=',
+       confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=',
+       `O TimeZoneSpec=confTIME_ZONE')
 
 
-# default UID
-Ou`'confDEF_USER_ID
+# default UID (can be username or userid:groupid)
+_OPTION(DefaultUser, `confDEF_USER_ID', nobody)
 
 # list of locations of user database file (null means no lookup)
 
 # list of locations of user database file (null means no lookup)
-OU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
+_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb)
 
 # fallback MX host
 
 # fallback MX host
-ifdef(`confFALLBACK_MX',
-       OV`'confFALLBACK_MX,
-       #OVfall.back.host.net)
+_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net)
 
 # if we are the best MX host for a site, try it directly instead of config err
 
 # if we are the best MX host for a site, try it directly instead of config err
-Ow`'confTRY_NULL_MX_LIST
+_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST')
 
 # load average at which we just queue messages
 
 # load average at which we just queue messages
-Ox`'confQUEUE_LA
+_OPTION(QueueLA, `confQUEUE_LA', 8)
 
 # load average at which we refuse connections
 
 # load average at which we refuse connections
-OX`'confREFUSE_LA
+_OPTION(RefuseLA, `confREFUSE_LA', 12)
 
 # work recipient factor
 
 # work recipient factor
-ifdef(`confWORK_RECIPIENT_FACTOR',
-       Oy`'confWORK_RECIPIENT_FACTOR,
-       #Oy30000)
+_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000)
 
 # deliver each queued job in a separate process?
 
 # deliver each queued job in a separate process?
-OY`'confSEPARATE_PROC
+_OPTION(ForkEachJob, `confSEPARATE_PROC')
 
 # work class factor
 
 # work class factor
-ifdef(`confWORK_CLASS_FACTOR',
-       Oz`'confWORK_CLASS_FACTOR,
-       #Oz1800)
+_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800)
 
 # work time factor
 
 # work time factor
-ifdef(`confWORK_TIME_FACTOR',
-       OZ`'confWORK_TIME_FACTOR,
-       #OZ90000)
+_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
+
+# shall we sort the queue by hostname first?
+_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
+
+# minimum time in queue before retry
+_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m)
+
+# default character set
+_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1)
+
+# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
+_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch)
+
+# dialup line delay on connection failure
+_OPTION(DialDelay, `confDIAL_DELAY', 10s)
+
+# action to take if there are no recipients in the message
+_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed)
+
+# 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   #
 
 ###########################
 #   Message precedences   #
@@ -331,6 +410,8 @@ Pjunk=-100
 #   Trusted users   #
 #####################
 
 #   Trusted users   #
 #####################
 
+# this is equivalent to setting class "t"
+#Ft/etc/sendmail.trusted
 Troot
 Tdaemon
 Tuucp
 Troot
 Tdaemon
 Tuucp
@@ -340,7 +421,7 @@ Tuucp
 #########################
 
 H?P?Return-Path: $g
 #########################
 
 H?P?Return-Path: $g
-HReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
+HReceived: confRECEIVED_HEADER
 H?D?Resent-Date: $a
 H?D?Date: $a
 H?F?Resent-From: $q
 H?D?Resent-Date: $a
 H?D?Date: $a
 H?F?Resent-From: $q
@@ -351,6 +432,9 @@ HSubject:
 # H?l?Received-Date: $b
 H?M?Resent-Message-Id: <$t.$i@$j>
 H?M?Message-Id: <$t.$i@$j>
 # H?l?Received-Date: $b
 H?M?Resent-Message-Id: <$t.$i@$j>
 H?M?Message-Id: <$t.$i@$j>
+ifdef(`_NULL_CLIENT_ONLY_',
+       `include(../m4/nullrelay.m4)m4exit',
+       `dnl')
 #\f
 ######################################################################
 ######################################################################
 #\f
 ######################################################################
 ######################################################################
@@ -367,9 +451,20 @@ undivert(9)dnl
 ###########################################
 S3
 
 ###########################################
 S3
 
-# handle null input and list syntax (translate to <@> special case)
+# handle null input (translate to <@> special case)
 R$@                    $@ <@>
 R$@                    $@ <@>
-R$*:;$*                        $@ $1 :; <@>
+
+# 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 <> <>
 
 # basic textual canonicalization -- note RFC733 heuristic here
 R$*<$*>$*<$*>$*                $2$3<$4>$5                      strip multiple <> <>
@@ -381,78 +476,89 @@ R$*<$+>$*         $2                              basic RFC821/822 parsing
 R@ $+ , $+             @ $1 : $2                       change all "," to ":"
 
 # localize and dispose of route-based addresses
 R@ $+ , $+             @ $1 : $2                       change all "," to ":"
 
 # localize and dispose of route-based addresses
-R@ $+ : $+             $@ $>_SET_96_ < @$1 > : $2              handle <route-addr>
+R@ $+ : $+             $@ $>96 < @$1 > : $2            handle <route-addr>
 
 # find focus for list syntax
 
 # find focus for list syntax
-R $+ : $* ; @ $+       $@ $>_SET_96_ $1 : $2 ; < @ $3 >        list syntax
+R $+ : $* ; @ $+       $@ $>96 $1 : $2 ; < @ $3 >      list syntax
 R $+ : $* ;            $@ $1 : $2;                     list syntax
 
 # find focus for @ syntax addresses
 R$+ @ $+               $: $1 < @ $2 >                  focus on domain
 R$+ < $+ @ $+ >                $1 $2 < @ $3 >                  move gaze right
 R $+ : $* ;            $@ $1 : $2;                     list syntax
 
 # find focus for @ syntax addresses
 R$+ @ $+               $: $1 < @ $2 >                  focus on domain
 R$+ < $+ @ $+ >                $1 $2 < @ $3 >                  move gaze right
-R$+ < @ $+ >           $@ $>_SET_96_ $1 < @ $2 >               already canonical
+R$+ < @ $+ >           $@ $>96 $1 < @ $2 >             already canonical
+
+# do some sanity checking
+R$* < @ $* : $* > $*   $1 < @ $2 $3 > $4               nix colons in addrs
 
 ifdef(`_NO_UUCP_', `dnl',
 `# convert old-style addresses to a domain-based address
 
 ifdef(`_NO_UUCP_', `dnl',
 `# convert old-style addresses to a domain-based address
-R$- ! $+               $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+          $@ $>_SET_96_ $3 < @ $1 . $2 >          domain uucps
-R$+ ! $+               $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains')
-
+R$- ! $+               $@ $>96 $2 < @ $1 .UUCP >       resolve uucp names
+R$+ . $- ! $+          $@ $>96 $3 < @ $1 . $2 >                domain uucps
+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.
 # 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$* @ $*               $@ $>_SET_96_ $1 < @ $2 >               Insert < > and finish
+R$* @ $*               $@ $>96 $1 < @ $2 >             Insert < > and finish
 
 # else we must be a local name
 
 # else we must be a local name
+R$*                    $@ $>96 $1
 
 
 ################################################
 
 
 ################################################
-###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
+###  Ruleset 96 -- bottom half of ruleset 3  ###
 ################################################
 
 ################################################
 
-#  At this point, everything should be in a "local_part<@domain>extra" format.
-S`'_SET_96_
+S96
 
 # handle special cases for local names
 R$* < @ localhost > $*         $: $1 < @ $j . > $2             no domain at all
 R$* < @ localhost . $m > $*    $: $1 < @ $j . > $2             local domain
 ifdef(`_NO_UUCP_', `dnl',
 `R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2             .UUCP domain')
 
 # handle special cases for local names
 R$* < @ localhost > $*         $: $1 < @ $j . > $2             no domain at all
 R$* < @ localhost . $m > $*    $: $1 < @ $j . > $2             local domain
 ifdef(`_NO_UUCP_', `dnl',
 `R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2             .UUCP domain')
+R$* < @ [ $+ ] > $*            $: $1 < @@ [ $2 ] > $3          mark [a.b.c.d]
+R$* < @@ $=w > $*              $: $1 < @ $j . > $3             self-literal
+R$* < @@ $+ > $*               $@ $1 < @ $2 > $3               canon IP addr
 ifdef(`DOMAIN_TABLE', `
 ifdef(`DOMAIN_TABLE', `
-# look up unqualified domains in the domain table
-R$* < @ $- > $*                        $: $1 < @ $(domaintable $2 $) > $3',
+# look up domains in the domain table
+R$* < @ $+ > $*                        $: $1 < @ $(domaintable $2 $) > $3',
 `dnl')
 undivert(2)dnl
 
 ifdef(`_NO_UUCP_', `dnl',
 `ifdef(`UUCP_RELAY',
 `# pass UUCP addresses straight through
 `dnl')
 undivert(2)dnl
 
 ifdef(`_NO_UUCP_', `dnl',
 `ifdef(`UUCP_RELAY',
 `# pass UUCP addresses straight through
-R$* < @ $+ . UUCP > $*         $@ $1 < @ $2 . UUCP > $3',
+R$* < @ $+ . UUCP > $*         $@ $1 < @ $2 . UUCP > $3',
 `# if really UUCP, handle it immediately
 ifdef(`_CLASS_U_',
 `# if really UUCP, handle it immediately
 ifdef(`_CLASS_U_',
-`R$* < @ $=U . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
+`R$* < @ $=U . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
 ifdef(`_CLASS_V_',
 ifdef(`_CLASS_V_',
-`R$* < @ $=V . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
+`R$* < @ $=V . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
 ifdef(`_CLASS_W_',
 ifdef(`_CLASS_W_',
-`R$* < @ $=W . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
+`R$* < @ $=W . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
 ifdef(`_CLASS_X_',
 ifdef(`_CLASS_X_',
-`R$* < @ $=X . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
+`R$* < @ $=X . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
 ifdef(`_CLASS_Y_',
 ifdef(`_CLASS_Y_',
-`R$* < @ $=Y . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
+`R$* < @ $=Y . UUCP > $*       $@ $1 < @ $2 . UUCP > $3', `dnl')
 
 # try UUCP traffic as a local address
 
 # try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $*         $: $1 < @ $[ $2 $] . UUCP > $3
-ifdef(`_OLD_SENDMAIL_',
-`R$* < @ $+ . $+ . UUCP > $*           $@ $1 < @ $2 . $3 . > $4',
-`R$* < @ $+ . . UUCP > $*              $@ $1 < @ $2 . > $3')')
+R$* < @ $+ . UUCP > $*         $: $1 < @ $[ $2 $] . UUCP . > $3
+R$* < @ $+ . . UUCP . > $*             $@ $1 < @ $2 . > $3')
 ')
 ')
-ifdef(`_NO_CANONIFY_',
-`# make sure local host names appear canonical
-R$* < @ $=w > $*               $: $1 < @ $2 . > $3',
+ifdef(`_NO_CANONIFY_', `dnl',
 `# pass to name server to make hostname canonical
 R$* < @ $* $~P > $*            $: $1 < @ $[ $2 $3 $] > $4')
 
 `# pass to name server to make hostname canonical
 R$* < @ $* $~P > $*            $: $1 < @ $[ $2 $3 $] > $4')
 
-undivert(8)dnl
+# local host aliases and pseudo-domains are always canonical
+R$* < @ $=w > $*               $: $1 < @ $2 . > $3
+R$* < @ $* $=P > $*            $: $1 < @ $2 $3 . > $4
+R$* < @ $* . . > $*            $1 < @ $2 . > $3
 
 # if this is the local hostname, make sure we treat is as canonical
 R$* < @ $j > $*                        $: $1 < @ $j . > $2
 
 # if this is the local hostname, make sure we treat is as canonical
 R$* < @ $j > $*                        $: $1 < @ $j . > $2
@@ -463,10 +569,7 @@ R$* < @ $j > $*                    $: $1 < @ $j . > $2
 ##################################################
 S4
 
 ##################################################
 S4
 
-R$*<@>                 $@ $1                           handle <> and list:;
-
-# resolve numeric addresses to name if possible
-R$* < @ [ $+ ] > $*    $: $1 < @ $[ [$2] $] > $3       lookup numeric internet addr
+R$* <@>                        $@                              handle <> and list:;
 
 # strip trailing dot off possibly canonical name
 R$* < @ $+ . > $*      $1 < @ $2 > $3
 
 # strip trailing dot off possibly canonical name
 R$* < @ $+ . > $*      $1 < @ $2 > $3
@@ -480,17 +583,21 @@ ifdef(`_NO_UUCP_', `dnl',
 `# UUCP must always be presented in old form
 R$+ @ $- . UUCP                $2!$1                           u@h.UUCP => h!u')
 
 `# 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
 
 
 
 ##############################################################
 # delete duplicate local names
 R$+ % $=w @ $=w                $1 @ $j                         u%host@host => u@host
 
 
 
 ##############################################################
-###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
+###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
 ###               (used for recursive calls)              ###
 ##############################################################
 
 ###               (used for recursive calls)              ###
 ##############################################################
 
-S`'_SET_97_
+S`'97
 R$*                    $: $>3 $1
 R$*                    $@ $>0 $1
 
 R$*                    $: $>3 $1
 R$*                    $@ $>0 $1
 
@@ -501,75 +608,82 @@ R$*                       $@ $>0 $1
 
 S0
 
 
 S0
 
-R<@>                   $#_LOCAL_ $: <>                 special case error msgs
-R$*:;<@>               $#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
+R<@>                   $#_LOCAL_ $: <@>                special case error msgs
+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
 
 ifdef(`_MAILER_smtp_',
 `# handle numeric address spec
-ifdef(`_NO_CANONIFY_', `dnl',
-`R$* < @ [ $+ ] > $*   $: $1 < @ $[ [$2] $] > $3       numeric internet addr')
-R$* < @ [ $+ ] > $*    $: $>_SET_98_ $1 < @ [ $2 ] > $3        numeric internet spec
-R$* < @ [ $+ ] > $*    $#_SMTP_ $@ [$2] $: $1 @ [$2] $3        still numeric: send',
+R$* < @ [ $+ ] > $*    $: $>98 $1 < @ [ $2 ] > $3      numeric internet spec
+R$* < @ [ $+ ] > $*    $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3    still numeric: send',
        `dnl')
 
 # now delete the local info -- note $=O to find characters that cause forwarding
        `dnl')
 
 # now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $*           $@ $>_SET_97_ $1                user@ => user
-R< @ $=w . > : $*      $@ $>_SET_97_ $2                @here:... -> ...
-R$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3          ...@here -> ...
+R$* < @ > $*           $@ $>97 $1              user@ => user
+R< @ $=w . > : $*      $@ $>97 $2              @here:... -> ...
+R$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3                ...@here -> ...
 
 # handle local hacks
 
 # handle local hacks
-R$*                    $: $>_SET_98_ $1
+R$*                    $: $>98 $1
+
+# short circuit local delivery so forwarded email works
+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< $+ > $+ < $+ >      $>95 < $1 > $2 < $3 >           yep ....
+R< > $+ + $* < $+ >    $#_LOCAL_ $: $1 + $2            plussed name?
+R< > $+ < $+ >         $#_LOCAL_ $: @ $1                       nope, local address',
+`R$=L < @ $=w . >      $#_LOCAL_ $: @ $1               special local names
+R$+ < @ $=w . >                $#_LOCAL_ $: $1                 regular local name')
 ifdef(`MAILER_TABLE',
 `
 ifdef(`MAILER_TABLE',
 `
-# try mailer table lookup
-R$* < @ $-:$+ > $*     $# $2 $@ $3 $: $1 @ $3 $4       found a match',
+# 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')
 `dnl')
-
-# short circuit local delivery so forwarded email works
-ifdef(`_LOCAL_NOT_STICKY_',
-`R$=L < @ $=w . >              $#_LOCAL_ $: @ $1                       special local names
-R$+ < @ $=w . >                $#_LOCAL_ $: $1                 dispose directly',
-`R$+ < @ $=w . >               $: $1 < @ $2 @ $H >             first try hub
-ifdef(`_OLD_SENDMAIL_',
-`R$+ < $+ @ $-:$+ >    $# $3 $@ $4 $: $1 $2            yep ....
-R$+ < $+ @ $+ >                $#relay $@ $3 $: $1 $2          yep ....
-R$+ < $+ @ >           $#_LOCAL_ $: $1                 nope, local address',
-`R$+ < $+ @ $+ >               $#_LOCAL_ $: $1                 yep ....
-R$+ < $+ @ >           $#_LOCAL_ $: @ $1                       nope, local address')')
 undivert(4)dnl
 
 ifdef(`_NO_UUCP_', `dnl',
 `# resolve remotely connected UUCP links (if any)
 ifdef(`_CLASS_V_',
 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_',
        `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_',
        `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',
        `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$*<@$+.BITNET.>$*    $: $>95 < $B > $1 <@$2.BITNET.> $3      user@host.BITNET',
        `dnl')
        `dnl')
-ifdef(`CSNET_RELAY',
-`R$*<@$+.CSNET>$*      $#smtp $@ $C $: $1 @ $2 . CSNET $3      user@host.CSNET',
+ifdef(`DECNET_RELAY',
+`R$*<@$+.DECNET.>$*    $: $>95 < $C > $1 <@$2.DECNET.> $3      user@host.DECNET',
+       `dnl')
+ifdef(`_MAILER_pop_',
+`R$+ < @ POP. >                $#pop $: $1                     user@POP',
        `dnl')
 ifdef(`_MAILER_fax_',
        `dnl')
 ifdef(`_MAILER_fax_',
-`R$+ < @ $+ .FAX >     $#fax $@ $2 $: $1               user@host.FAX',
+`R$+ < @ $+ .FAX. >    $#fax $@ $2 $: $1               user@host.FAX',
 `ifdef(`FAX_RELAY',
 `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
        `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
 `ifdef(`_MAILER_uucp_',
 `# forward other UUCP traffic straight to UUCP
-R< @ $+ .UUCP > : $+   $#uucp $@ $1 $: $2              @host.UUCP:...
-R$+ < @ $+ .UUCP >     $#uucp $@ $2 $: $1              user@host.UUCP',
+R$* < @ $+ .UUCP. > $*         $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3   user@host.UUCP',
        `dnl')')
 ifdef(`_MAILER_usenet_', `
 # addresses sent to net.group.USENET will get forwarded to a newsgroup
        `dnl')')
 ifdef(`_MAILER_usenet_', `
 # addresses sent to net.group.USENET will get forwarded to a newsgroup
@@ -578,25 +692,19 @@ R$+ . USENET              $#usenet $: $1',
 
 ifdef(`_LOCAL_RULES_',
 `# figure out what should stay in our local mail system
 
 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)
 # pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $*                $: $>_SET_95_ < $S > $1 < @ $2 > $3     glue on smarthost name
+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',
 
 # 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')
 
 
-ifdef(`_OLD_SENDMAIL_',
-`# forward remaining names to local relay, if any
-R$=L                   $#_LOCAL_ $: $1                 special local names
-R$+                    $: $>_SET_95_ < $R > $1                 try relay
-R$+                    $: $>_SET_95_ < $H > $1                 try hub
-R$+                    $#_LOCAL_ $: $1                 no relay or hub: local',
-
-`# if this is quoted, strip the quotes and try again
+# if this is quoted, strip the quotes and try again
 R$+                    $: $(dequote $1 $)              strip quotes
 R$+                    $: $(dequote $1 $)              strip quotes
-R$+ $=O $+             $@ $>_SET_97_ $1 $2 $3                  try again
+R$+ $=O $+             $@ $>97 $1 $2 $3                        try again
 
 # handle locally delivered names
 R$=L                   $#_LOCAL_ $: @ $1                       special local names
 
 # handle locally delivered names
 R$=L                   $#_LOCAL_ $: @ $1                       special local names
@@ -604,44 +712,64 @@ R$+                       $#_LOCAL_ $: $1                 regular local names
 
 ###########################################################################
 ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
 
 ###########################################################################
 ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
-###               (new sendmail only)                                  ###
 ###########################################################################
 
 S5
 
 ###########################################################################
 
 S5
 
+# 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
+
+ifdef(`LUSER_RELAY',
+`# send unrecognized local users to a relay host
+R< > $+ + $*           $: < $L . > $( user $1 $) + $2
+R< > $+                        $: < $L . > $( user $1 $)       look up user
+R< $* > $+ <> $*       $: < > $2 $3                    found; strip $L
+R< $* . > $+           $: < $1 > $2                    strip extra dot')
+
+# handle plussed local names
+R< > $+ + $*           $#_LOCAL_ $@ $2 $: $1
+
 # see if we have a relay or a hub
 # 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',
 `
 
 ###################################################################
 ###  Ruleset 90 -- try domain part of mailertable entry        ###
 ifdef(`MAILER_TABLE',
 `
 
 ###################################################################
 ###  Ruleset 90 -- try domain part of mailertable entry        ###
-###               (new sendmail only)                          ###
 ###################################################################
 
 S90
 ###################################################################
 
 S90
-R<$- . $+ > $*         $: < $(mailertable .$2 $@ $1 $) > $3    lookup
-R<$- : $+ > $*         $# $1 $@ $2 $: $3               check -- resolved?
-R< . $+ > $*           $@ $>90 <$1> $2                 no -- strip & try again
-R<$*> $*               $@ $2                           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')
 
 ###################################################################
 `dnl')
 
 ###################################################################
-###  Ruleset _SET_95_ -- canonify mailer:host syntax to triple ###
+###  Ruleset 95 -- canonify mailer:host syntax to triple       ###
 ###################################################################
 
 ###################################################################
 
-S`'_SET_95_
+S95
 R< > $*                        $@ $1                           strip off null relay
 R< $- : $+ > $*                $# $1 $@ $2 $: $3               try qualified mailer
 R< $=w > $*            $@ $2                           delete local host
 R< $+ > $*             $#_RELAY_ $@ $1 $: $2           use unqualified mailer
 
 ###################################################################
 R< > $*                        $@ $1                           strip off null relay
 R< $- : $+ > $*                $# $1 $@ $2 $: $3               try qualified mailer
 R< $=w > $*            $@ $2                           delete local host
 R< $+ > $*             $#_RELAY_ $@ $1 $: $2           use unqualified mailer
 
 ###################################################################
-###  Ruleset _SET_98_ -- local part of ruleset zero (can be null)      ###
+###  Ruleset 98 -- local part of ruleset zero (can be null)    ###
 ###################################################################
 
 ###################################################################
 
-S`'_SET_98_
+S98
 undivert(3)dnl
 #\f
 ######################################################################
 undivert(3)dnl
 #\f
 ######################################################################