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*65061SericVERSIONID(`@(#)proto.m4 8.25 (Berkeley) 12/10/93') 1251222Seric 1351322SericMAILER(local)dnl 1451222Seric 1560894Sericifdef(`_OLD_SENDMAIL_', 1664010Seric`define(`_SET_95_', 5)dnl 1764010Sericdefine(`_SET_96_', 6)dnl 1863858Sericdefine(`_SET_97_', 7)dnl 1964260Sericdefine(`_SET_98_', 8)dnl 2064260Sericdefine(`confDOMAIN_NAME', 2164260Seric `ifdef(`NEED_DOMAIN', `$w.$d', `$w')')dnl', 2264260Seric`# level 5 config file format 2364260SericV5 2464010Sericdefine(`_SET_95_', 95)dnl 2560894Sericdefine(`_SET_96_', 96)dnl 2663858Sericdefine(`_SET_97_', 97)dnl 2763858Sericdefine(`_SET_98_', 98)dnl') 2864010Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl 2963998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl 3064010Sericifdef(`confRELAY_MAILER',, 3164010Seric `define(`confRELAY_MAILER', 3264010Seric `ifdef(`_MAILER_smtp_', `relay', 3364010Seric `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl 3463998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 3563998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 3664010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 3752646Seric 3851222Seric################## 3951222Seric# local info # 4051222Seric################## 4151222Seric 4251889SericCwlocalhost 4351887Sericifdef(`USE_CW_FILE', 4451889Seric`# file containing names of hosts for which we receive email 4564033SericFw`'confCW_FILE', 4664033Seric `dnl') 4764321Sericifdef(`confDOMAIN_NAME', ` 4864321Seric# my official domain name 4964321SericDj`'confDOMAIN_NAME', 5064321Seric `dnl') 5151222Seric 5264321Sericifdef(`_NULL_CLIENT_ONLY_', 5364321Seric`include(../m4/nullrelay.m4)m4exit', 5464321Seric `dnl') 5564321Seric 5664321SericCP. 5764321Seric 5851222Sericifdef(`UUCP_RELAY', 5951222Seric`# UUCP relay host 6064033SericDY`'UUCP_RELAY 6160212SericCPUUCP 6257944Seric 6351222Seric')dnl 6451222Sericifdef(`BITNET_RELAY', 6551222Seric`# BITNET relay host 6664033SericDB`'BITNET_RELAY 6760212SericCPBITNET 6857944Seric 6951222Seric')dnl 7051222Sericifdef(`CSNET_RELAY', 7151222Seric`# CSNET relay host 7264033SericDC`'CSNET_RELAY 7360212SericCPCSNET 7457944Seric 7551222Seric')dnl 7658364Sericifdef(`FAX_RELAY', 7758364Seric`# FAX relay host 7864033SericDF`'FAX_RELAY 7960212SericCPFAX 8058364Seric 8158364Seric')dnl 8264321Seric# "Smart" relay host (may be null) 8364321SericDS`'ifdef(`SMART_HOST', SMART_HOST) 8451222Seric 8558781Sericifdef(`MAILER_TABLE', 8658781Seric`# Mailer table (overriding domains) 8758781SericKmailertable MAILER_TABLE 8858781Seric 8958781Seric')dnl 9063754Sericifdef(`DOMAIN_TABLE', 9163754Seric`# Domain table (adding domains) 9263754SericKdomaintable DOMAIN_TABLE 9363754Seric 9463754Seric')dnl 9551222Seric# who I send unqualified names to (null means deliver locally) 9664033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) 9751222Seric 9857527Seric# who gets all local email traffic ($R has precedence for unqualified names) 9964033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB) 10057527Seric 10158070Seric# who I masquerade as (can be $j) 10264033SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j) 10358070Seric 10457245Seric# class L: names that should be delivered locally, even if we have a relay 10557245Seric# class E: names that should be exposed as from this host, even if we masquerade 10651279SericCLroot 10757245SericCEroot 10851279Sericundivert(5)dnl 10951279Seric 11051222Seric# operators that cannot be in local usernames (i.e., network indicators) 11158288SericCO @ % ifdef(`_NO_UUCP_', `', `!') 11251222Seric 11351322Seric# a class with just dot (for identifying canonical names) 11451322SericC.. 11551322Seric 11658808Sericifdef(`_OLD_SENDMAIL_', `dnl', 11758808Seric`# dequoting map 11858808SericKdequote dequote') 11957944Seric 12059033Sericundivert(6)dnl 12159033Seric 12257944Seric###################### 12357944Seric# Special macros # 12457944Seric###################### 12557944Seric 12657944Seric# SMTP initial login message 12764033SericDe`'confSMTP_LOGIN_MSG 12857944Seric 12957944Seric# UNIX initial From header format 13064033SericDl`'confFROM_LINE 13157944Seric 13257944Seric# my name for error messages 13364033SericDn`'confMAILER_NAME 13457944Seric 13557944Seric# delimiter (operator) characters 13664033SericDo`'confOPERATORS 13757944Seric 13857944Seric# format of a total name 13964033SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, 14064251Seric ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')) 14157944Sericinclude(`../m4/version.m4') 14257944Seric 14357944Seric############### 14457944Seric# Options # 14557944Seric############### 14657944Seric 14759887Seric# strip message body to 7 bits on input? 14864033SericO7`'confSEVEN_BIT_INPUT 14957944Seric 15057944Seric# wait (in minutes) for alias file rebuild 15164033SericOa`'confALIAS_WAIT 15257944Seric 15357944Seric# location of alias file 15464033SericOA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases) 15557944Seric 15658084Seric# minimum number of free blocks on filesystem 15764033SericOb`'confMIN_FREE_BLOCKS 15858084Seric 15957944Seric# substitution for space (blank) characters 16064033SericOB`'confBLANK_SUB 16157944Seric 16257944Seric# connect to "expensive" mailers on initial submission? 16364033SericOc`'confCON_EXPENSIVE 16457944Seric 16557944Seric# checkpoint queue runs after every N successful deliveries 16664033SericOC`'confCHECKPOINT_INTERVAL 16757944Seric 16857944Seric# default delivery mode 16964033SericOd`'confDELIVERY_MODE 17057944Seric 17157944Seric# automatically rebuild the alias database? 17264033SericOD`'confAUTO_REBUILD 17357944Seric 17464033Seric# error message header/file 17557944Sericifdef(`confERROR_MESSAGE', 17664033Seric OE`'confERROR_MESSAGE, 17757944Seric #OE/etc/sendmail.oE) 17857944Seric 17957944Seric# error mode 18057944Sericifdef(`confERROR_MODE', 18164033Seric Oe`'confERROR_MODE, 18257944Seric #Oep) 18357944Seric 18457944Seric# save Unix-style "From_" lines at top of header? 18564033SericOf`'confSAVE_FROM_LINES 18657944Seric 18757944Seric# temporary file mode 18864033SericOF`'confTEMP_FILE_MODE 18957944Seric 19057944Seric# match recipients against GECOS field? 19164033SericOG`'confMATCH_GECOS 19257944Seric 19357944Seric# default GID 19464033SericOg`'confDEF_GROUP_ID 19557944Seric 19657944Seric# maximum hop count 19764033SericOh`'confMAX_HOP 19857944Seric 19957944Seric# location of help file 20064033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf) 20157944Seric 20257944Seric# ignore dots as terminators in incoming messages? 20364033SericOi`'confIGNORE_DOTS 20457944Seric 20557944Seric# Insist that the BIND name server be running to resolve names 20657944Sericifdef(`confBIND_OPTS', 20764033Seric OI`'confBIND_OPTS, 20857944Seric #OI) 20957944Seric 21059887Seric# deliver MIME-encapsulated error messages? 21164033SericOj`'confMIME_FORMAT_ERRORS 21259887Seric 21357944Seric# Forward file search path 21457944Sericifdef(`confFORWARD_PATH', 21564033Seric OJ`'confFORWARD_PATH, 21657944Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 21757944Seric 21857944Seric# open connection cache size 21964033SericOk`'confMCI_CACHE_SIZE 22057944Seric 22157944Seric# open connection cache timeout 22264033SericOK`'confMCI_CACHE_TIMEOUT 22357944Seric 22461106Seric# use Errors-To: header? 22564033SericOl`'confUSE_ERRORS_TO 22661106Seric 22757944Seric# log level 22864033SericOL`'confLOG_LEVEL 22957944Seric 23057944Seric# send to me too, even in an alias expansion? 23164033SericOm`'confME_TOO 23257944Seric 23357944Seric# verify RHS in newaliases? 23464033SericOn`'confCHECK_ALIASES 23557944Seric 23657944Seric# default messages to old style headers if no special punctuation? 23764033SericOo`'confOLD_STYLE_HEADERS 23857944Seric 23958860Seric# SMTP daemon options 24058860Sericifdef(`confDAEMON_OPTIONS', 24164033Seric OO`'confDAEMON_OPTIONS, 24258860Seric #OOPort=esmtp) 24358860Seric 24458084Seric# privacy flags 24564033SericOp`'confPRIVACY_FLAGS 24658084Seric 24757944Seric# who (if anyone) should get extra copies of error messages 24857944Sericifdef(`confCOPY_ERRORS_TO', 24964033Seric OP`'confCOPY_ERRORS_TO, 25057944Seric #OPPostmaster) 25157944Seric 25257944Seric# slope of queue-only function 25357944Sericifdef(`confQUEUE_FACTOR', 25464033Seric Oq`'confQUEUE_FACTOR, 25557944Seric #Oq600000) 25657944Seric 25757944Seric# queue directory 25864033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue) 25957944Seric 26057944Seric# read timeout -- now OK per RFC 1123 section 5.3.2 26158119Sericifdef(`confREAD_TIMEOUT', 26264033Seric Or`'confREAD_TIMEOUT, 26358119Seric #Ordatablock=10m) 26457944Seric 26557944Seric# queue up everything before forking? 26664033SericOs`'confSAFE_QUEUE 26757944Seric 26857944Seric# status file 26964033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st) 27057944Seric 27157944Seric# default message timeout interval 27264033SericOT`'confMESSAGE_TIMEOUT 27357944Seric 27457944Seric# time zone handling: 27557944Seric# if undefined, use system default 27657944Seric# if defined but null, use TZ envariable passed in 27757944Seric# if defined and non-null, use that info 27857944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', 27964341Seric confTIME_ZONE, `USE_TZ', `Ot', 28064033Seric `Ot`'confTIME_ZONE') 28157944Seric 28257944Seric# default UID 28364033SericOu`'confDEF_USER_ID 28457944Seric 28551887Seric# list of locations of user database file (null means no lookup) 28658720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') 28751222Seric 28858860Seric# fallback MX host 28958860Sericifdef(`confFALLBACK_MX', 29064033Seric OV`'confFALLBACK_MX, 29158860Seric #OVfall.back.host.net) 29258860Seric 29363858Seric# if we are the best MX host for a site, try it directly instead of config err 29464033SericOw`'confTRY_NULL_MX_LIST 29563858Seric 29657944Seric# load average at which we just queue messages 29764033SericOx`'confQUEUE_LA 29857944Seric 29957944Seric# load average at which we refuse connections 30064033SericOX`'confREFUSE_LA 30157944Seric 30257944Seric# work recipient factor 30357944Sericifdef(`confWORK_RECIPIENT_FACTOR', 30464033Seric Oy`'confWORK_RECIPIENT_FACTOR, 30557944Seric #Oy30000) 30657944Seric 30757944Seric# deliver each queued job in a separate process? 30864033SericOY`'confSEPARATE_PROC 30957944Seric 31057944Seric# work class factor 31157944Sericifdef(`confWORK_CLASS_FACTOR', 31264033Seric Oz`'confWORK_CLASS_FACTOR, 31357944Seric #Oz1800) 31457944Seric 31557944Seric# work time factor 31657944Sericifdef(`confWORK_TIME_FACTOR', 31764033Seric OZ`'confWORK_TIME_FACTOR, 31857944Seric #OZ90000) 31957944Seric 32057944Seric########################### 32157944Seric# Message precedences # 32257944Seric########################### 32357944Seric 32457944SericPfirst-class=0 32557944SericPspecial-delivery=100 32658070SericPlist=-30 32757944SericPbulk=-60 32857944SericPjunk=-100 32957944Seric 33057944Seric##################### 33157944Seric# Trusted users # 33257944Seric##################### 33357944Seric 33457944SericTroot 33557944SericTdaemon 33657944SericTuucp 33757944Seric 33857944Seric######################### 33957944Seric# Format of headers # 34057944Seric######################### 34157944Seric 34258679SericH?P?Return-Path: $g 34364141SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b 34457944SericH?D?Resent-Date: $a 34557944SericH?D?Date: $a 34657944SericH?F?Resent-From: $q 34757944SericH?F?From: $q 34857944SericH?x?Full-Name: $x 34957944SericHSubject: 35057944Seric# HPosted-Date: $a 35157944Seric# H?l?Received-Date: $b 35257944SericH?M?Resent-Message-Id: <$t.$i@$j> 35357944SericH?M?Message-Id: <$t.$i@$j> 35451222Seric# 35551222Seric###################################################################### 35651222Seric###################################################################### 35751222Seric##### 35851222Seric##### REWRITING RULES 35951222Seric##### 36051222Seric###################################################################### 36151222Seric###################################################################### 36251222Seric 36358678Sericundivert(9)dnl 36451222Seric 36551222Seric########################################### 36651222Seric### Rulset 3 -- Name Canonicalization ### 36751222Seric########################################### 36851260SericS3 36951222Seric 37064802Seric# handle null input (translate to <@> special case) 37158499SericR$@ $@ <@> 37258174Seric 37351222Seric# basic textual canonicalization -- note RFC733 heuristic here 37464144SericR$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 37558158SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 37658499SericR$*<>$* $@ <@> MAIL FROM:<> case 37751222SericR$*<$+>$* $2 basic RFC821/822 parsing 37851222Seric 37964802Seric# handle list:; syntax as special case 38064802SericR$*:;$* $@ $1 :; <@> 38164802Seric 38251222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 38355416SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 38451222Seric 38551222Seric# localize and dispose of route-based addresses 38660894SericR@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr> 38751222Seric 38851222Seric# find focus for list syntax 38960894SericR $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax 39055416SericR $+ : $* ; $@ $1 : $2; list syntax 39151222Seric 39251222Seric# find focus for @ syntax addresses 39355416SericR$+ @ $+ $: $1 < @ $2 > focus on domain 39455416SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 39560894SericR$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical 39651222Seric 39764968Seric# do some sanity checking 39864968SericR$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 39964968Seric 40058288Sericifdef(`_NO_UUCP_', `dnl', 40158288Seric`# convert old-style addresses to a domain-based address 40260894SericR$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names 40360894SericR$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps 40460894SericR$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains') 40551222Seric 40651222Seric# if we have % signs, take the rightmost one 40755416SericR$* % $* $1 @ $2 First make them all @s. 40855416SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 40960894SericR$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish 41051222Seric 41151222Seric# else we must be a local name 41251222Seric 41351222Seric 41460894Seric################################################ 41560894Seric### Ruleset _SET_96_ -- bottom half of ruleset 3 ### 41660894Seric################################################ 41751222Seric 41857245Seric# At this point, everything should be in a "local_part<@domain>extra" format. 41960894SericS`'_SET_96_ 42051222Seric 42151222Seric# handle special cases for local names 42260262SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 42360262SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 42460262Sericifdef(`_NO_UUCP_', `dnl', 42560262Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 42664693SericR$* < @ [ $+ ] > $* $: $1 < @ [[ $2 ]] > $3 catch [a.b.c.d] 42764693SericR$* < @ [ $=w ] > $* $: $1 < @ $j . > $3 self-literal 42864693SericR$* < @ [[ $+ ]] > $* $: $1 < @ [ $2 ] > $3 strip dbl [[]] 42963754Sericifdef(`DOMAIN_TABLE', ` 43063754Seric# look up unqualified domains in the domain table 43163754SericR$* < @ $- > $* $: $1 < @ $(domaintable $2 $) > $3', 43263754Seric`dnl') 43351889Sericundivert(2)dnl 43451222Seric 43559081Sericifdef(`_NO_UUCP_', `dnl', 43659081Seric`ifdef(`UUCP_RELAY', 43751274Seric`# pass UUCP addresses straight through 43864971SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 43951274Seric`# if really UUCP, handle it immediately 44051322Sericifdef(`_CLASS_U_', 44164971Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44251322Sericifdef(`_CLASS_V_', 44364971Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44451322Sericifdef(`_CLASS_W_', 44564971Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44651322Sericifdef(`_CLASS_X_', 44764971Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44851322Sericifdef(`_CLASS_Y_', 44964971Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 45051267Seric 45151267Seric# try UUCP traffic as a local address 45264971SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 45351992Sericifdef(`_OLD_SENDMAIL_', 45464971Seric`R$* < @ $+ . $+ . UUCP . > $* $@ $1 < @ $2 . $3 . > $4', 45564971Seric`R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3')') 45659081Seric') 457*65061Sericifdef(`_NO_CANONIFY_', `dnl', 45859081Seric`# pass to name server to make hostname canonical 45961470SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 46061470Seric 461*65061Seric# local host aliases and pseudo-domains are always canonical 462*65061SericR$* < @ $=w > $* $: $1 < @ $2 . > $3 46364971SericR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 464*65061SericR$* < @ $* . . > $* $1 < @ $2 . > $3 46564971Seric 46651889Sericundivert(8)dnl 46751889Seric 46851322Seric# if this is the local hostname, make sure we treat is as canonical 46951322SericR$* < @ $j > $* $: $1 < @ $j . > $2 47051222Seric 47151322Seric 47251222Seric################################################## 47351222Seric### Ruleset 4 -- Final Output Post-rewriting ### 47451222Seric################################################## 47551222SericS4 47651222Seric 47758499SericR$*<@> $@ $1 handle <> and list:; 47851222Seric 47951222Seric# resolve numeric addresses to name if possible 48051322SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr 48151222Seric 48251322Seric# strip trailing dot off possibly canonical name 48351322SericR$* < @ $+ . > $* $1 < @ $2 > $3 48451322Seric 48551222Seric# externalize local domain info 48651322SericR$* < $+ > $* $1 $2 $3 defocus 48751322SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 48851997SericR@ $* $@ @ $1 ... and exit 48951222Seric 49058288Sericifdef(`_NO_UUCP_', `dnl', 49158288Seric`# UUCP must always be presented in old form 49258288SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 49351222Seric 49451222Seric# delete duplicate local names 49551322SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 49651222Seric 49751222Seric 49851222Seric 49960894Seric############################################################## 50060894Seric### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ### 50160894Seric### (used for recursive calls) ### 50260894Seric############################################################## 50351222Seric 50460894SericS`'_SET_97_ 50551222SericR$* $: $>3 $1 50651222SericR$* $@ $>0 $1 50751222Seric 50851222Seric 50951222Seric###################################### 51051222Seric### Ruleset 0 -- Parse Address ### 51151222Seric###################################### 51251222Seric 51351222SericS0 51451222Seric 51563998SericR<@> $#_LOCAL_ $: <> special case error msgs 51659887SericR$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 51765048SericR<@ $+> $#error $@ USAGE $: "user address required" 51858340Seric 51955416Sericifdef(`_MAILER_smtp_', 52055416Seric`# handle numeric address spec 52163860Sericifdef(`_NO_CANONIFY_', `dnl', 52263860Seric`R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr') 52363858SericR$* < @ [ $+ ] > $* $: $>_SET_98_ $1 < @ [ $2 ] > $3 numeric internet spec 52463973SericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 @ [$2] $3 still numeric: send', 52563858Seric `dnl') 52651222Seric 52751887Seric# now delete the local info -- note $=O to find characters that cause forwarding 52864321SericR$* < @ > $* $@ $>_SET_97_ $1 user@ => user 52964321SericR< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ... 53064321SericR$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... 53163967Seric 53263967Seric# handle local hacks 53363967SericR$* $: $>_SET_98_ $1 53458781Sericifdef(`MAILER_TABLE', 53558781Seric` 53658781Seric# try mailer table lookup 53760540SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 53861106SericR< $+ . > $* $: < $1 > $2 strip trailing dot 53962582SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 54061106SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 54162582SericR< $+ > $* $: $>90 <$1> $2 try domain', 54258781Seric`dnl') 54351222Seric 54451222Seric# short circuit local delivery so forwarded email works 54558516Sericifdef(`_LOCAL_NOT_STICKY_', 54663998Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 54763998SericR$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly', 54864971Seric`R$+ < @ $=w . > $: $1 < @ $2 . @ $H > first try hub 54951992Sericifdef(`_OLD_SENDMAIL_', 55059635Seric`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 < $2 > yep .... 55159635SericR$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... 55263998SericR$+ < $+ @ > $#_LOCAL_ $: $1 nope, local address', 55363998Seric`R$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... 55463998SericR$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address')') 55551260Sericundivert(4)dnl 55651260Seric 55761468Sericifdef(`_NO_UUCP_', `dnl', 55861468Seric`# resolve remotely connected UUCP links (if any) 55951285Sericifdef(`_CLASS_V_', 56064971Seric`R$* < @ $=V . UUCP . > $* $: $>_SET_95_ < $V > $1 <@$2.UUCP.> $3', 56152044Seric `dnl') 56251285Sericifdef(`_CLASS_W_', 56364971Seric`R$* < @ $=W . UUCP . > $* $: $>_SET_95_ < $W > $1 <@$2.UUCP.> $3', 56452044Seric `dnl') 56551285Sericifdef(`_CLASS_X_', 56664971Seric`R$* < @ $=X . UUCP . > $* $: $>_SET_95_ < $X > $1 <@$2.UUCP.> $3', 56761468Seric `dnl')') 56851260Seric 56951222Seric# resolve fake top level domains by forwarding to other hosts 57051222Sericifdef(`BITNET_RELAY', 57164971Seric`R$*<@$+.BITNET.>$* $: $>_SET_95_ < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 57251222Seric `dnl') 57351222Sericifdef(`CSNET_RELAY', 57464971Seric`R$*<@$+.CSNET.>$* $: $>_SET_95_ < $C > $1 <@$2.CSNET.> $3 user@host.CSNET', 57551222Seric `dnl') 57658364Sericifdef(`_MAILER_fax_', 57764971Seric`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 57858364Seric`ifdef(`FAX_RELAY', 57964971Seric`R$*<@$+.FAX.>$* $: $>_SET_95_ < $F > $1 <@$2.FAX.> $3 user@host.FAX', 58058364Seric `dnl')') 58151222Seric 58251260Sericifdef(`UUCP_RELAY', 58351260Seric`# forward non-local UUCP traffic to our UUCP relay 58464971SericR$*<@$*.UUCP.>$* $: $>_SET_95_ < $Y > $1 <@$2.UUCP.> $3 uucp mail', 58555416Seric`ifdef(`_MAILER_uucp_', 58651260Seric`# forward other UUCP traffic straight to UUCP 58764971SericR< @ $+ .UUCP. > : $+ $#uucp $@ $1 $: $2 @host.UUCP:... 58864971SericR$+ < @ $+ .UUCP. > $#uucp $@ $2 $: $1 user@host.UUCP', 58951260Seric `dnl')') 59063967Sericifdef(`_MAILER_usenet_', ` 59163754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 59264971SericR$+ . USENET. $#usenet $: $1', 59363860Seric `dnl') 59463754Seric 59558070Sericifdef(`_LOCAL_RULES_', 59658070Seric`# figure out what should stay in our local mail system 59763754Sericundivert(1)', `dnl') 59863754Seric 59964321Seric# pass names that still have a host to a smarthost (if defined) 60064010SericR$* < @ $* > $* $: $>_SET_95_ < $S > $1 < @ $2 > $3 glue on smarthost name 60163754Seric 60264321Seric# deal with other remote names 60363946Sericifdef(`_MAILER_smtp_', 60463973Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 60564321Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2') 60651222Seric 60751992Sericifdef(`_OLD_SENDMAIL_', 60851887Seric`# forward remaining names to local relay, if any 60963998SericR$=L $#_LOCAL_ $: $1 special local names 61064010SericR$+ $: $>_SET_95_ < $R > $1 try relay 61164010SericR$+ $: $>_SET_95_ < $H > $1 try hub 61264010SericR$+ $#_LOCAL_ $: $1 no relay or hub: local', 61358811Seric 61458811Seric`# if this is quoted, strip the quotes and try again 61558811SericR$+ $: $(dequote $1 $) strip quotes 61664502SericR$+ $=O $+ $@ $>_SET_97_ $1 $2 $3 try again 61758811Seric 61858811Seric# handle locally delivered names 61963998SericR$=L $#_LOCAL_ $: @ $1 special local names 62063998SericR$+ $#_LOCAL_ $: $1 regular local names 62151222Seric 62255416Seric########################################################################### 62355416Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 62455416Seric### (new sendmail only) ### 62555416Seric########################################################################### 62651222Seric 62751322SericS5 62851322Seric 62958808Seric# see if we have a relay or a hub 63064010SericR$+ $: $>_SET_95_ < $R > $1 try relay 63164010SericR$+ $: $>_SET_95_ < $H > $1 try hub') 63260540Sericifdef(`MAILER_TABLE', 63360540Seric` 63460540Seric 63563858Seric################################################################### 63663858Seric### Ruleset 90 -- try domain part of mailertable entry ### 63763858Seric### (new sendmail only) ### 63863858Seric################################################################### 63960540Seric 64060540SericS90 64164010SericR<$- . $+ > $* $: < $(mailertable .$2 $@ $1 $) > $3 lookup 64260540SericR<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 64362372SericR< . $+ > $* $@ $>90 <$1> $2 no -- strip & try again 64460540SericR<$*> $* $@ $2 no match', 64560540Seric`dnl') 64663858Seric 64763858Seric################################################################### 64864010Seric### Ruleset _SET_95_ -- canonify mailer:host syntax to triple ### 64964010Seric################################################################### 65064010Seric 65164010SericS`'_SET_95_ 65264010SericR< > $* $@ $1 strip off null relay 65364010SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 65464010SericR< $=w > $* $@ $2 delete local host 65564010SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 65664010Seric 65764010Seric################################################################### 65863858Seric### Ruleset _SET_98_ -- local part of ruleset zero (can be null) ### 65963858Seric################################################################### 66063858Seric 66163858SericS`'_SET_98_ 66263858Sericundivert(3)dnl 66351222Seric# 66451222Seric###################################################################### 66551222Seric###################################################################### 66651222Seric##### 66756790Seric`##### MAILER DEFINITIONS' 66851222Seric##### 66951222Seric###################################################################### 67051222Seric###################################################################### 67151222Sericundivert(7)dnl 672