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.80 (Berkeley) 06/10/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# shall I avoid expanding CNAMEs (violates protocols)? 371_OPTION(DontExpandCnames, `confDONT_EXPAND_CNAMES') 372 373########################### 374# Message precedences # 375########################### 376 377Pfirst-class=0 378Pspecial-delivery=100 379Plist=-30 380Pbulk=-60 381Pjunk=-100 382 383##################### 384# Trusted users # 385##################### 386 387# this is equivalent to setting class "t" 388#Ft/etc/sendmail.trusted 389Troot 390Tdaemon 391Tuucp 392 393######################### 394# Format of headers # 395######################### 396 397H?P?Return-Path: $g 398HReceived: confRECEIVED_HEADER 399H?D?Resent-Date: $a 400H?D?Date: $a 401H?F?Resent-From: $q 402H?F?From: $q 403H?x?Full-Name: $x 404HSubject: 405# HPosted-Date: $a 406# H?l?Received-Date: $b 407H?M?Resent-Message-Id: <$t.$i@$j> 408H?M?Message-Id: <$t.$i@$j> 409ifdef(`_NULL_CLIENT_ONLY_', 410 `include(../m4/nullrelay.m4)m4exit', 411 `dnl') 412# 413###################################################################### 414###################################################################### 415##### 416##### REWRITING RULES 417##### 418###################################################################### 419###################################################################### 420 421undivert(9)dnl 422 423########################################### 424### Rulset 3 -- Name Canonicalization ### 425########################################### 426S3 427 428# handle null input (translate to <@> special case) 429R$@ $@ <@> 430 431# strip group: syntax (not inside angle brackets!) and trailing semicolon 432R$* $: $1 <@> mark addresses 433R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr> 434R$* :: $* <@> $: $1 :: $2 unmark node::addr 435R:`include': $* <@> $: :`include': $1 unmark :`include':... 436R$* : $* <@> $: $2 strip colon if marked 437R$* <@> $: $1 unmark 438R$* ; $: $1 strip trailing semi 439 440# null input now results from list:; syntax 441R$@ $@ :; <@> 442 443# basic textual canonicalization -- note RFC733 heuristic here 444R$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 445R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 446R$*<>$* $@ <@> MAIL FROM:<> case 447R$*<$+>$* $2 basic RFC821/822 parsing 448 449# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 450R@ $+ , $+ @ $1 : $2 change all "," to ":" 451 452# localize and dispose of route-based addresses 453R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> 454 455# find focus for list syntax 456R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax 457R $+ : $* ; $@ $1 : $2; list syntax 458 459# find focus for @ syntax addresses 460R$+ @ $+ $: $1 < @ $2 > focus on domain 461R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 462R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical 463 464# do some sanity checking 465R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 466 467ifdef(`_NO_UUCP_', `dnl', 468`# convert old-style addresses to a domain-based address 469R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names 470R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps 471R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains 472') 473ifdef(`_USE_DECNET_SYNTAX_', 474`# convert node::user addresses into a domain-based address 475R$- :: $+ $@ $>96 $2 < @ $1 .DECNET > resolve DECnet names 476R$- . $- :: $+ $@ $>96 $3 < @ $1.$2 .DECNET > numeric DECnet addr 477', 478 `dnl') 479# if we have % signs, take the rightmost one 480R$* % $* $1 @ $2 First make them all @s. 481R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 482R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish 483 484# else we must be a local name 485R$* $@ $>96 $1 486 487 488################################################ 489### Ruleset 96 -- bottom half of ruleset 3 ### 490################################################ 491 492S96 493 494# handle special cases for local names 495R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 496R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 497ifdef(`_NO_UUCP_', `dnl', 498`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 499R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] 500R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 501R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 502ifdef(`DOMAIN_TABLE', ` 503# look up domains in the domain table 504R$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', 505`dnl') 506undivert(2)dnl 507 508ifdef(`_NO_UUCP_', `dnl', 509`ifdef(`UUCP_RELAY', 510`# pass UUCP addresses straight through 511R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 512`# if really UUCP, handle it immediately 513ifdef(`_CLASS_U_', 514`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 515ifdef(`_CLASS_V_', 516`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 517ifdef(`_CLASS_W_', 518`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 519ifdef(`_CLASS_X_', 520`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 521ifdef(`_CLASS_Y_', 522`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 523 524# try UUCP traffic as a local address 525R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 526R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 527') 528ifdef(`_NO_CANONIFY_', `dnl', 529`# pass to name server to make hostname canonical 530R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 531 532# local host aliases and pseudo-domains are always canonical 533R$* < @ $=w > $* $: $1 < @ $2 . > $3 534R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 535R$* < @ $* . . > $* $1 < @ $2 . > $3 536 537# if this is the local hostname, make sure we treat is as canonical 538R$* < @ $j > $* $: $1 < @ $j . > $2 539 540 541################################################## 542### Ruleset 4 -- Final Output Post-rewriting ### 543################################################## 544S4 545 546R$* <@> $@ handle <> and list:; 547 548# strip trailing dot off possibly canonical name 549R$* < @ $+ . > $* $1 < @ $2 > $3 550 551# externalize local domain info 552R$* < $+ > $* $1 $2 $3 defocus 553R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 554R@ $* $@ @ $1 ... and exit 555 556ifdef(`_NO_UUCP_', `dnl', 557`# UUCP must always be presented in old form 558R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 559 560ifdef(`_USE_DECNET_SYNTAX_', 561`# put DECnet back in :: form 562R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u', 563 `dnl') 564# delete duplicate local names 565R$+ % $=w @ $=w $1 @ $j u%host@host => u@host 566 567 568 569############################################################## 570### Ruleset 97 -- recanonicalize and call ruleset zero ### 571### (used for recursive calls) ### 572############################################################## 573 574S`'97 575R$* $: $>3 $1 576R$* $@ $>0 $1 577 578 579###################################### 580### Ruleset 0 -- Parse Address ### 581###################################### 582 583S0 584 585R<@> $#_LOCAL_ $: <@> special case error msgs 586R$* : $* ; <@> $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses" 587R<@ $+> $#error $@ 5.1.1 $: "user address required" 588R$* <$* : $* > $* $#error $@ 5.1.1 $: "colon illegal in host name part" 589R$* < @ . > $* $#error $@ 5.1.2 $: "invalid host name" 590 591ifdef(`_MAILER_smtp_', 592`# handle numeric address spec 593R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec 594R$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', 595 `dnl') 596 597# now delete the local info -- note $=O to find characters that cause forwarding 598R$* < @ > $* $@ $>97 $1 user@ => user 599R< @ $=w . > : $* $@ $>97 $2 @here:... -> ... 600R$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... 601 602# handle local hacks 603R$* $: $>98 $1 604 605# short circuit local delivery so forwarded email works 606ifdef(`_MAILER_usenet_', 607`R$+ . USENET < @ $=w . > $#usenet $: $1 handle usenet specially', 608 `dnl') 609ifdef(`_STICKY_LOCAL_DOMAIN_', 610`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub 611R< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep .... 612R< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name? 613R< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address', 614`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 615R$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name') 616ifdef(`MAILER_TABLE', 617` 618# not local -- try mailer table lookup 619R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 620R< $+ . > $* $: < $1 > $2 strip trailing dot 621R< $+ > $* $: < $(mailertable $1 $) > $2 lookup 622R< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 623R< $+ > $* $: $>90 <$1> $2 try domain', 624`dnl') 625undivert(4)dnl 626 627ifdef(`_NO_UUCP_', `dnl', 628`# resolve remotely connected UUCP links (if any) 629ifdef(`_CLASS_V_', 630`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3', 631 `dnl') 632ifdef(`_CLASS_W_', 633`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3', 634 `dnl') 635ifdef(`_CLASS_X_', 636`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3', 637 `dnl')') 638 639# resolve fake top level domains by forwarding to other hosts 640ifdef(`BITNET_RELAY', 641`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 642 `dnl') 643ifdef(`DECNET_RELAY', 644`R$*<@$+.DECNET.>$* $: $>95 < $C > $1 <@$2.DECNET.> $3 user@host.DECNET', 645 `dnl') 646ifdef(`_MAILER_pop_', 647`R$+ < @ POP. > $#pop $: $1 user@POP', 648 `dnl') 649ifdef(`_MAILER_fax_', 650`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 651`ifdef(`FAX_RELAY', 652`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX', 653 `dnl')') 654 655ifdef(`UUCP_RELAY', 656`# forward non-local UUCP traffic to our UUCP relay 657R$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail', 658`ifdef(`_MAILER_uucp_', 659`# forward other UUCP traffic straight to UUCP 660R$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 661 `dnl')') 662ifdef(`_MAILER_usenet_', ` 663# addresses sent to net.group.USENET will get forwarded to a newsgroup 664R$+ . USENET $#usenet $: $1', 665 `dnl') 666 667ifdef(`_LOCAL_RULES_', 668`# figure out what should stay in our local mail system 669undivert(1)', `dnl') 670 671# pass names that still have a host to a smarthost (if defined) 672R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name 673 674# deal with other remote names 675ifdef(`_MAILER_smtp_', 676`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 677`R$* < @$* > $* $#error $@ 5.1.2 $: Unrecognized host name $2') 678 679# if this is quoted, strip the quotes and try again 680R$+ $: $(dequote $1 $) strip quotes 681R$+ $=O $+ $@ $>97 $1 $2 $3 try again 682 683# handle locally delivered names 684R$=L $#_LOCAL_ $: @ $1 special local names 685R$+ $#_LOCAL_ $: $1 regular local names 686 687########################################################################### 688### Ruleset 5 -- special rewriting after aliases have been expanded ### 689########################################################################### 690 691S5 692 693# deal with plussed users so aliases work nicely 694R$+ + * $#_LOCAL_ $@ $&h $: $1 695R$+ + $* $#_LOCAL_ $@ $2 $: $1 + * 696 697# prepend an empty "forward host" on the front 698R$+ $: <> $1 699 700ifdef(`LUSER_RELAY', 701`# send unrecognized local users to a relay host 702R< > $+ + $* $: < $L . > $( user $1 $) + $2 703R< > $+ $: < $L . > $( user $1 $) look up user 704R< $* > $+ <> $* $: < > $2 $3 found; strip $L 705R< $* . > $+ $: < $1 > $2 strip extra dot') 706 707# handle plussed local names 708R< > $+ + $* $#_LOCAL_ $@ $2 $: $1 709 710# see if we have a relay or a hub 711R< > $+ $: < $H > $1 try hub 712R< > $+ $: < $R > $1 try relay 713R< > $+ $@ $1 nope, give up 714R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 > 715R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 > 716ifdef(`MAILER_TABLE', 717` 718 719################################################################### 720### Ruleset 90 -- try domain part of mailertable entry ### 721################################################################### 722 723S90 724R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 725R$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? 726R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again 727R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 728R<$- : $+ > $* $# $1 $@ $2 $: $3 "." found? 729R< $* > $* $@ $2 no mailertable match', 730`dnl') 731 732################################################################### 733### Ruleset 95 -- canonify mailer:host syntax to triple ### 734################################################################### 735 736S95 737R< > $* $@ $1 strip off null relay 738R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 739R< $=w > $* $@ $2 delete local host 740R< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 741 742################################################################### 743### Ruleset 98 -- local part of ruleset zero (can be null) ### 744################################################################### 745 746S98 747undivert(3)dnl 748# 749###################################################################### 750###################################################################### 751##### 752`##### MAILER DEFINITIONS' 753##### 754###################################################################### 755###################################################################### 756undivert(7)dnl 757