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