151222Sericdivert(-1) 251222Seric# 351222Seric# Copyright (c) 1983 Eric P. Allman 463592Sbostic# Copyright (c) 1988, 1993 563592Sbostic# The Regents of the University of California. All rights reserved. 651222Seric# 751222Seric# %sccs.include.redist.sh% 851222Seric# 951222Sericdivert(0) 1051222Seric 11*64010SericVERSIONID(`@(#)proto.m4 8.9 (Berkeley) 07/23/93') 1251222Seric 1351322SericMAILER(local)dnl 1451222Seric 1560894Sericifdef(`_OLD_SENDMAIL_', 16*64010Seric`define(`_SET_95_', 5)dnl 17*64010Sericdefine(`_SET_96_', 6)dnl 1863858Sericdefine(`_SET_97_', 7)dnl 1963858Sericdefine(`_SET_98_', 8)dnl', 2058119Seric`# level 4 config file format 2160894SericV4 22*64010Sericdefine(`_SET_95_', 95)dnl 2360894Sericdefine(`_SET_96_', 96)dnl 2463858Sericdefine(`_SET_97_', 97)dnl 2563858Sericdefine(`_SET_98_', 98)dnl') 26*64010Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl 2763998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl 28*64010Sericifdef(`confRELAY_MAILER',, 29*64010Seric `define(`confRELAY_MAILER', 30*64010Seric `ifdef(`_MAILER_smtp_', `relay', 31*64010Seric `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl 3263998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 3363998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 34*64010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 3552646Seric 3651222Seric################## 3751222Seric# local info # 3851222Seric################## 3951222Seric 4060212SericCP. 4160212Seric 4251889SericCwlocalhost 4351887Sericifdef(`USE_CW_FILE', 4451889Seric`# file containing names of hosts for which we receive email 4558406SericCONCAT(`Fw', confCW_FILE)', `dnl') 4651222Seric 4751222Sericifdef(`UUCP_RELAY', 4851222Seric`# UUCP relay host 4951281SericCONCAT(DY, UUCP_RELAY) 5060212SericCPUUCP 5157944Seric 5251222Seric')dnl 5351222Sericifdef(`BITNET_RELAY', 5451222Seric`# BITNET relay host 5551222SericCONCAT(DB, BITNET_RELAY) 5660212SericCPBITNET 5757944Seric 5851222Seric')dnl 5951222Sericifdef(`CSNET_RELAY', 6051222Seric`# CSNET relay host 6151222SericCONCAT(DC, CSNET_RELAY) 6260212SericCPCSNET 6357944Seric 6451222Seric')dnl 6558364Sericifdef(`FAX_RELAY', 6658364Seric`# FAX relay host 6758364SericCONCAT(DF, FAX_RELAY) 6860212SericCPFAX 6958364Seric 7058364Seric')dnl 7158070Sericifdef(`SMART_HOST', 7258070Seric`# "Smart" UUCP relay host 7358070SericCONCAT(DS, SMART_HOST) 7451222Seric 7558070Seric')dnl 7658781Sericifdef(`MAILER_TABLE', 7758781Seric`# Mailer table (overriding domains) 7858781SericKmailertable MAILER_TABLE 7958781Seric 8058781Seric')dnl 8163754Sericifdef(`DOMAIN_TABLE', 8263754Seric`# Domain table (adding domains) 8363754SericKdomaintable DOMAIN_TABLE 8463754Seric 8563754Seric')dnl 8651222Seric# who I send unqualified names to (null means deliver locally) 8751222SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY)) 8851222Seric 8957527Seric# who gets all local email traffic ($R has precedence for unqualified names) 9057527SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB)) 9157527Seric 9258070Seric# my official hostname ($w or $w.$D) 9358070SericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D)) 9458070Seric 9558070Seric# who I masquerade as (can be $j) 9658070SericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)) 9758070Seric 9857245Seric# class L: names that should be delivered locally, even if we have a relay 9957245Seric# class E: names that should be exposed as from this host, even if we masquerade 10051279SericCLroot 10157245SericCEroot 10251279Sericundivert(5)dnl 10351279Seric 10451222Seric# operators that cannot be in local usernames (i.e., network indicators) 10558288SericCO @ % ifdef(`_NO_UUCP_', `', `!') 10651222Seric 10751322Seric# a class with just dot (for identifying canonical names) 10851322SericC.. 10951322Seric 11058808Sericifdef(`_OLD_SENDMAIL_', `dnl', 11158808Seric`# dequoting map 11258808SericKdequote dequote') 11357944Seric 11459033Sericundivert(6)dnl 11559033Seric 11657944Seric###################### 11757944Seric# Special macros # 11857944Seric###################### 11957944Seric 12057944Seric# SMTP initial login message 12157944SericCONCAT(De, confSMTP_LOGIN_MSG) 12257944Seric 12357944Seric# UNIX initial From header format 12457944SericCONCAT(Dl, confFROM_LINE) 12557944Seric 12657944Seric# my name for error messages 12757944SericCONCAT(Dn, confMAILER_NAME) 12857944Seric 12957944Seric# delimiter (operator) characters 13057944SericCONCAT(Do, confOPERATORS) 13157944Seric 13257944Seric# format of a total name 13357944SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER, 13457944Seric ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))) 13557944Sericinclude(`../m4/version.m4') 13657944Seric 13757944Seric############### 13857944Seric# Options # 13957944Seric############### 14057944Seric 14159887Seric# strip message body to 7 bits on input? 14259887SericCONCAT(O7, confSEVEN_BIT_INPUT) 14357944Seric 14457944Seric# wait (in minutes) for alias file rebuild 14557944SericCONCAT(Oa, confALIAS_WAIT) 14657944Seric 14757944Seric# location of alias file 14857944SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)) 14957944Seric 15058084Seric# minimum number of free blocks on filesystem 15158084SericCONCAT(Ob, confMIN_FREE_BLOCKS) 15258084Seric 15357944Seric# substitution for space (blank) characters 15457944SericCONCAT(OB, confBLANK_SUB) 15557944Seric 15657944Seric# connect to "expensive" mailers on initial submission? 15757944SericCONCAT(Oc, confCON_EXPENSIVE) 15857944Seric 15957944Seric# checkpoint queue runs after every N successful deliveries 16057944SericCONCAT(OC, confCHECKPOINT_INTERVAL) 16157944Seric 16257944Seric# default delivery mode 16357944SericCONCAT(Od, confDELIVERY_MODE) 16457944Seric 16557944Seric# automatically rebuild the alias database? 16657944SericCONCAT(OD, confAUTO_REBUILD) 16757944Seric 16857944Seric# error message header/file */ 16957944Sericifdef(`confERROR_MESSAGE', 17063583Seric CONCAT(OE, confERROR_MESSAGE), 17157944Seric #OE/etc/sendmail.oE) 17257944Seric 17357944Seric# error mode 17457944Sericifdef(`confERROR_MODE', 17563583Seric CONCAT(Oe, confERROR_MODE), 17657944Seric #Oep) 17757944Seric 17857944Seric# save Unix-style "From_" lines at top of header? 17957944SericCONCAT(Of, confSAVE_FROM_LINES) 18057944Seric 18157944Seric# temporary file mode 18257944SericCONCAT(OF, confTEMP_FILE_MODE) 18357944Seric 18457944Seric# match recipients against GECOS field? 18557944SericCONCAT(OG, confMATCH_GECOS) 18657944Seric 18757944Seric# default GID 18857944SericCONCAT(Og, confDEF_GROUP_ID) 18957944Seric 19057944Seric# maximum hop count 19157944SericCONCAT(Oh, confMAX_HOP) 19257944Seric 19357944Seric# location of help file 19457944SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)) 19557944Seric 19657944Seric# ignore dots as terminators in incoming messages? 19757944SericCONCAT(Oi, confIGNORE_DOTS) 19857944Seric 19957944Seric# Insist that the BIND name server be running to resolve names 20057944Sericifdef(`confBIND_OPTS', 20157944Seric CONCAT(OI, confBIND_OPTS), 20257944Seric #OI) 20357944Seric 20459887Seric# deliver MIME-encapsulated error messages? 20559887SericCONCAT(Oj, confMIME_FORMAT_ERRORS) 20659887Seric 20757944Seric# Forward file search path 20857944Sericifdef(`confFORWARD_PATH', 20957944Seric CONCAT(OJ, confFORWARD_PATH), 21057944Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 21157944Seric 21257944Seric# open connection cache size 21357944SericCONCAT(Ok, confMCI_CACHE_SIZE) 21457944Seric 21557944Seric# open connection cache timeout 21657944SericCONCAT(OK, confMCI_CACHE_TIMEOUT) 21757944Seric 21861106Seric# use Errors-To: header? 21961106SericCONCAT(Ol, confUSE_ERRORS_TO) 22061106Seric 22157944Seric# log level 22257944SericCONCAT(OL, confLOG_LEVEL) 22357944Seric 22457944Seric# send to me too, even in an alias expansion? 22557944SericCONCAT(Om, confME_TOO) 22657944Seric 22757944Seric# verify RHS in newaliases? 22857944SericCONCAT(On, confCHECK_ALIASES) 22957944Seric 23057944Seric# default messages to old style headers if no special punctuation? 23157944SericCONCAT(Oo, confOLD_STYLE_HEADERS) 23257944Seric 23358860Seric# SMTP daemon options 23458860Sericifdef(`confDAEMON_OPTIONS', 23558860Seric CONCAT(OO, confDAEMON_OPTIONS), 23658860Seric #OOPort=esmtp) 23758860Seric 23858084Seric# privacy flags 23958084SericCONCAT(Op, confPRIVACY_FLAGS) 24058084Seric 24157944Seric# who (if anyone) should get extra copies of error messages 24257944Sericifdef(`confCOPY_ERRORS_TO', 24357944Seric CONCAT(OP, confCOPY_ERRORS_TO), 24457944Seric #OPPostmaster) 24557944Seric 24657944Seric# slope of queue-only function 24757944Sericifdef(`confQUEUE_FACTOR', 24857944Seric CONCAT(Oq, confQUEUE_FACTOR), 24957944Seric #Oq600000) 25057944Seric 25157944Seric# queue directory 25257944SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)) 25357944Seric 25457944Seric# read timeout -- now OK per RFC 1123 section 5.3.2 25558119Sericifdef(`confREAD_TIMEOUT', 25658119Seric CONCAT(Or, confREAD_TIMEOUT), 25758119Seric #Ordatablock=10m) 25857944Seric 25957944Seric# queue up everything before forking? 26057944SericCONCAT(Os, confSAFE_QUEUE) 26157944Seric 26257944Seric# status file 26357944SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)) 26457944Seric 26557944Seric# default message timeout interval 26657944SericCONCAT(OT, confMESSAGE_TIMEOUT) 26757944Seric 26857944Seric# time zone handling: 26957944Seric# if undefined, use system default 27057944Seric# if defined but null, use TZ envariable passed in 27157944Seric# if defined and non-null, use that info 27257944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', 27357944Seric confTIME_ZONE, `USE_TZ', `', 27457944Seric `CONCAT(Ot, confTIME_ZONE)') 27557944Seric 27657944Seric# default UID 27757944SericCONCAT(Ou, confDEF_USER_ID) 27857944Seric 27951887Seric# list of locations of user database file (null means no lookup) 28058720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') 28151222Seric 28258860Seric# fallback MX host 28358860Sericifdef(`confFALLBACK_MX', 28458860Seric CONCAT(OV, confFALLBACK_MX), 28558860Seric #OVfall.back.host.net) 28658860Seric 28763858Seric# if we are the best MX host for a site, try it directly instead of config err 28863858SericCONCAT(Ow, confTRY_NULL_MX_LIST) 28963858Seric 29057944Seric# load average at which we just queue messages 29157944SericCONCAT(Ox, confQUEUE_LA) 29257944Seric 29357944Seric# load average at which we refuse connections 29457944SericCONCAT(OX, confREFUSE_LA) 29557944Seric 29657944Seric# work recipient factor 29757944Sericifdef(`confWORK_RECIPIENT_FACTOR', 29857944Seric CONCAT(Oy, confWORK_RECIPIENT_FACTOR), 29957944Seric #Oy30000) 30057944Seric 30157944Seric# deliver each queued job in a separate process? 30257944SericCONCAT(OY, confSEPARATE_PROC) 30357944Seric 30457944Seric# work class factor 30557944Sericifdef(`confWORK_CLASS_FACTOR', 30657944Seric CONCAT(Oz, confWORK_CLASS_FACTOR), 30757944Seric #Oz1800) 30857944Seric 30957944Seric# work time factor 31057944Sericifdef(`confWORK_TIME_FACTOR', 31157944Seric CONCAT(OZ, confWORK_TIME_FACTOR), 31257944Seric #OZ90000) 31357944Seric 31457944Seric########################### 31557944Seric# Message precedences # 31657944Seric########################### 31757944Seric 31857944SericPfirst-class=0 31957944SericPspecial-delivery=100 32058070SericPlist=-30 32157944SericPbulk=-60 32257944SericPjunk=-100 32357944Seric 32457944Seric##################### 32557944Seric# Trusted users # 32657944Seric##################### 32757944Seric 32857944SericTroot 32957944SericTdaemon 33057944SericTuucp 33157944Seric 33257944Seric######################### 33357944Seric# Format of headers # 33457944Seric######################### 33557944Seric 33658679SericH?P?Return-Path: $g 33760894SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b 33857944SericH?D?Resent-Date: $a 33957944SericH?D?Date: $a 34057944SericH?F?Resent-From: $q 34157944SericH?F?From: $q 34257944SericH?x?Full-Name: $x 34357944SericHSubject: 34457944Seric# HPosted-Date: $a 34557944Seric# H?l?Received-Date: $b 34657944SericH?M?Resent-Message-Id: <$t.$i@$j> 34757944SericH?M?Message-Id: <$t.$i@$j> 34851222Seric# 34951222Seric###################################################################### 35051222Seric###################################################################### 35151222Seric##### 35251222Seric##### REWRITING RULES 35351222Seric##### 35451222Seric###################################################################### 35551222Seric###################################################################### 35651222Seric 35758678Sericundivert(9)dnl 35851222Seric 35951222Seric########################################### 36051222Seric### Rulset 3 -- Name Canonicalization ### 36151222Seric########################################### 36251260SericS3 36351222Seric 36458499Seric# handle null input and list syntax (translate to <@> special case) 36558499SericR$@ $@ <@> 36658707SericR$*:;$* $@ $1 :; <@> 36758174Seric 36851222Seric# basic textual canonicalization -- note RFC733 heuristic here 36957012SericR$*<$*>$*<$*>$* <$2>$3$4$5 strip multiple <> <> 37058158SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 37158499SericR$*<>$* $@ <@> MAIL FROM:<> case 37251222SericR$*<$+>$* $2 basic RFC821/822 parsing 37351222Seric 37451222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 37555416SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 37651222Seric 37751222Seric# localize and dispose of route-based addresses 37860894SericR@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr> 37951222Seric 38051222Seric# find focus for list syntax 38160894SericR $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax 38255416SericR $+ : $* ; $@ $1 : $2; list syntax 38351222Seric 38451222Seric# find focus for @ syntax addresses 38555416SericR$+ @ $+ $: $1 < @ $2 > focus on domain 38655416SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 38760894SericR$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical 38851222Seric 38958288Sericifdef(`_NO_UUCP_', `dnl', 39058288Seric`# convert old-style addresses to a domain-based address 39160894SericR$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names 39260894SericR$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps 39360894SericR$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains') 39451222Seric 39551222Seric# if we have % signs, take the rightmost one 39655416SericR$* % $* $1 @ $2 First make them all @s. 39755416SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 39860894SericR$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish 39951222Seric 40051222Seric# else we must be a local name 40151222Seric 40251222Seric 40360894Seric################################################ 40460894Seric### Ruleset _SET_96_ -- bottom half of ruleset 3 ### 40560894Seric################################################ 40651222Seric 40757245Seric# At this point, everything should be in a "local_part<@domain>extra" format. 40860894SericS`'_SET_96_ 40951222Seric 41051222Seric# handle special cases for local names 41160262SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 41260262SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 41360262Sericifdef(`_NO_UUCP_', `dnl', 41460262Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 41563754Sericifdef(`DOMAIN_TABLE', ` 41663754Seric# look up unqualified domains in the domain table 41763754SericR$* < @ $- > $* $: $1 < @ $(domaintable $2 $) > $3', 41863754Seric`dnl') 41951889Sericundivert(2)dnl 42051222Seric 42159081Sericifdef(`_NO_UUCP_', `dnl', 42259081Seric`ifdef(`UUCP_RELAY', 42351274Seric`# pass UUCP addresses straight through 42455416SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP > $3', 42551274Seric`# if really UUCP, handle it immediately 42651322Sericifdef(`_CLASS_U_', 42755416Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 42851322Sericifdef(`_CLASS_V_', 42955416Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 43051322Sericifdef(`_CLASS_W_', 43155416Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 43251322Sericifdef(`_CLASS_X_', 43355416Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 43451322Sericifdef(`_CLASS_Y_', 43555416Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 43651267Seric 43751267Seric# try UUCP traffic as a local address 43855416SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP > $3 43951992Sericifdef(`_OLD_SENDMAIL_', 44055416Seric`R$* < @ $+ . $+ . UUCP > $* $@ $1 < @ $2 . $3 . > $4', 44155416Seric`R$* < @ $+ . . UUCP > $* $@ $1 < @ $2 . > $3')') 44259081Seric') 44361470Sericifdef(`_NO_CANONIFY_', 44461470Seric`# make sure local host names appear canonical 44561470SericR$* < @ $=w > $* $: $1 < @ $2 . > $3', 44659081Seric`# pass to name server to make hostname canonical 44761470SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 44861470Seric 44951889Sericundivert(8)dnl 45051889Seric 45151322Seric# if this is the local hostname, make sure we treat is as canonical 45251322SericR$* < @ $j > $* $: $1 < @ $j . > $2 45351222Seric 45451322Seric 45551222Seric################################################## 45651222Seric### Ruleset 4 -- Final Output Post-rewriting ### 45751222Seric################################################## 45851222SericS4 45951222Seric 46058499SericR$*<@> $@ $1 handle <> and list:; 46151222Seric 46251222Seric# resolve numeric addresses to name if possible 46351322SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr 46451222Seric 46551322Seric# strip trailing dot off possibly canonical name 46651322SericR$* < @ $+ . > $* $1 < @ $2 > $3 46751322Seric 46851222Seric# externalize local domain info 46951322SericR$* < $+ > $* $1 $2 $3 defocus 47051322SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 47151997SericR@ $* $@ @ $1 ... and exit 47251222Seric 47358288Sericifdef(`_NO_UUCP_', `dnl', 47458288Seric`# UUCP must always be presented in old form 47558288SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 47651222Seric 47751222Seric# delete duplicate local names 47851322SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 47951222Seric 48051222Seric 48151222Seric 48260894Seric############################################################## 48360894Seric### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ### 48460894Seric### (used for recursive calls) ### 48560894Seric############################################################## 48651222Seric 48760894SericS`'_SET_97_ 48851222SericR$* $: $>3 $1 48951222SericR$* $@ $>0 $1 49051222Seric 49151222Seric 49251222Seric###################################### 49351222Seric### Ruleset 0 -- Parse Address ### 49451222Seric###################################### 49551222Seric 49651222SericS0 49751222Seric 49863998SericR<@> $#_LOCAL_ $: <> special case error msgs 49959887SericR$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 50058340Seric 50155416Sericifdef(`_MAILER_smtp_', 50255416Seric`# handle numeric address spec 50363860Sericifdef(`_NO_CANONIFY_', `dnl', 50463860Seric`R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr') 50563858SericR$* < @ [ $+ ] > $* $: $>_SET_98_ $1 < @ [ $2 ] > $3 numeric internet spec 50663973SericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 @ [$2] $3 still numeric: send', 50763858Seric `dnl') 50851222Seric 50951887Seric# now delete the local info -- note $=O to find characters that cause forwarding 51060894SericR$* < @ > $* $@ $>_SET_97_ $1 user@ => user 51160894SericR< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ... 51260894SericR$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... 51363967Seric 51463967Seric# handle local hacks 51563967SericR$* $: $>_SET_98_ $1 51658781Sericifdef(`MAILER_TABLE', 51758781Seric` 51858781Seric# try mailer table lookup 51960540SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 52061106SericR< $+ . > $* $: < $1 > $2 strip trailing dot 52162582SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 52261106SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 52362582SericR< $+ > $* $: $>90 <$1> $2 try domain', 52458781Seric`dnl') 52551222Seric 52651222Seric# short circuit local delivery so forwarded email works 52758516Sericifdef(`_LOCAL_NOT_STICKY_', 52863998Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 52963998SericR$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly', 53060894Seric`R$+ < @ $=w . > $: $1 < @ $2 @ $H > first try hub 53151992Sericifdef(`_OLD_SENDMAIL_', 53259635Seric`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 < $2 > yep .... 53359635SericR$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... 53463998SericR$+ < $+ @ > $#_LOCAL_ $: $1 nope, local address', 53563998Seric`R$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... 53663998SericR$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address')') 53751260Sericundivert(4)dnl 53851260Seric 53961468Sericifdef(`_NO_UUCP_', `dnl', 54061468Seric`# resolve remotely connected UUCP links (if any) 54151285Sericifdef(`_CLASS_V_', 542*64010Seric`R$* < @ $=V . UUCP > $* $: $>_SET_95_ < $V > <@ $V> : $1 @ $2.UUCP $3', 54352044Seric `dnl') 54451285Sericifdef(`_CLASS_W_', 545*64010Seric`R$* < @ $=W . UUCP > $* $: $>_SET_95_ < $W > <@ $W> : $1 @ $2.UUCP $3', 54652044Seric `dnl') 54751285Sericifdef(`_CLASS_X_', 548*64010Seric`R$* < @ $=X . UUCP > $* $: $>_SET_95_ < $X > <@ $X> : $1 @ $2.UUCP $3', 54961468Seric `dnl')') 55051260Seric 55151222Seric# resolve fake top level domains by forwarding to other hosts 55251222Sericifdef(`BITNET_RELAY', 553*64010Seric`R$*<@$+.BITNET>$* $: $>_SET_95_ < $B > $1 <@$2.BITNET> $3 user@host.BITNET', 55451222Seric `dnl') 55551222Sericifdef(`CSNET_RELAY', 556*64010Seric`R$*<@$+.CSNET>$* $: $>_SET_95_ < $C > $1 <@$2.CSNET> $3 user@host.CSNET', 55751222Seric `dnl') 55858364Sericifdef(`_MAILER_fax_', 55963858Seric`R$+ < @ $+ .FAX > $#fax $@ $2 $: $1 user@host.FAX', 56058364Seric`ifdef(`FAX_RELAY', 561*64010Seric`R$*<@$+.FAX>$* $: $>_SET_95_ < $F > $1 <@$2.FAX> $3 user@host.FAX', 56258364Seric `dnl')') 56351222Seric 56451260Sericifdef(`UUCP_RELAY', 56551260Seric`# forward non-local UUCP traffic to our UUCP relay 566*64010SericR$*<@$*.UUCP>$* $: $>_SET_95_ < $Y > <@ $Y> : $1 @ $2.UUCP $3 uucp mail', 56755416Seric`ifdef(`_MAILER_uucp_', 56851260Seric`# forward other UUCP traffic straight to UUCP 56963858SericR< @ $+ .UUCP > : $+ $#uucp $@ $1 $: $2 @host.UUCP:... 57063858SericR$+ < @ $+ .UUCP > $#uucp $@ $2 $: $1 user@host.UUCP', 57151260Seric `dnl')') 57263967Sericifdef(`_MAILER_usenet_', ` 57363754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 57463998SericR$+ . USENET $#usenet $: $1', 57563860Seric `dnl') 57663754Seric 57758070Sericifdef(`_LOCAL_RULES_', 57858070Seric`# figure out what should stay in our local mail system 57963754Sericundivert(1)', `dnl') 58063754Seric 58163946Sericifdef(`SMART_HOST', 58263946Seric`# pass names that still have a host to a smarthost 583*64010SericR$* < @ $* > $* $: $>_SET_95_ < $S > $1 < @ $2 > $3 glue on smarthost name 58463858SericR< $- : $+ > $* $# $1 $@ $2 $: $3 if non-null, use it 58563858SericR< $+ > $* $#suucp $@ $1 $: $2 if non-null, use it 58663858SericR<> $* $: $1 else strip off gunk', 58763754Seric 58863754Seric`# deal with other remote names 58963946Sericifdef(`_MAILER_smtp_', 59063973Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 59163946Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2')') 59251222Seric 59351992Sericifdef(`_OLD_SENDMAIL_', 59451887Seric`# forward remaining names to local relay, if any 59563998SericR$=L $#_LOCAL_ $: $1 special local names 596*64010SericR$+ $: $>_SET_95_ < $R > $1 try relay 597*64010SericR$+ $: $>_SET_95_ < $H > $1 try hub 598*64010SericR$+ $#_LOCAL_ $: $1 no relay or hub: local', 59958811Seric 60058811Seric`# if this is quoted, strip the quotes and try again 60158811SericR$+ $: $(dequote $1 $) strip quotes 60260894SericR$* $=O $* $@ $>_SET_97_ $1 $2 $3 try again 60358811Seric 60458811Seric# handle locally delivered names 60563998SericR$=L $#_LOCAL_ $: @ $1 special local names 60663998SericR$+ $#_LOCAL_ $: $1 regular local names 60751222Seric 60855416Seric########################################################################### 60955416Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 61055416Seric### (new sendmail only) ### 61155416Seric########################################################################### 61251222Seric 61351322SericS5 61451322Seric 61558808Seric# see if we have a relay or a hub 616*64010SericR$+ $: $>_SET_95_ < $R > $1 try relay 617*64010SericR$+ $: $>_SET_95_ < $H > $1 try hub') 61860540Sericifdef(`MAILER_TABLE', 61960540Seric` 62060540Seric 62163858Seric################################################################### 62263858Seric### Ruleset 90 -- try domain part of mailertable entry ### 62363858Seric### (new sendmail only) ### 62463858Seric################################################################### 62560540Seric 62660540SericS90 627*64010SericR<$- . $+ > $* $: < $(mailertable .$2 $@ $1 $) > $3 lookup 62860540SericR<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 62962372SericR< . $+ > $* $@ $>90 <$1> $2 no -- strip & try again 63060540SericR<$*> $* $@ $2 no match', 63160540Seric`dnl') 63263858Seric 63363858Seric################################################################### 634*64010Seric### Ruleset _SET_95_ -- canonify mailer:host syntax to triple ### 635*64010Seric################################################################### 636*64010Seric 637*64010SericS`'_SET_95_ 638*64010SericR< > $* $@ $1 strip off null relay 639*64010SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 640*64010SericR< $=w > $* $@ $2 delete local host 641*64010SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 642*64010Seric 643*64010Seric################################################################### 64463858Seric### Ruleset _SET_98_ -- local part of ruleset zero (can be null) ### 64563858Seric################################################################### 64663858Seric 64763858SericS`'_SET_98_ 64863858Sericundivert(3)dnl 64951222Seric# 65051222Seric###################################################################### 65151222Seric###################################################################### 65251222Seric##### 65356790Seric`##### MAILER DEFINITIONS' 65451222Seric##### 65551222Seric###################################################################### 65651222Seric###################################################################### 65751222Sericundivert(7)dnl 658