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