16f4c5567Sericdivert(-1) 26f4c5567Seric# 36f4c5567Seric# Copyright (c) 1983 Eric P. Allman 46f4c5567Seric# Copyright (c) 1988 The Regents of the University of California. 56f4c5567Seric# All rights reserved. 66f4c5567Seric# 76f4c5567Seric# %sccs.include.redist.sh% 86f4c5567Seric# 96f4c5567Sericdivert(0) 106f4c5567Seric 11*fdf362d5SericVERSIONID(`@(#)proto.m4 6.27 (Berkeley) 03/25/93') 126f4c5567Seric 1363eeb308SericMAILER(local)dnl 146f4c5567Seric 15472f2a37Sericifdef(`_OLD_SENDMAIL_', `dnl', 162635e5f8Seric`# level 4 config file format 172635e5f8SericV4') 18472f2a37Seric 196f4c5567Seric################## 206f4c5567Seric# local info # 216f4c5567Seric################## 226f4c5567Seric 2331695942SericCwlocalhost 24b1286b66Sericifdef(`USE_CW_FILE', 2531695942Seric`# file containing names of hosts for which we receive email 260bf9a1dbSericCONCAT(`Fw', confCW_FILE)', `dnl') 276f4c5567Seric 286f4c5567Sericifdef(`UUCP_RELAY', 296f4c5567Seric`# UUCP relay host 3013c6b009SericCONCAT(DY, UUCP_RELAY) 310fc742e1Seric 326f4c5567Seric')dnl 336f4c5567Sericifdef(`BITNET_RELAY', 346f4c5567Seric`# BITNET relay host 356f4c5567SericCONCAT(DB, BITNET_RELAY) 360fc742e1Seric 376f4c5567Seric')dnl 386f4c5567Sericifdef(`CSNET_RELAY', 396f4c5567Seric`# CSNET relay host 406f4c5567SericCONCAT(DC, CSNET_RELAY) 410fc742e1Seric 426f4c5567Seric')dnl 435caa7271Sericifdef(`FAX_RELAY', 445caa7271Seric`# FAX relay host 455caa7271SericCONCAT(DF, FAX_RELAY) 465caa7271Seric 475caa7271Seric')dnl 4885afb57eSericifdef(`SMART_HOST', 4985afb57eSeric`# "Smart" UUCP relay host 5085afb57eSericCONCAT(DS, SMART_HOST) 516f4c5567Seric 5285afb57eSeric')dnl 533be47185Sericifdef(`MAILER_TABLE', 543be47185Seric`# Mailer table (overriding domains) 553be47185SericKmailertable MAILER_TABLE 563be47185Seric 573be47185Seric')dnl 586f4c5567Seric# who I send unqualified names to (null means deliver locally) 596f4c5567SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY)) 606f4c5567Seric 61525ff8d9Seric# who gets all local email traffic ($R has precedence for unqualified names) 62525ff8d9SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB)) 63525ff8d9Seric 6485afb57eSeric# my official hostname ($w or $w.$D) 6585afb57eSericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D)) 6685afb57eSeric 6785afb57eSeric# who I masquerade as (can be $j) 6885afb57eSericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)) 6985afb57eSeric 7082027dd5Seric# class L: names that should be delivered locally, even if we have a relay 7182027dd5Seric# class E: names that should be exposed as from this host, even if we masquerade 7271dc253dSericCLroot 7382027dd5SericCEroot 7471dc253dSericundivert(5)dnl 7571dc253dSeric 766f4c5567Seric# operators that cannot be in local usernames (i.e., network indicators) 7790caf1e3SericCO @ % ifdef(`_NO_UUCP_', `', `!') 786f4c5567Seric 7963eeb308Seric# a class with just dot (for identifying canonical names) 8063eeb308SericC.. 8163eeb308Seric 82*fdf362d5Sericifdef(`_OLD_SENDMAIL_', `dnl', 83*fdf362d5Seric`# dequoting map 84*fdf362d5SericKdequote dequote') 856f4c5567Seric 860fc742e1Seric###################### 870fc742e1Seric# Special macros # 880fc742e1Seric###################### 896f4c5567Seric 900fc742e1Seric# SMTP initial login message 910fc742e1SericCONCAT(De, confSMTP_LOGIN_MSG) 920fc742e1Seric 930fc742e1Seric# UNIX initial From header format 940fc742e1SericCONCAT(Dl, confFROM_LINE) 950fc742e1Seric 960fc742e1Seric# my name for error messages 970fc742e1SericCONCAT(Dn, confMAILER_NAME) 980fc742e1Seric 990fc742e1Seric# delimiter (operator) characters 1000fc742e1SericCONCAT(Do, confOPERATORS) 1010fc742e1Seric 1020fc742e1Seric# format of a total name 1030fc742e1SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER, 1040fc742e1Seric ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))) 1056f4c5567Sericinclude(`../m4/version.m4') 1060fc742e1Seric 1070fc742e1Seric############### 1080fc742e1Seric# Options # 1090fc742e1Seric############### 1100fc742e1Seric 1110fc742e1Seric# preserve 8 bits on message body on input? 1120fc742e1SericCONCAT(O8, confEIGHT_BIT_INPUT) 1130fc742e1Seric 1140fc742e1Seric# wait (in minutes) for alias file rebuild 1150fc742e1SericCONCAT(Oa, confALIAS_WAIT) 1160fc742e1Seric 1170fc742e1Seric# location of alias file 1180fc742e1SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)) 1190fc742e1Seric 1202188aa70Seric# minimum number of free blocks on filesystem 1212188aa70SericCONCAT(Ob, confMIN_FREE_BLOCKS) 1222188aa70Seric 1230fc742e1Seric# substitution for space (blank) characters 1240fc742e1SericCONCAT(OB, confBLANK_SUB) 1250fc742e1Seric 1260fc742e1Seric# connect to "expensive" mailers on initial submission? 1270fc742e1SericCONCAT(Oc, confCON_EXPENSIVE) 1280fc742e1Seric 1290fc742e1Seric# checkpoint queue runs after every N successful deliveries 1300fc742e1SericCONCAT(OC, confCHECKPOINT_INTERVAL) 1310fc742e1Seric 1320fc742e1Seric# default delivery mode 1330fc742e1SericCONCAT(Od, confDELIVERY_MODE) 1340fc742e1Seric 1350fc742e1Seric# automatically rebuild the alias database? 1360fc742e1SericCONCAT(OD, confAUTO_REBUILD) 1370fc742e1Seric 1380fc742e1Seric# error message header/file */ 1390fc742e1Sericifdef(`confERROR_MESSAGE', 1400fc742e1Seric concat(OE, confERROR_MESSAGE), 1410fc742e1Seric #OE/etc/sendmail.oE) 1420fc742e1Seric 1430fc742e1Seric# error mode 1440fc742e1Sericifdef(`confERROR_MODE', 1450fc742e1Seric concat(Oe, confERROR_MODE), 1460fc742e1Seric #Oep) 1470fc742e1Seric 1480fc742e1Seric# save Unix-style "From_" lines at top of header? 1490fc742e1SericCONCAT(Of, confSAVE_FROM_LINES) 1500fc742e1Seric 1510fc742e1Seric# temporary file mode 1520fc742e1SericCONCAT(OF, confTEMP_FILE_MODE) 1530fc742e1Seric 1540fc742e1Seric# match recipients against GECOS field? 1550fc742e1SericCONCAT(OG, confMATCH_GECOS) 1560fc742e1Seric 1570fc742e1Seric# default GID 1580fc742e1SericCONCAT(Og, confDEF_GROUP_ID) 1590fc742e1Seric 1600fc742e1Seric# maximum hop count 1610fc742e1SericCONCAT(Oh, confMAX_HOP) 1620fc742e1Seric 1630fc742e1Seric# location of help file 1640fc742e1SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)) 1650fc742e1Seric 1660fc742e1Seric# ignore dots as terminators in incoming messages? 1670fc742e1SericCONCAT(Oi, confIGNORE_DOTS) 1680fc742e1Seric 1690fc742e1Seric# Insist that the BIND name server be running to resolve names 1700fc742e1Sericifdef(`confBIND_OPTS', 1710fc742e1Seric CONCAT(OI, confBIND_OPTS), 1720fc742e1Seric #OI) 1730fc742e1Seric 1740fc742e1Seric# Forward file search path 1750fc742e1Sericifdef(`confFORWARD_PATH', 1760fc742e1Seric CONCAT(OJ, confFORWARD_PATH), 1770fc742e1Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 1780fc742e1Seric 1790fc742e1Seric# open connection cache size 1800fc742e1SericCONCAT(Ok, confMCI_CACHE_SIZE) 1810fc742e1Seric 1820fc742e1Seric# open connection cache timeout 1830fc742e1SericCONCAT(OK, confMCI_CACHE_TIMEOUT) 1840fc742e1Seric 1850fc742e1Seric# log level 1860fc742e1SericCONCAT(OL, confLOG_LEVEL) 1870fc742e1Seric 1880fc742e1Seric# send to me too, even in an alias expansion? 1890fc742e1SericCONCAT(Om, confME_TOO) 1900fc742e1Seric 1910fc742e1Seric# verify RHS in newaliases? 1920fc742e1SericCONCAT(On, confCHECK_ALIASES) 1930fc742e1Seric 1940fc742e1Seric# default messages to old style headers if no special punctuation? 1950fc742e1SericCONCAT(Oo, confOLD_STYLE_HEADERS) 1960fc742e1Seric 1972188aa70Seric# privacy flags 1982188aa70SericCONCAT(Op, confPRIVACY_FLAGS) 1992188aa70Seric 2000fc742e1Seric# who (if anyone) should get extra copies of error messages 2010fc742e1Sericifdef(`confCOPY_ERRORS_TO', 2020fc742e1Seric CONCAT(OP, confCOPY_ERRORS_TO), 2030fc742e1Seric #OPPostmaster) 2040fc742e1Seric 2050fc742e1Seric# slope of queue-only function 2060fc742e1Sericifdef(`confQUEUE_FACTOR', 2070fc742e1Seric CONCAT(Oq, confQUEUE_FACTOR), 2080fc742e1Seric #Oq600000) 2090fc742e1Seric 2100fc742e1Seric# queue directory 2110fc742e1SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)) 2120fc742e1Seric 2130fc742e1Seric# read timeout -- now OK per RFC 1123 section 5.3.2 2142635e5f8Sericifdef(`confREAD_TIMEOUT', 2152635e5f8Seric CONCAT(Or, confREAD_TIMEOUT), 2162635e5f8Seric #Ordatablock=10m) 2170fc742e1Seric 2180fc742e1Seric# queue up everything before forking? 2190fc742e1SericCONCAT(Os, confSAFE_QUEUE) 2200fc742e1Seric 2210fc742e1Seric# status file 2220fc742e1SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)) 2230fc742e1Seric 2240fc742e1Seric# default message timeout interval 2250fc742e1SericCONCAT(OT, confMESSAGE_TIMEOUT) 2260fc742e1Seric 2270fc742e1Seric# time zone handling: 2280fc742e1Seric# if undefined, use system default 2290fc742e1Seric# if defined but null, use TZ envariable passed in 2300fc742e1Seric# if defined and non-null, use that info 2310fc742e1Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', 2320fc742e1Seric confTIME_ZONE, `USE_TZ', `', 2330fc742e1Seric `CONCAT(Ot, confTIME_ZONE)') 2340fc742e1Seric 2350fc742e1Seric# default UID 2360fc742e1SericCONCAT(Ou, confDEF_USER_ID) 2370fc742e1Seric 2380fc742e1Seric# list of locations of user database file (null means no lookup) 239b1ca68b5SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') 2400fc742e1Seric 2410fc742e1Seric# load average at which we just queue messages 2420fc742e1SericCONCAT(Ox, confQUEUE_LA) 2430fc742e1Seric 2440fc742e1Seric# load average at which we refuse connections 2450fc742e1SericCONCAT(OX, confREFUSE_LA) 2460fc742e1Seric 2470fc742e1Seric# work recipient factor 2480fc742e1Sericifdef(`confWORK_RECIPIENT_FACTOR', 2490fc742e1Seric CONCAT(Oy, confWORK_RECIPIENT_FACTOR), 2500fc742e1Seric #Oy30000) 2510fc742e1Seric 2520fc742e1Seric# deliver each queued job in a separate process? 2530fc742e1SericCONCAT(OY, confSEPARATE_PROC) 2540fc742e1Seric 2550fc742e1Seric# work class factor 2560fc742e1Sericifdef(`confWORK_CLASS_FACTOR', 2570fc742e1Seric CONCAT(Oz, confWORK_CLASS_FACTOR), 2580fc742e1Seric #Oz1800) 2590fc742e1Seric 2600fc742e1Seric# work time factor 2610fc742e1Sericifdef(`confWORK_TIME_FACTOR', 2620fc742e1Seric CONCAT(OZ, confWORK_TIME_FACTOR), 2630fc742e1Seric #OZ90000) 2640fc742e1Seric 2650fc742e1Seric########################### 2660fc742e1Seric# Message precedences # 2670fc742e1Seric########################### 2680fc742e1Seric 2690fc742e1SericPfirst-class=0 2700fc742e1SericPspecial-delivery=100 27185afb57eSericPlist=-30 2720fc742e1SericPbulk=-60 2730fc742e1SericPjunk=-100 2740fc742e1Seric 2750fc742e1Seric##################### 2760fc742e1Seric# Trusted users # 2770fc742e1Seric##################### 2780fc742e1Seric 2790fc742e1SericTroot 2800fc742e1SericTdaemon 2810fc742e1SericTuucp 2820fc742e1Seric 2830fc742e1Seric######################### 2840fc742e1Seric# Format of headers # 2850fc742e1Seric######################### 2860fc742e1Seric 287d5ba2395SericH?P?Return-Path: $g 2880fc742e1SericHReceived: $?sfrom $s $.by $j ($v/$Z) id $i; $b 2890fc742e1SericH?D?Resent-Date: $a 2900fc742e1SericH?D?Date: $a 2910fc742e1SericH?F?Resent-From: $q 2920fc742e1SericH?F?From: $q 2930fc742e1SericH?x?Full-Name: $x 2940fc742e1SericHSubject: 2950fc742e1Seric# HPosted-Date: $a 2960fc742e1Seric# H?l?Received-Date: $b 2970fc742e1SericH?M?Resent-Message-Id: <$t.$i@$j> 2980fc742e1SericH?M?Message-Id: <$t.$i@$j> 299c97ed732Sericundivert(6)dnl 3006f4c5567Seric# 3016f4c5567Seric###################################################################### 3026f4c5567Seric###################################################################### 3036f4c5567Seric##### 3046f4c5567Seric##### REWRITING RULES 3056f4c5567Seric##### 3066f4c5567Seric###################################################################### 3076f4c5567Seric###################################################################### 3086f4c5567Seric 3098d35298dSericundivert(9)dnl 3106f4c5567Seric 3116f4c5567Seric########################################### 3126f4c5567Seric### Rulset 3 -- Name Canonicalization ### 3136f4c5567Seric########################################### 31471e1a4d1SericS3 3156f4c5567Seric 3161c0b669eSeric# handle null input and list syntax (translate to <@> special case) 3171c0b669eSericR$@ $@ <@> 31841afd8b4SericR$*:;$* $@ $1 :; <@> 319f2ad5decSeric 3206f4c5567Seric# basic textual canonicalization -- note RFC733 heuristic here 3217b2c0d8dSericR$*<$*>$*<$*>$* <$2>$3$4$5 strip multiple <> <> 32285ebc819SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 3231c0b669eSericR$*<>$* $@ <@> MAIL FROM:<> case 3246f4c5567SericR$*<$+>$* $2 basic RFC821/822 parsing 3256f4c5567Seric 3266f4c5567Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 3276f4c5567SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 3286f4c5567Seric 3296f4c5567Seric# localize and dispose of route-based addresses 3306f4c5567SericR@ $+ : $+ $@ $>6 < @$1 > : $2 handle <route-addr> 3316f4c5567Seric 3326f4c5567Seric# find focus for list syntax 3336f4c5567SericR $+ : $* ; @ $+ $@ $>6 $1 : $2 ; < @ $3 > list syntax 3346f4c5567SericR $+ : $* ; $@ $1 : $2; list syntax 3356f4c5567Seric 3366f4c5567Seric# find focus for @ syntax addresses 3376f4c5567SericR$+ @ $+ $: $1 < @ $2 > focus on domain 3386f4c5567SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 3396f4c5567SericR$+ < @ $+ > $@ $>6 $1 < @ $2 > already canonical 3406f4c5567Seric 34190caf1e3Sericifdef(`_NO_UUCP_', `dnl', 34290caf1e3Seric`# convert old-style addresses to a domain-based address 3436f4c5567SericR$- ! $+ $@ $>6 $2 < @ $1 .UUCP > resolve uucp names 3446f4c5567SericR$+ . $- ! $+ $@ $>6 $3 < @ $1 . $2 > domain uucps 34590caf1e3SericR$+ ! $+ $@ $>6 $2 < @ $1 .UUCP > uucp subdomains') 3466f4c5567Seric 3476f4c5567Seric# if we have % signs, take the rightmost one 3486f4c5567SericR$* % $* $1 @ $2 First make them all @s. 3496f4c5567SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 3506f4c5567SericR$* @ $* $@ $>6 $1 < @ $2 > Insert < > and finish 3516f4c5567Seric 3526f4c5567Seric# else we must be a local name 3536f4c5567Seric 3546f4c5567Seric 3556f4c5567Seric############################################### 3566f4c5567Seric### Ruleset 6 -- bottom half of ruleset 3 ### 3576f4c5567Seric############################################### 3586f4c5567Seric 35982027dd5Seric# At this point, everything should be in a "local_part<@domain>extra" format. 3606f4c5567SericS6 3616f4c5567Seric 3626f4c5567Seric# handle special cases for local names 36363eeb308SericR$* < @ $=w > $* $: $1 < @ $j . > $3 no domain at all 36463eeb308SericR$* < @ $=w . UUCP > $* $: $1 < @ $j . > $3 .UUCP domain 36531695942Sericundivert(2)dnl 3666f4c5567Seric 367788179f5Sericifdef(`UUCP_RELAY', 368788179f5Seric`# pass UUCP addresses straight through 369788179f5SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP > $3', 370788179f5Seric`# if really UUCP, handle it immediately 37163eeb308Sericifdef(`_CLASS_U_', 37263eeb308Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 37363eeb308Sericifdef(`_CLASS_V_', 37463eeb308Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 37563eeb308Sericifdef(`_CLASS_W_', 37663eeb308Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 37763eeb308Sericifdef(`_CLASS_X_', 37863eeb308Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 37963eeb308Sericifdef(`_CLASS_Y_', 38063eeb308Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 381a027f997Seric 382a027f997Seric# try UUCP traffic as a local address 38363eeb308SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP > $3 3844588ece0Sericifdef(`_OLD_SENDMAIL_', 3854cad3747Seric`R$* < @ $+ . $+ . UUCP > $* $@ $1 < @ $2 . $3 . > $4', 38697777037Seric`R$* < @ $+ . . UUCP > $* $@ $1 < @ $2 . > $3')') 387a027f997Seric 3886f4c5567Seric# pass to name server to make hostname canonical 38963eeb308SericR$* < @ $* $~. > $* $: $1 < @ $[ $2 $3 $] > $4 39063eeb308Seric 39131695942Seric# handle possible alternate names 39231695942SericR$* < @ $=w . $m . > $* $: $1 < @ $j . > $3 39331695942SericR$* < @ $=w . $m > $* $: $1 < @ $j . > $3 39431695942Sericundivert(8)dnl 39531695942Seric 39663eeb308Seric# if this is the local hostname, make sure we treat is as canonical 39763eeb308SericR$* < @ $j > $* $: $1 < @ $j . > $2 3986f4c5567Seric 3996f4c5567Seric 4006f4c5567Seric################################################## 4016f4c5567Seric### Ruleset 4 -- Final Output Post-rewriting ### 4026f4c5567Seric################################################## 4036f4c5567SericS4 4046f4c5567Seric 4051c0b669eSericR$*<@> $@ $1 handle <> and list:; 4066f4c5567Seric 4076f4c5567Seric# resolve numeric addresses to name if possible 4086f4c5567SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr 4096f4c5567Seric 41063eeb308Seric# strip trailing dot off possibly canonical name 41163eeb308SericR$* < @ $+ . > $* $1 < @ $2 > $3 41263eeb308Seric 4136f4c5567Seric# externalize local domain info 4146f4c5567SericR$* < $+ > $* $1 $2 $3 defocus 4156f4c5567SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 4161f23b499SericR@ $* $@ @ $1 ... and exit 4176f4c5567Seric 41890caf1e3Sericifdef(`_NO_UUCP_', `dnl', 41990caf1e3Seric`# UUCP must always be presented in old form 42090caf1e3SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 4216f4c5567Seric 4226f4c5567Seric# delete duplicate local names 423b47d0647SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 4246f4c5567Seric 4256f4c5567Seric 4266f4c5567Seric 4276f4c5567Seric############################################################# 4286f4c5567Seric### Ruleset 7 -- recanonicalize and call ruleset zero ### 4296f4c5567Seric### (used for recursive calls) ### 4306f4c5567Seric############################################################# 4316f4c5567Seric 4326f4c5567SericS7 4336f4c5567SericR$* $: $>3 $1 4346f4c5567SericR$* $@ $>0 $1 4356f4c5567Seric 4366f4c5567Seric 4376f4c5567Seric###################################### 4386f4c5567Seric### Ruleset 0 -- Parse Address ### 4396f4c5567Seric###################################### 4406f4c5567Seric 4416f4c5567SericS0 4426f4c5567Seric 4433d995905SericR<@> $#local $: <> special case error msgs 4441c5e29abSeric 4454cad3747Sericifdef(`_MAILER_smtp_', 4464cad3747Seric`# handle numeric address spec 4476f4c5567SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr 4484cad3747SericR$* < @ [ $+ ] > $* $#smtp $@ [$2] $: $1 @ [$2] $3 numeric internet spec', 4493c5c069fSeric`dnl') 4506f4c5567Seric 451b1286b66Seric# now delete the local info -- note $=O to find characters that cause forwarding 45281ce4ccaSericR$* < @ > $* $@ $>7 $1 user@ => user 45363eeb308SericR< @ $j . > : $* $@ $>7 $1 @here:... -> ... 45463eeb308SericR$* $=O $* < @ $j . > $@ $>7 $1 $2 $3 ...@here -> ... 4553be47185Sericifdef(`MAILER_TABLE', 4563be47185Seric` 4573be47185Seric# try mailer table lookup 4583be47185SericR$* < @ $+ > $* $: $1 < @ $(mailertable $2 $) $3 4593be47185SericR$* < @ $-:$+ > $* $# $2 $@ $3 $: $1 < @ $3 > $4 found a match', 4603be47185Seric`dnl') 4616f4c5567Seric 4626f4c5567Seric# short circuit local delivery so forwarded email works 463c4cdc003Sericifdef(`_LOCAL_NOT_STICKY_', 464c4cdc003Seric`R$=L < @ $j . > $#local $: @ $1 special local names 465c4cdc003SericR$+ < @ $j . > $#local $: $1 dispose directly', 466c4cdc003Seric`R$+ < @ $j . > $: $1 < @ $j @ $H > first try hub 4674588ece0Sericifdef(`_OLD_SENDMAIL_', 46885afb57eSeric`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 < $2 > yep .... 469e319d9beSericR$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... 470525ff8d9SericR$+ < $+ @ > $#local $: $1 nope, local address', 471525ff8d9Seric`R$+ < $+ @ $+ > $#local $: $1 yep .... 472c4cdc003SericR$+ < $+ @ > $#local $: @ $1 nope, local address')') 4736f4c5567Sericundivert(3)dnl 47471e1a4d1Sericundivert(4)dnl 47571e1a4d1Seric 4764cad3747Seric# resolve remotely connected UUCP links (if any) 477138c6544Sericifdef(`_CLASS_V_', 4786dafc3b0Seric`R$* < @ $=V . UUCP > $* $#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3', 4796dafc3b0Seric `dnl') 480138c6544Sericifdef(`_CLASS_W_', 4816dafc3b0Seric`R$* < @ $=W . UUCP > $* $#smtp $@ $W $: <@ $W> : $1 @ $2.UUCP $3', 4826dafc3b0Seric `dnl') 483138c6544Sericifdef(`_CLASS_X_', 4846dafc3b0Seric`R$* < @ $=X . UUCP > $* $#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3', 4856dafc3b0Seric `dnl') 48671e1a4d1Seric 4876f4c5567Seric# resolve fake top level domains by forwarding to other hosts 4886f4c5567Sericifdef(`BITNET_RELAY', 4896f4c5567Seric`R$*<@$+.BITNET>$* $#smtp $@ $B $: $1 <@$2.BITNET> $3 user@host.BITNET', 4906f4c5567Seric `dnl') 4916f4c5567Sericifdef(`CSNET_RELAY', 4926f4c5567Seric`R$*<@$+.CSNET>$* $#smtp $@ $C $: $1 <@$2.CSNET> $3 user@host.CSNET', 4936f4c5567Seric `dnl') 4945caa7271Sericifdef(`_MAILER_fax_', 4955caa7271Seric`R$+ < @ $+ .FAX > $#fax $@ $2 $: $1 user@host.FAX', 4965caa7271Seric`ifdef(`FAX_RELAY', 4975caa7271Seric`R$*<@$+.FAX>$* $#smtp $@ $F $: $1 <@$2.FAX> $3 user@host.FAX', 4985caa7271Seric `dnl')') 4996f4c5567Seric 50071e1a4d1Sericifdef(`UUCP_RELAY', 50171e1a4d1Seric`# forward non-local UUCP traffic to our UUCP relay 5026dafc3b0SericR$*<@$*.UUCP>$* $#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3 uucp mail', 5034cad3747Seric`ifdef(`_MAILER_uucp_', 50471e1a4d1Seric`# forward other UUCP traffic straight to UUCP 50571e1a4d1SericR< @ $+ .UUCP > : $+ $#uucp $@ $1 $: $1:$2 @host.UUCP:... 50671e1a4d1SericR$+ < @ $+ .UUCP > $#uucp $@ $2 $: $1 user@host.UUCP', 50771e1a4d1Seric `dnl')') 5086f4c5567Seric 50985afb57eSericifdef(`_LOCAL_RULES_', 51085afb57eSeric`# figure out what should stay in our local mail system 51185afb57eSericundivert(1)', 51285afb57eSeric`ifdef(`_MAILER_smtp_', 5134cad3747Seric`# deal with other remote names 51485afb57eSericR$* < @ $* > $* $#smtp $@ $2 $: $1 < @ $2 > $3 user@host.domain')') 51585afb57eSericifdef(`SMART_HOST', ` 51685afb57eSeric# pass names that still have a host to a smarthost 51785afb57eSericR$* < @ $* > $* $: < $S > $1 < @ $2 > $3 glue on smarthost name 51885afb57eSericR<$-:$+> $* < @$* > $* $# $1 $@ $2 $: $3 < @ $4 > $5 if non-null, use it 51985afb57eSericR<$+> $* < @$* > $* $#suucp $@ $1 $: $2 < @ $3 > $4 if non-null, use it 52085afb57eSericR<> $* < @ $* > $* $1 < @ $2 > $3 else strip off gunk', 52185afb57eSeric`ifdef(`_LOCAL_RULES_', ` 52285afb57eSeric# reject messages that have host names we do not understand 52385afb57eSericR$* < @ $* > $* $#error $@ NOHOST $: Unrecognized host name $2', 52485afb57eSeric`dnl')') 5252188aa70Sericifdef(`_MAILER_USENET_', ` 5262188aa70Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 527a9e49ad1SericR$+ . USENET $# usenet $: $1') 5286f4c5567Seric 5294588ece0Sericifdef(`_OLD_SENDMAIL_', 530b1286b66Seric`# forward remaining names to local relay, if any 531adca7ddbSericR$=L $#local $: $1 special local names 532adca7ddbSericR$+ $: $1 < @ $R > append relay 533525ff8d9SericR$+ < @ > $: $1 < @ $H > no relay, try hub 534525ff8d9SericR$+ < @ > $#local $: $1 no relay or hub: local 535525ff8d9SericR$+ < @ $j > $#local $: $1 we are relay/hub: local 53685afb57eSericR$+ < @ $-:$+ > $# $2 $@ $3 $: $1 deliver to relay/hub 537e319d9beSericR$+ < @ $+ > $#relay $@ $2 $: $1 deliver to relay/hub', 5384588ece0Seric`# handle locally delivered names 5394588ece0SericR$=L $#local $: @ $1 special local names 540adca7ddbSericR$+ $#local $: $1 regular local names 5416f4c5567Seric 5424cad3747Seric########################################################################### 5434cad3747Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 5444cad3747Seric### (new sendmail only) ### 5454cad3747Seric########################################################################### 5466f4c5567Seric 54763eeb308SericS5 54863eeb308Seric 549*fdf362d5Seric# if this is quoted, strip the quotes and try again 550*fdf362d5SericR$+. $1 strip trailing dots 551*fdf362d5SericR$+ $: $(dequote $1 $) strip quotes 552*fdf362d5SericR$* $=O $* $>7 $1 $2 $3 try again 553*fdf362d5Seric 554*fdf362d5Seric# see if we have a relay or a hub 555*fdf362d5SericR$+ $: $1 < @ $R > 556525ff8d9SericR$+ < @ > $: $1 < @ $H > no relay, try hub 557525ff8d9SericR$+ < @ $j > $@ $1 we are relay/hub: local 55885afb57eSericR$+ < @ $-:$+ > $# $2 $@ $3 $: $1 send to relay or hub 559*fdf362d5Sericifdef(`_MAILER_smtp_', 560*fdf362d5Seric`R$+ < @ $+ > $#relay $@ $2 $: $1 send to relay or hub')') 5616f4c5567Seric# 5626f4c5567Seric###################################################################### 5636f4c5567Seric###################################################################### 5646f4c5567Seric##### 5651297e20cSeric`##### MAILER DEFINITIONS' 5666f4c5567Seric##### 5676f4c5567Seric###################################################################### 5686f4c5567Seric###################################################################### 5696f4c5567Sericundivert(7)dnl 570