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