handle quotes inside comments properly
[unix-history] / usr / src / usr.sbin / sendmail / cf / m4 / proto.m4
index d21ac88..b21ce4e 100644 (file)
@@ -8,7 +8,7 @@ divert(-1)
 #
 divert(0)
 
 #
 divert(0)
 
-VERSIONID(`@(#)proto.m4        8.11 (Berkeley) %G%')
+VERSIONID(`@(#)proto.m4        8.21 (Berkeley) %G%')
 
 MAILER(local)dnl
 
 
 MAILER(local)dnl
 
@@ -16,9 +16,11 @@ ifdef(`_OLD_SENDMAIL_',
 `define(`_SET_95_', 5)dnl
 define(`_SET_96_', 6)dnl
 define(`_SET_97_', 7)dnl
 `define(`_SET_95_', 5)dnl
 define(`_SET_96_', 6)dnl
 define(`_SET_97_', 7)dnl
-define(`_SET_98_', 8)dnl',
-`# level 4 config file format
-V4
+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_95_', 95)dnl
 define(`_SET_96_', 96)dnl
 define(`_SET_97_', 97)dnl
@@ -37,13 +39,21 @@ define(`_RELAY_', `confRELAY_MAILER')dnl    for readability only
 #   local info   #
 ##################
 
 #   local info   #
 ##################
 
-CP.
-
 Cwlocalhost
 ifdef(`USE_CW_FILE',
 `# file containing names of hosts for which we receive email
 Fw`'confCW_FILE',
        `dnl')
 Cwlocalhost
 ifdef(`USE_CW_FILE',
 `# file containing names of hosts for which we receive email
 Fw`'confCW_FILE',
        `dnl')
+ifdef(`confDOMAIN_NAME', `
+# my official domain name
+Dj`'confDOMAIN_NAME',
+       `dnl')
+
+ifdef(`_NULL_CLIENT_ONLY_',
+`include(../m4/nullrelay.m4)m4exit',
+       `dnl')
+
+CP.
 
 ifdef(`UUCP_RELAY',
 `# UUCP relay host
 
 ifdef(`UUCP_RELAY',
 `# UUCP relay host
@@ -69,11 +79,9 @@ DF`'FAX_RELAY
 CPFAX
 
 ')dnl
 CPFAX
 
 ')dnl
-ifdef(`SMART_HOST',
-`# "Smart" UUCP relay host
-DS`'SMART_HOST
+# "Smart" relay host (may be null)
+DS`'ifdef(`SMART_HOST', SMART_HOST)
 
 
-')dnl
 ifdef(`MAILER_TABLE',
 `# Mailer table (overriding domains)
 Kmailertable MAILER_TABLE
 ifdef(`MAILER_TABLE',
 `# Mailer table (overriding domains)
 Kmailertable MAILER_TABLE
@@ -90,9 +98,6 @@ 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)
 
-# my official hostname ($w or $w.$D)
-Dj$w`'ifdef(`NEED_DOMAIN', .$D)
-
 # who I masquerade as (can be $j)
 DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)
 
 # who I masquerade as (can be $j)
 DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)
 
@@ -132,7 +137,7 @@ Do`'confOPERATORS
 
 # format of a total name
 Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER,
 
 # format of a total name
 Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER,
-       ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
+       ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))
 include(`../m4/version.m4')
 
 ###############
 include(`../m4/version.m4')
 
 ###############
@@ -271,7 +276,7 @@ OT`'confMESSAGE_TIMEOUT
 #  if defined but null, use TZ envariable passed in
 #  if defined and non-null, use that info
 ifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
 #  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', `',
+       confTIME_ZONE, `USE_TZ', `Ot',
        `Ot`'confTIME_ZONE')
 
 # default UID
        `Ot`'confTIME_ZONE')
 
 # default UID
@@ -362,16 +367,18 @@ 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 :; <@>
 
 # basic textual canonicalization -- note RFC733 heuristic here
 
 # basic textual canonicalization -- note RFC733 heuristic here
-R$*<$*>$*<$*>$*                <$2>$3$4$5                      strip multiple <> <>
+R$*<$*>$*<$*>$*                $2$3<$4>$5                      strip multiple <> <>
 R$*<$*<$+>$*>$*                <$3>$5                          2-level <> nesting
 R$*<>$*                        $@ <@>                          MAIL FROM:<> case
 R$*<$+>$*              $2                              basic RFC821/822 parsing
 
 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 ":"
 
 # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
 R@ $+ , $+             @ $1 : $2                       change all "," to ":"
 
@@ -413,6 +420,9 @@ 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$* < @ localhost . $m > $*    $: $1 < @ $j . > $2             local domain
 ifdef(`_NO_UUCP_', `dnl',
 `R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2             .UUCP domain')
+R$* < @ [ $+ ] > $*            $: $1 < @ [[ $2 ]] > $3         catch [a.b.c.d]
+R$* < @ [ $=w ] > $*           $: $1 < @ $j . > $3             self-literal
+R$* < @ [[ $+ ]] > $*          $: $1 < @ [ $2 ] > $3           strip dbl [[]]
 ifdef(`DOMAIN_TABLE', `
 # look up unqualified domains in the domain table
 R$* < @ $- > $*                        $: $1 < @ $(domaintable $2 $) > $3',
 ifdef(`DOMAIN_TABLE', `
 # look up unqualified domains in the domain table
 R$* < @ $- > $*                        $: $1 < @ $(domaintable $2 $) > $3',
@@ -508,9 +518,9 @@ 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$* < @ > $*           $@ $>_SET_97_ $1                user@ => user
+R< @ $=w . > : $*      $@ $>_SET_97_ $2                @here:... -> ...
+R$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3          ...@here -> ...
 
 # handle local hacks
 R$*                    $: $>_SET_98_ $1
 
 # handle local hacks
 R$*                    $: $>_SET_98_ $1
@@ -574,17 +584,13 @@ R$+ . USENET              $#usenet $: $1',
 ifdef(`_LOCAL_RULES_',
 `# figure out what should stay in our local mail system
 R$* < @ $* > $*                $#smtp $@ $2 $: $1 @ $2 $3              user@host.domain')')
 ifdef(`_LOCAL_RULES_',
 `# figure out what should stay in our local mail system
 R$* < @ $* > $*                $#smtp $@ $2 $: $1 @ $2 $3              user@host.domain')')
-ifdef(`SMART_HOST',
-`# pass names that still have a host to a smarthost
+# pass names that still have a host to a smarthost (if defined)
 R$* < @ $* > $*                $: $>_SET_95_ < $S > $1 < @ $2 > $3     glue on smarthost name
 R$* < @ $* > $*                $: $>_SET_95_ < $S > $1 < @ $2 > $3     glue on smarthost name
-R< $- : $+ > $*                $# $1 $@ $2 $: $3               if non-null, use it
-R< $+ > $*             $#suucp $@ $1 $: $2             if non-null, use it
-R<> $*                 $: $1                           else strip off gunk',
 
 
-`# deal with other remote names
+# deal with other remote names
 ifdef(`_MAILER_smtp_',
 `R$* < @$* > $*                $#_SMTP_ $@ $2 $: $1 < @ $2 > $3                user@host.domain',
 ifdef(`_MAILER_smtp_',
 `R$* < @$* > $*                $#_SMTP_ $@ $2 $: $1 < @ $2 > $3                user@host.domain',
-`R$* < @$* > $*                $#error $@NOHOST $: Unrecognized host name $2')')
+`R$* < @$* > $*                $#error $@NOHOST $: Unrecognized host name $2')
 
 ifdef(`_OLD_SENDMAIL_',
 `# forward remaining names to local relay, if any
 
 ifdef(`_OLD_SENDMAIL_',
 `# forward remaining names to local relay, if any
@@ -595,7 +601,7 @@ R$+                 $#_LOCAL_ $: $1                 no relay or hub: local',
 
 `# if this is quoted, strip the quotes and try again
 R$+                    $: $(dequote $1 $)              strip quotes
 
 `# if this is quoted, strip the quotes and try again
 R$+                    $: $(dequote $1 $)              strip quotes
-R$* $=O $*             $@ $>_SET_97_ $1 $2 $3                  try again
+R$+ $=O $+             $@ $>_SET_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