1divert(-1) 2# 3# Copyright (c) 1983, 1995 Eric P. Allman 4# Copyright (c) 1988, 1993 5# The Regents of the University of California. All rights reserved. 6# 7# %sccs.include.redist.sh% 8# 9divert(0) 10 11VERSIONID(`@(#)proto.m4 8.78 (Berkeley) 05/30/95') 12 13MAILER(local)dnl 14 15# level 6 config file format 16V6/Berkeley 17divert(-1) 18 19# do some sanity checking 20ifdef(`__OSTYPE__',, 21 `errprint(`*** ERROR: No system type defined (use OSTYPE macro)')') 22 23# pick our default mailers 24ifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')') 25ifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')') 26ifdef(`confRELAY_MAILER',, 27 `define(`confRELAY_MAILER', 28 `ifdef(`_MAILER_smtp_', `relay', 29 `ifdef(`_MAILER_uucp', `suucp', `unknown')')')') 30define(`_SMTP_', `confSMTP_MAILER')dnl for readability only 31define(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 32define(`_RELAY_', `confRELAY_MAILER')dnl for readability only 33 34# back compatibility with old config files 35ifdef(`confDEF_GROUP_ID', 36 `errprint(`*** confDEF_GROUP_ID is obsolete.') 37 errprint(` Use confDEF_USER_ID with a colon in the value instead.')') 38ifdef(`confREAD_TIMEOUT', 39 `errprint(`*** confREAD_TIMEOUT is obsolete.') 40 errprint(` Use individual confTO_<timeout> parameters instead.')') 41ifdef(`confMESSAGE_TIMEOUT', 42 `define(`_ARG_', index(confMESSAGE_TIMEOUT, /)) 43 ifelse(_ARG_, -1, 44 `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)', 45 `define(`confTO_QUEUERETURN', 46 substr(confMESSAGE_TIMEOUT, 0, _ARG_)) 47 define(`confTO_QUEUEWARN', 48 substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')') 49ifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,, 50 `errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.') 51 errprint(` Use confMAX_MESSAGE_SIZE for the second part of the value.')')') 52 53# clean option definitions below.... 54define(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl 55 56divert(0)dnl 57 58################## 59# local info # 60################## 61 62Cwlocalhost 63ifdef(`USE_CW_FILE', 64`# file containing names of hosts for which we receive email 65Fw`'confCW_FILE', 66 `dnl') 67 68# my official domain name 69# ... define this only if sendmail cannot automatically determine your domain 70ifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM') 71 72ifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl 73 74CP. 75 76ifdef(`UUCP_RELAY', 77`# UUCP relay host 78DY`'UUCP_RELAY 79CPUUCP 80 81')dnl 82ifdef(`BITNET_RELAY', 83`# BITNET relay host 84DB`'BITNET_RELAY 85CPBITNET 86 87')dnl 88ifdef(`DECNET_RELAY', 89`define(`_USE_DECNET_SYNTAX_')dnl 90# DECnet relay host 91DC`'DECNET_RELAY 92CPDECNET 93 94')dnl 95ifdef(`FAX_RELAY', 96`# FAX relay host 97DF`'FAX_RELAY 98CPFAX 99 100')dnl 101# "Smart" relay host (may be null) 102DS`'ifdef(`SMART_HOST', SMART_HOST) 103 104ifdef(`LUSER_RELAY', 105`# place to which unknown users should be forwarded 106Kuser user -m -a<> 107DL`'LUSER_RELAY 108', `dnl') 109 110# operators that cannot be in local usernames (i.e., network indicators) 111CO @ % ifdef(`_NO_UUCP_', `', `!') 112 113# a class with just dot (for identifying canonical names) 114C.. 115 116ifdef(`MAILER_TABLE', 117`# Mailer table (overriding domains) 118Kmailertable MAILER_TABLE 119 120')dnl 121ifdef(`DOMAIN_TABLE', 122`# Domain table (adding domains) 123Kdomaintable DOMAIN_TABLE 124 125')dnl 126# who I send unqualified names to (null means deliver locally) 127DR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) 128 129# who gets all local email traffic ($R has precedence for unqualified names) 130DH`'ifdef(`MAIL_HUB', MAIL_HUB) 131 132# class L: names that should be delivered locally, even if we have a relay 133# class E: names that should be exposed as from this host, even if we masquerade 134#CL root 135CE root 136undivert(5)dnl 137 138# dequoting map 139Kdequote dequote 140 141divert(0)dnl 142# who I masquerade as (null for no masquerading) 143DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME) 144 145undivert(6)dnl 146 147###################### 148# Special macros # 149###################### 150 151# SMTP initial login message 152De`'confSMTP_LOGIN_MSG 153 154# UNIX initial From header format 155Dl`'confFROM_LINE 156 157# my name for error messages 158Dn`'confMAILER_NAME 159 160# delimiter (operator) characters 161Do`'confOPERATORS 162 163# format of a total name 164Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.') 165include(`../m4/version.m4') 166 167############### 168# Options # 169############### 170 171# strip message body to 7 bits on input? 172_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT') 173 174# 8-bit data handling 175_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive) 176 177# wait for alias file rebuild (default units: minutes) 178_OPTION(AliasWait, `confALIAS_WAIT', 5m) 179 180# location of alias file 181O AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases) 182 183# minimum number of free blocks on filesystem 184_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100) 185 186# maximum message size 187_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000) 188 189# substitution for space (blank) characters 190_OPTION(BlankSub, `confBLANK_SUB', _) 191 192# avoid connecting to "expensive" mailers on initial submission? 193_OPTION(HoldExpensive, `confCON_EXPENSIVE') 194 195# checkpoint queue runs after every N successful deliveries 196_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10) 197 198# default delivery mode 199_OPTION(DeliveryMode, `confDELIVERY_MODE', background) 200 201# automatically rebuild the alias database? 202_OPTION(AutoRebuildAliases, `confAUTO_REBUILD') 203 204# error message header/file 205_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE) 206 207# error mode 208_OPTION(ErrorMode, `confERROR_MODE', print) 209 210# save Unix-style "From_" lines at top of header? 211_OPTION(SaveFromLine, `confSAVE_FROM_LINES') 212 213# temporary file mode 214_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600) 215 216# match recipients against GECOS field? 217_OPTION(MatchGECOS, `confMATCH_GECOS') 218 219# maximum hop count 220_OPTION(MaxHopCount, `confMAX_HOP', 17) 221 222# location of help file 223O HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf) 224 225# ignore dots as terminators in incoming messages? 226_OPTION(IgnoreDots, `confIGNORE_DOTS') 227 228# name resolver options 229_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY) 230 231# deliver MIME-encapsulated error messages? 232_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS') 233 234# Forward file search path 235_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward) 236 237# open connection cache size 238_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2) 239 240# open connection cache timeout 241_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m) 242 243# use Errors-To: header? 244_OPTION(UseErrorsTo, `confUSE_ERRORS_TO') 245 246# log level 247_OPTION(LogLevel, `confLOG_LEVEL', 10) 248 249# send to me too, even in an alias expansion? 250_OPTION(MeToo, `confME_TOO') 251 252# verify RHS in newaliases? 253_OPTION(CheckAliases, `confCHECK_ALIASES') 254 255# default messages to old style headers if no special punctuation? 256_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS') 257 258# SMTP daemon options 259_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp) 260 261# privacy flags 262_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings) 263 264# who (if anyone) should get extra copies of error messages 265_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster) 266 267# slope of queue-only function 268_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000) 269 270# queue directory 271O QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue) 272 273# timeouts (many of these) 274_OPTION(Timeout.initial, `confTO_INITIAL', 5m) 275_OPTION(Timeout.helo, `confTO_HELO', 5m) 276_OPTION(Timeout.mail, `confTO_MAIL', 10m) 277_OPTION(Timeout.rcpt, `confTO_RCPT', 1h) 278_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m) 279_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h) 280_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h) 281_OPTION(Timeout.rset, `confTO_RSET', 5m) 282_OPTION(Timeout.quit, `confTO_QUIT', 2m) 283_OPTION(Timeout.misc, `confTO_MISC', 2m) 284_OPTION(Timeout.command, `confTO_COMMAND', 1h) 285_OPTION(Timeout.ident, `confTO_IDENT', 30s) 286_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s) 287_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d) 288_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d) 289_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d) 290_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d) 291_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h) 292_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h) 293_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h) 294_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h) 295 296# should we not prune routes in route-addr syntax addresses? 297_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES') 298 299# queue up everything before forking? 300_OPTION(SuperSafe, `confSAFE_QUEUE') 301 302# status file 303O StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', /etc/sendmail.st) 304 305# time zone handling: 306# if undefined, use system default 307# if defined but null, use TZ envariable passed in 308# if defined and non-null, use that info 309ifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=', 310 confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=', 311 `O TimeZoneSpec=confTIME_ZONE') 312 313# default UID (can be username or userid:groupid) 314_OPTION(DefaultUser, `confDEF_USER_ID', nobody) 315 316# list of locations of user database file (null means no lookup) 317_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb) 318 319# fallback MX host 320_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net) 321 322# if we are the best MX host for a site, try it directly instead of config err 323_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST') 324 325# load average at which we just queue messages 326_OPTION(QueueLA, `confQUEUE_LA', 8) 327 328# load average at which we refuse connections 329_OPTION(RefuseLA, `confREFUSE_LA', 12) 330 331# work recipient factor 332_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000) 333 334# deliver each queued job in a separate process? 335_OPTION(ForkEachJob, `confSEPARATE_PROC') 336 337# work class factor 338_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800) 339 340# work time factor 341_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000) 342 343# shall we sort the queue by hostname first? 344_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority) 345 346# minimum time in queue before retry 347_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m) 348 349# default character set 350_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1) 351 352# service switch file (ignored on Solaris, Ultrix, OSF/1, others) 353_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch) 354 355# dialup line delay on connection failure 356_OPTION(DialDelay, `confDIAL_DELAY', 10s) 357 358# action to take if there are no recipients in the message 359_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed) 360 361# chrooted environment for writing to files 362_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch) 363 364# are colons OK in addresses? 365_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR') 366 367# how many jobs can you process in the queue? 368_OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', 10000) 369 370########################### 371# Message precedences # 372########################### 373 374Pfirst-class=0 375Pspecial-delivery=100 376Plist=-30 377Pbulk=-60 378Pjunk=-100 379 380##################### 381# Trusted users # 382##################### 383 384# this is equivalent to setting class "t" 385#Ft/etc/sendmail.trusted 386Troot 387Tdaemon 388Tuucp 389 390######################### 391# Format of headers # 392######################### 393 394H?P?Return-Path: $g 395HReceived: confRECEIVED_HEADER 396H?D?Resent-Date: $a 397H?D?Date: $a 398H?F?Resent-From: $q 399H?F?From: $q 400H?x?Full-Name: $x 401HSubject: 402# HPosted-Date: $a 403# H?l?Received-Date: $b 404H?M?Resent-Message-Id: <$t.$i@$j> 405H?M?Message-Id: <$t.$i@$j> 406ifdef(`_NULL_CLIENT_ONLY_', 407 `include(../m4/nullrelay.m4)m4exit', 408 `dnl') 409# 410###################################################################### 411###################################################################### 412##### 413##### REWRITING RULES 414##### 415###################################################################### 416###################################################################### 417 418undivert(9)dnl 419 420########################################### 421### Rulset 3 -- Name Canonicalization ### 422########################################### 423S3 424 425# handle null input (translate to <@> special case) 426R$@ $@ <@> 427 428# strip group: syntax (not inside angle brackets!) and trailing semicolon 429R$* $: $1 <@> mark addresses 430R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr> 431R$* :: $* <@> $: $1 :: $2 unmark node::addr 432R:`include': $* <@> $: :`include': $1 unmark :`include':... 433R$* : $* <@> $: $2 strip colon if marked 434R$* <@> $: $1 unmark 435R$* ; $: $1 strip trailing semi 436 437# null input now results from list:; syntax 438R$@ $@ :; <@> 439 440# basic textual canonicalization -- note RFC733 heuristic here 441R$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 442R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 443R$*<>$* $@ <@> MAIL FROM:<> case 444R$*<$+>$* $2 basic RFC821/822 parsing 445 446# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 447R@ $+ , $+ @ $1 : $2 change all "," to ":" 448 449# localize and dispose of route-based addresses 450R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> 451 452# find focus for list syntax 453R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax 454R $+ : $* ; $@ $1 : $2; list syntax 455 456# find focus for @ syntax addresses 457R$+ @ $+ $: $1 < @ $2 > focus on domain 458R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 459R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical 460 461# do some sanity checking 462R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 463 464ifdef(`_NO_UUCP_', `dnl', 465`# convert old-style addresses to a domain-based address 466R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names 467R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps 468R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains 469') 470ifdef(`_USE_DECNET_SYNTAX_', 471`# convert node::user addresses into a domain-based address 472R$- :: $+ $@ $>96 $2 < @ $1 .DECNET > resolve DECnet names 473R$- . $- :: $+ $@ $>96 $3 < @ $1.$2 .DECNET > numeric DECnet addr 474', 475 `dnl') 476# if we have % signs, take the rightmost one 477R$* % $* $1 @ $2 First make them all @s. 478R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 479R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish 480 481# else we must be a local name 482R$* $@ $>96 $1 483 484 485################################################ 486### Ruleset 96 -- bottom half of ruleset 3 ### 487################################################ 488 489S96 490 491# handle special cases for local names 492R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 493R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 494ifdef(`_NO_UUCP_', `dnl', 495`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 496R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] 497R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 498R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 499ifdef(`DOMAIN_TABLE', ` 500# look up domains in the domain table 501R$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', 502`dnl') 503undivert(2)dnl 504 505ifdef(`_NO_UUCP_', `dnl', 506`ifdef(`UUCP_RELAY', 507`# pass UUCP addresses straight through 508R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 509`# if really UUCP, handle it immediately 510ifdef(`_CLASS_U_', 511`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 512ifdef(`_CLASS_V_', 513`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 514ifdef(`_CLASS_W_', 515`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 516ifdef(`_CLASS_X_', 517`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 518ifdef(`_CLASS_Y_', 519`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 520 521# try UUCP traffic as a local address 522R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 523R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 524') 525ifdef(`_NO_CANONIFY_', `dnl', 526`# pass to name server to make hostname canonical 527R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 528 529# local host aliases and pseudo-domains are always canonical 530R$* < @ $=w > $* $: $1 < @ $2 . > $3 531R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 532R$* < @ $* . . > $* $1 < @ $2 . > $3 533 534# if this is the local hostname, make sure we treat is as canonical 535R$* < @ $j > $* $: $1 < @ $j . > $2 536 537 538################################################## 539### Ruleset 4 -- Final Output Post-rewriting ### 540################################################## 541S4 542 543R$* <@> $@ handle <> and list:; 544 545# strip trailing dot off possibly canonical name 546R$* < @ $+ . > $* $1 < @ $2 > $3 547 548# externalize local domain info 549R$* < $+ > $* $1 $2 $3 defocus 550R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 551R@ $* $@ @ $1 ... and exit 552 553ifdef(`_NO_UUCP_', `dnl', 554`# UUCP must always be presented in old form 555R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 556 557ifdef(`_USE_DECNET_SYNTAX_', 558`# put DECnet back in :: form 559R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u', 560 `dnl') 561# delete duplicate local names 562R$+ % $=w @ $=w $1 @ $j u%host@host => u@host 563 564 565 566############################################################## 567### Ruleset 97 -- recanonicalize and call ruleset zero ### 568### (used for recursive calls) ### 569############################################################## 570 571S`'97 572R$* $: $>3 $1 573R$* $@ $>0 $1 574 575 576###################################### 577### Ruleset 0 -- Parse Address ### 578###################################### 579 580S0 581 582R<@> $#_LOCAL_ $: <@> special case error msgs 583R$* : $* ; <@> $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses" 584R<@ $+> $#error $@ 5.1.1 $: "user address required" 585R$* <$* : $* > $* $#error $@ 5.1.1 $: "colon illegal in host name part" 586R$* < @ . > $* $#error $@ 5.1.2 $: "invalid host name" 587 588ifdef(`_MAILER_smtp_', 589`# handle numeric address spec 590R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec 591R$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', 592 `dnl') 593 594# now delete the local info -- note $=O to find characters that cause forwarding 595R$* < @ > $* $@ $>97 $1 user@ => user 596R< @ $=w . > : $* $@ $>97 $2 @here:... -> ... 597R$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... 598 599# handle local hacks 600R$* $: $>98 $1 601 602# short circuit local delivery so forwarded email works 603ifdef(`_STICKY_LOCAL_DOMAIN_', 604`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub 605R< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep .... 606R< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name? 607R< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address', 608`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 609R$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name') 610ifdef(`MAILER_TABLE', 611` 612# not local -- try mailer table lookup 613R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 614R< $+ . > $* $: < $1 > $2 strip trailing dot 615R< $+ > $* $: < $(mailertable $1 $) > $2 lookup 616R< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 617R< $+ > $* $: $>90 <$1> $2 try domain', 618`dnl') 619undivert(4)dnl 620 621ifdef(`_NO_UUCP_', `dnl', 622`# resolve remotely connected UUCP links (if any) 623ifdef(`_CLASS_V_', 624`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3', 625 `dnl') 626ifdef(`_CLASS_W_', 627`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3', 628 `dnl') 629ifdef(`_CLASS_X_', 630`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3', 631 `dnl')') 632 633# resolve fake top level domains by forwarding to other hosts 634ifdef(`BITNET_RELAY', 635`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 636 `dnl') 637ifdef(`DECNET_RELAY', 638`R$*<@$+.DECNET.>$* $: $>95 < $C > $1 <@$2.DECNET.> $3 user@host.DECNET', 639 `dnl') 640ifdef(`_MAILER_pop_', 641`R$+ < @ POP. > $#pop $: $1 user@POP', 642 `dnl') 643ifdef(`_MAILER_fax_', 644`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 645`ifdef(`FAX_RELAY', 646`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX', 647 `dnl')') 648 649ifdef(`UUCP_RELAY', 650`# forward non-local UUCP traffic to our UUCP relay 651R$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail', 652`ifdef(`_MAILER_uucp_', 653`# forward other UUCP traffic straight to UUCP 654R$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 655 `dnl')') 656ifdef(`_MAILER_usenet_', ` 657# addresses sent to net.group.USENET will get forwarded to a newsgroup 658R$+ . USENET $#usenet $: $1', 659 `dnl') 660 661ifdef(`_LOCAL_RULES_', 662`# figure out what should stay in our local mail system 663undivert(1)', `dnl') 664 665# pass names that still have a host to a smarthost (if defined) 666R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name 667 668# deal with other remote names 669ifdef(`_MAILER_smtp_', 670`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 671`R$* < @$* > $* $#error $@ 5.1.2 $: Unrecognized host name $2') 672 673# if this is quoted, strip the quotes and try again 674R$+ $: $(dequote $1 $) strip quotes 675R$+ $=O $+ $@ $>97 $1 $2 $3 try again 676 677# handle locally delivered names 678R$=L $#_LOCAL_ $: @ $1 special local names 679R$+ $#_LOCAL_ $: $1 regular local names 680 681########################################################################### 682### Ruleset 5 -- special rewriting after aliases have been expanded ### 683########################################################################### 684 685S5 686 687# deal with plussed users so aliases work nicely 688R$+ + * $#_LOCAL_ $@ $&h $: $1 689R$+ + $* $#_LOCAL_ $@ $2 $: $1 + * 690 691# prepend an empty "forward host" on the front 692R$+ $: <> $1 693 694ifdef(`LUSER_RELAY', 695`# send unrecognized local users to a relay host 696R< > $+ + $* $: < $L . > $( user $1 $) + $2 697R< > $+ $: < $L . > $( user $1 $) look up user 698R< $* > $+ <> $* $: < > $2 $3 found; strip $L 699R< $* . > $+ $: < $1 > $2 strip extra dot') 700 701# handle plussed local names 702R< > $+ + $* $#_LOCAL_ $@ $2 $: $1 703 704# see if we have a relay or a hub 705R< > $+ $: < $H > $1 try hub 706R< > $+ $: < $R > $1 try relay 707R< > $+ $@ $1 nope, give up 708R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 > 709R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 > 710ifdef(`MAILER_TABLE', 711` 712 713################################################################### 714### Ruleset 90 -- try domain part of mailertable entry ### 715################################################################### 716 717S90 718R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 719R$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? 720R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again 721R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 722R<$- : $+ > $* $# $1 $@ $2 $: $3 "." found? 723R< $* > $* $@ $2 no mailertable match', 724`dnl') 725 726################################################################### 727### Ruleset 95 -- canonify mailer:host syntax to triple ### 728################################################################### 729 730S95 731R< > $* $@ $1 strip off null relay 732R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 733R< $=w > $* $@ $2 delete local host 734R< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 735 736################################################################### 737### Ruleset 98 -- local part of ruleset zero (can be null) ### 738################################################################### 739 740S98 741undivert(3)dnl 742# 743###################################################################### 744###################################################################### 745##### 746`##### MAILER DEFINITIONS' 747##### 748###################################################################### 749###################################################################### 750undivert(7)dnl 751