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*65618SericVERSIONID(`@(#)proto.m4 8.30 (Berkeley) 01/12/94') 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 7058364Sericifdef(`FAX_RELAY', 7158364Seric`# FAX relay host 7264033SericDF`'FAX_RELAY 7360212SericCPFAX 7458364Seric 7558364Seric')dnl 7664321Seric# "Smart" relay host (may be null) 7764321SericDS`'ifdef(`SMART_HOST', SMART_HOST) 7851222Seric 7958781Sericifdef(`MAILER_TABLE', 8058781Seric`# Mailer table (overriding domains) 8158781SericKmailertable MAILER_TABLE 8258781Seric 8358781Seric')dnl 8463754Sericifdef(`DOMAIN_TABLE', 8563754Seric`# Domain table (adding domains) 8663754SericKdomaintable DOMAIN_TABLE 8763754Seric 8863754Seric')dnl 8951222Seric# who I send unqualified names to (null means deliver locally) 9064033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) 9151222Seric 9257527Seric# who gets all local email traffic ($R has precedence for unqualified names) 9364033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB) 9457527Seric 9558070Seric# who I masquerade as (can be $j) 9664033SericDM`'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 12164033SericDe`'confSMTP_LOGIN_MSG 12257944Seric 12357944Seric# UNIX initial From header format 12464033SericDl`'confFROM_LINE 12557944Seric 12657944Seric# my name for error messages 12764033SericDn`'confMAILER_NAME 12857944Seric 12957944Seric# delimiter (operator) characters 13064033SericDo`'confOPERATORS 13157944Seric 13257944Seric# format of a total name 13364033SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, 13464251Seric 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? 14264033SericO7`'confSEVEN_BIT_INPUT 14357944Seric 14457944Seric# wait (in minutes) for alias file rebuild 14564033SericOa`'confALIAS_WAIT 14657944Seric 14757944Seric# location of alias file 14864033SericOA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases) 14957944Seric 15058084Seric# minimum number of free blocks on filesystem 15164033SericOb`'confMIN_FREE_BLOCKS 15258084Seric 15357944Seric# substitution for space (blank) characters 15464033SericOB`'confBLANK_SUB 15557944Seric 156*65618Seric# avoid connecting to "expensive" mailers on initial submission? 15764033SericOc`'confCON_EXPENSIVE 15857944Seric 15957944Seric# checkpoint queue runs after every N successful deliveries 16064033SericOC`'confCHECKPOINT_INTERVAL 16157944Seric 16257944Seric# default delivery mode 16364033SericOd`'confDELIVERY_MODE 16457944Seric 16557944Seric# automatically rebuild the alias database? 16664033SericOD`'confAUTO_REBUILD 16757944Seric 16864033Seric# error message header/file 16957944Sericifdef(`confERROR_MESSAGE', 17064033Seric OE`'confERROR_MESSAGE, 17157944Seric #OE/etc/sendmail.oE) 17257944Seric 17357944Seric# error mode 17457944Sericifdef(`confERROR_MODE', 17564033Seric Oe`'confERROR_MODE, 17657944Seric #Oep) 17757944Seric 17857944Seric# save Unix-style "From_" lines at top of header? 17964033SericOf`'confSAVE_FROM_LINES 18057944Seric 18157944Seric# temporary file mode 18264033SericOF`'confTEMP_FILE_MODE 18357944Seric 18457944Seric# match recipients against GECOS field? 18564033SericOG`'confMATCH_GECOS 18657944Seric 18757944Seric# default GID 18864033SericOg`'confDEF_GROUP_ID 18957944Seric 19057944Seric# maximum hop count 19164033SericOh`'confMAX_HOP 19257944Seric 19357944Seric# location of help file 19464033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf) 19557944Seric 19657944Seric# ignore dots as terminators in incoming messages? 19764033SericOi`'confIGNORE_DOTS 19857944Seric 19957944Seric# Insist that the BIND name server be running to resolve names 20057944Sericifdef(`confBIND_OPTS', 20164033Seric OI`'confBIND_OPTS, 20257944Seric #OI) 20357944Seric 20459887Seric# deliver MIME-encapsulated error messages? 20564033SericOj`'confMIME_FORMAT_ERRORS 20659887Seric 20757944Seric# Forward file search path 20857944Sericifdef(`confFORWARD_PATH', 20964033Seric OJ`'confFORWARD_PATH, 21057944Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 21157944Seric 21257944Seric# open connection cache size 21364033SericOk`'confMCI_CACHE_SIZE 21457944Seric 21557944Seric# open connection cache timeout 21664033SericOK`'confMCI_CACHE_TIMEOUT 21757944Seric 21861106Seric# use Errors-To: header? 21964033SericOl`'confUSE_ERRORS_TO 22061106Seric 22157944Seric# log level 22264033SericOL`'confLOG_LEVEL 22357944Seric 22457944Seric# send to me too, even in an alias expansion? 22564033SericOm`'confME_TOO 22657944Seric 22757944Seric# verify RHS in newaliases? 22864033SericOn`'confCHECK_ALIASES 22957944Seric 23057944Seric# default messages to old style headers if no special punctuation? 23164033SericOo`'confOLD_STYLE_HEADERS 23257944Seric 23358860Seric# SMTP daemon options 23458860Sericifdef(`confDAEMON_OPTIONS', 23564033Seric OO`'confDAEMON_OPTIONS, 23658860Seric #OOPort=esmtp) 23758860Seric 23858084Seric# privacy flags 23964033SericOp`'confPRIVACY_FLAGS 24058084Seric 24157944Seric# who (if anyone) should get extra copies of error messages 24257944Sericifdef(`confCOPY_ERRORS_TO', 24364033Seric OP`'confCOPY_ERRORS_TO, 24457944Seric #OPPostmaster) 24557944Seric 24657944Seric# slope of queue-only function 24757944Sericifdef(`confQUEUE_FACTOR', 24864033Seric Oq`'confQUEUE_FACTOR, 24957944Seric #Oq600000) 25057944Seric 25157944Seric# queue directory 25264033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue) 25357944Seric 25457944Seric# read timeout -- now OK per RFC 1123 section 5.3.2 25558119Sericifdef(`confREAD_TIMEOUT', 25664033Seric Or`'confREAD_TIMEOUT, 25758119Seric #Ordatablock=10m) 25857944Seric 25957944Seric# queue up everything before forking? 26064033SericOs`'confSAFE_QUEUE 26157944Seric 26257944Seric# status file 26364033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st) 26457944Seric 26557944Seric# default message timeout interval 26664033SericOT`'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', 27364341Seric confTIME_ZONE, `USE_TZ', `Ot', 27464033Seric `Ot`'confTIME_ZONE') 27557944Seric 27657944Seric# default UID 27764033SericOu`'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', 28464033Seric 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 28864033SericOw`'confTRY_NULL_MX_LIST 28963858Seric 29057944Seric# load average at which we just queue messages 29164033SericOx`'confQUEUE_LA 29257944Seric 29357944Seric# load average at which we refuse connections 29464033SericOX`'confREFUSE_LA 29557944Seric 29657944Seric# work recipient factor 29757944Sericifdef(`confWORK_RECIPIENT_FACTOR', 29864033Seric Oy`'confWORK_RECIPIENT_FACTOR, 29957944Seric #Oy30000) 30057944Seric 30157944Seric# deliver each queued job in a separate process? 30264033SericOY`'confSEPARATE_PROC 30357944Seric 30457944Seric# work class factor 30557944Sericifdef(`confWORK_CLASS_FACTOR', 30664033Seric Oz`'confWORK_CLASS_FACTOR, 30757944Seric #Oz1800) 30857944Seric 30957944Seric# work time factor 31057944Sericifdef(`confWORK_TIME_FACTOR', 31164033Seric 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 33764141SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $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 36464802Seric# handle null input (translate to <@> special case) 36558499SericR$@ $@ <@> 36658174Seric 36751222Seric# basic textual canonicalization -- note RFC733 heuristic here 36864144SericR$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 36958158SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 37058499SericR$*<>$* $@ <@> MAIL FROM:<> case 37151222SericR$*<$+>$* $2 basic RFC821/822 parsing 37251222Seric 37364802Seric# handle list:; syntax as special case 37464802SericR$*:;$* $@ $1 :; <@> 37564802Seric 37651222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 37755416SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 37851222Seric 37951222Seric# localize and dispose of route-based addresses 38060894SericR@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr> 38151222Seric 38251222Seric# find focus for list syntax 38360894SericR $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax 38455416SericR $+ : $* ; $@ $1 : $2; list syntax 38551222Seric 38651222Seric# find focus for @ syntax addresses 38755416SericR$+ @ $+ $: $1 < @ $2 > focus on domain 38855416SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 38960894SericR$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical 39051222Seric 39164968Seric# do some sanity checking 39264968SericR$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 39364968Seric 39458288Sericifdef(`_NO_UUCP_', `dnl', 39558288Seric`# convert old-style addresses to a domain-based address 39660894SericR$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names 39760894SericR$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps 39860894SericR$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains') 39951222Seric 40051222Seric# if we have % signs, take the rightmost one 40155416SericR$* % $* $1 @ $2 First make them all @s. 40255416SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 40360894SericR$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish 40451222Seric 40551222Seric# else we must be a local name 40651222Seric 40751222Seric 40860894Seric################################################ 40960894Seric### Ruleset _SET_96_ -- bottom half of ruleset 3 ### 41060894Seric################################################ 41151222Seric 41257245Seric# At this point, everything should be in a "local_part<@domain>extra" format. 41360894SericS`'_SET_96_ 41451222Seric 41551222Seric# handle special cases for local names 41660262SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 41760262SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 41860262Sericifdef(`_NO_UUCP_', `dnl', 41960262Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 42064693SericR$* < @ [ $+ ] > $* $: $1 < @ [[ $2 ]] > $3 catch [a.b.c.d] 42164693SericR$* < @ [ $=w ] > $* $: $1 < @ $j . > $3 self-literal 42264693SericR$* < @ [[ $+ ]] > $* $: $1 < @ [ $2 ] > $3 strip dbl [[]] 42363754Sericifdef(`DOMAIN_TABLE', ` 42463754Seric# look up unqualified domains in the domain table 42563754SericR$* < @ $- > $* $: $1 < @ $(domaintable $2 $) > $3', 42663754Seric`dnl') 42751889Sericundivert(2)dnl 42851222Seric 42959081Sericifdef(`_NO_UUCP_', `dnl', 43059081Seric`ifdef(`UUCP_RELAY', 43151274Seric`# pass UUCP addresses straight through 43264971SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 43351274Seric`# if really UUCP, handle it immediately 43451322Sericifdef(`_CLASS_U_', 43564971Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 43651322Sericifdef(`_CLASS_V_', 43764971Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 43851322Sericifdef(`_CLASS_W_', 43964971Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44051322Sericifdef(`_CLASS_X_', 44164971Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44251322Sericifdef(`_CLASS_Y_', 44364971Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44451267Seric 44551267Seric# try UUCP traffic as a local address 44664971SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 44751992Sericifdef(`_OLD_SENDMAIL_', 44864971Seric`R$* < @ $+ . $+ . UUCP . > $* $@ $1 < @ $2 . $3 . > $4', 44964971Seric`R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3')') 45059081Seric') 45165061Sericifdef(`_NO_CANONIFY_', `dnl', 45259081Seric`# pass to name server to make hostname canonical 45361470SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 45461470Seric 45565061Seric# local host aliases and pseudo-domains are always canonical 45665061SericR$* < @ $=w > $* $: $1 < @ $2 . > $3 45764971SericR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 45865061SericR$* < @ $* . . > $* $1 < @ $2 . > $3 45964971Seric 46051889Sericundivert(8)dnl 46151889Seric 46251322Seric# if this is the local hostname, make sure we treat is as canonical 46351322SericR$* < @ $j > $* $: $1 < @ $j . > $2 46451222Seric 46551322Seric 46651222Seric################################################## 46751222Seric### Ruleset 4 -- Final Output Post-rewriting ### 46851222Seric################################################## 46951222SericS4 47051222Seric 47158499SericR$*<@> $@ $1 handle <> and list:; 47251222Seric 47351222Seric# resolve numeric addresses to name if possible 47451322SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr 47551222Seric 47651322Seric# strip trailing dot off possibly canonical name 47751322SericR$* < @ $+ . > $* $1 < @ $2 > $3 47851322Seric 47951222Seric# externalize local domain info 48051322SericR$* < $+ > $* $1 $2 $3 defocus 48151322SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 48251997SericR@ $* $@ @ $1 ... and exit 48351222Seric 48458288Sericifdef(`_NO_UUCP_', `dnl', 48558288Seric`# UUCP must always be presented in old form 48658288SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 48751222Seric 48851222Seric# delete duplicate local names 48951322SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 49051222Seric 49151222Seric 49251222Seric 49360894Seric############################################################## 49460894Seric### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ### 49560894Seric### (used for recursive calls) ### 49660894Seric############################################################## 49751222Seric 49860894SericS`'_SET_97_ 49951222SericR$* $: $>3 $1 50051222SericR$* $@ $>0 $1 50151222Seric 50251222Seric 50351222Seric###################################### 50451222Seric### Ruleset 0 -- Parse Address ### 50551222Seric###################################### 50651222Seric 50751222SericS0 50851222Seric 50963998SericR<@> $#_LOCAL_ $: <> special case error msgs 51059887SericR$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 51165048SericR<@ $+> $#error $@ USAGE $: "user address required" 51258340Seric 51355416Sericifdef(`_MAILER_smtp_', 51455416Seric`# handle numeric address spec 51563860Sericifdef(`_NO_CANONIFY_', `dnl', 51663860Seric`R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr') 51763858SericR$* < @ [ $+ ] > $* $: $>_SET_98_ $1 < @ [ $2 ] > $3 numeric internet spec 51865191SericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', 51963858Seric `dnl') 52051222Seric 52151887Seric# now delete the local info -- note $=O to find characters that cause forwarding 52264321SericR$* < @ > $* $@ $>_SET_97_ $1 user@ => user 52364321SericR< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ... 52464321SericR$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... 52563967Seric 52663967Seric# handle local hacks 52763967SericR$* $: $>_SET_98_ $1 52858781Sericifdef(`MAILER_TABLE', 52958781Seric` 53058781Seric# try mailer table lookup 53160540SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 53261106SericR< $+ . > $* $: < $1 > $2 strip trailing dot 53362582SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 53461106SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 53562582SericR< $+ > $* $: $>90 <$1> $2 try domain', 53658781Seric`dnl') 53751222Seric 53851222Seric# short circuit local delivery so forwarded email works 53958516Sericifdef(`_LOCAL_NOT_STICKY_', 54063998Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 54163998SericR$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly', 54264971Seric`R$+ < @ $=w . > $: $1 < @ $2 . @ $H > first try hub 54351992Sericifdef(`_OLD_SENDMAIL_', 54459635Seric`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 < $2 > yep .... 54559635SericR$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... 54663998SericR$+ < $+ @ > $#_LOCAL_ $: $1 nope, local address', 54763998Seric`R$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... 54863998SericR$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address')') 54951260Sericundivert(4)dnl 55051260Seric 55161468Sericifdef(`_NO_UUCP_', `dnl', 55261468Seric`# resolve remotely connected UUCP links (if any) 55351285Sericifdef(`_CLASS_V_', 55464971Seric`R$* < @ $=V . UUCP . > $* $: $>_SET_95_ < $V > $1 <@$2.UUCP.> $3', 55552044Seric `dnl') 55651285Sericifdef(`_CLASS_W_', 55764971Seric`R$* < @ $=W . UUCP . > $* $: $>_SET_95_ < $W > $1 <@$2.UUCP.> $3', 55852044Seric `dnl') 55951285Sericifdef(`_CLASS_X_', 56064971Seric`R$* < @ $=X . UUCP . > $* $: $>_SET_95_ < $X > $1 <@$2.UUCP.> $3', 56161468Seric `dnl')') 56251260Seric 56351222Seric# resolve fake top level domains by forwarding to other hosts 56451222Sericifdef(`BITNET_RELAY', 56564971Seric`R$*<@$+.BITNET.>$* $: $>_SET_95_ < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 56651222Seric `dnl') 56765149Sericifdef(`_MAILER_pop_', 56865149Seric`R$+ < @ POP. > $#pop $: $1 user@POP', 56965149Seric `dnl') 57058364Sericifdef(`_MAILER_fax_', 57164971Seric`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 57258364Seric`ifdef(`FAX_RELAY', 57364971Seric`R$*<@$+.FAX.>$* $: $>_SET_95_ < $F > $1 <@$2.FAX.> $3 user@host.FAX', 57458364Seric `dnl')') 57551222Seric 57651260Sericifdef(`UUCP_RELAY', 57751260Seric`# forward non-local UUCP traffic to our UUCP relay 57864971SericR$*<@$*.UUCP.>$* $: $>_SET_95_ < $Y > $1 <@$2.UUCP.> $3 uucp mail', 57955416Seric`ifdef(`_MAILER_uucp_', 58051260Seric`# forward other UUCP traffic straight to UUCP 58165557SericR$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 58251260Seric `dnl')') 58363967Sericifdef(`_MAILER_usenet_', ` 58463754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 58564971SericR$+ . USENET. $#usenet $: $1', 58663860Seric `dnl') 58763754Seric 58858070Sericifdef(`_LOCAL_RULES_', 58958070Seric`# figure out what should stay in our local mail system 59063754Sericundivert(1)', `dnl') 59163754Seric 59264321Seric# pass names that still have a host to a smarthost (if defined) 59364010SericR$* < @ $* > $* $: $>_SET_95_ < $S > $1 < @ $2 > $3 glue on smarthost name 59463754Seric 59564321Seric# deal with other remote names 59663946Sericifdef(`_MAILER_smtp_', 59763973Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 59864321Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2') 59951222Seric 60051992Sericifdef(`_OLD_SENDMAIL_', 60151887Seric`# forward remaining names to local relay, if any 60263998SericR$=L $#_LOCAL_ $: $1 special local names 60364010SericR$+ $: $>_SET_95_ < $R > $1 try relay 60464010SericR$+ $: $>_SET_95_ < $H > $1 try hub 60564010SericR$+ $#_LOCAL_ $: $1 no relay or hub: local', 60658811Seric 60758811Seric`# if this is quoted, strip the quotes and try again 60858811SericR$+ $: $(dequote $1 $) strip quotes 60964502SericR$+ $=O $+ $@ $>_SET_97_ $1 $2 $3 try again 61058811Seric 61158811Seric# handle locally delivered names 61263998SericR$=L $#_LOCAL_ $: @ $1 special local names 61363998SericR$+ $#_LOCAL_ $: $1 regular local names 61451222Seric 61555416Seric########################################################################### 61655416Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 61755416Seric### (new sendmail only) ### 61855416Seric########################################################################### 61951222Seric 62051322SericS5 62151322Seric 62258808Seric# see if we have a relay or a hub 62364010SericR$+ $: $>_SET_95_ < $R > $1 try relay 62464010SericR$+ $: $>_SET_95_ < $H > $1 try hub') 62560540Sericifdef(`MAILER_TABLE', 62660540Seric` 62760540Seric 62863858Seric################################################################### 62963858Seric### Ruleset 90 -- try domain part of mailertable entry ### 63063858Seric### (new sendmail only) ### 63163858Seric################################################################### 63260540Seric 63360540SericS90 63464010SericR<$- . $+ > $* $: < $(mailertable .$2 $@ $1 $) > $3 lookup 63560540SericR<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 63662372SericR< . $+ > $* $@ $>90 <$1> $2 no -- strip & try again 63760540SericR<$*> $* $@ $2 no match', 63860540Seric`dnl') 63963858Seric 64063858Seric################################################################### 64164010Seric### Ruleset _SET_95_ -- canonify mailer:host syntax to triple ### 64264010Seric################################################################### 64364010Seric 64464010SericS`'_SET_95_ 64564010SericR< > $* $@ $1 strip off null relay 64664010SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 64764010SericR< $=w > $* $@ $2 delete local host 64864010SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 64964010Seric 65064010Seric################################################################### 65163858Seric### Ruleset _SET_98_ -- local part of ruleset zero (can be null) ### 65263858Seric################################################################### 65363858Seric 65463858SericS`'_SET_98_ 65563858Sericundivert(3)dnl 65651222Seric# 65751222Seric###################################################################### 65851222Seric###################################################################### 65951222Seric##### 66056790Seric`##### MAILER DEFINITIONS' 66151222Seric##### 66251222Seric###################################################################### 66351222Seric###################################################################### 66451222Sericundivert(7)dnl 665