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*64719SericVERSIONID(`@(#)proto.m4 8.19 (Berkeley) 10/15/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 37058499Seric# handle null input and list syntax (translate to <@> special case) 37158499SericR$@ $@ <@> 37258707SericR$*:;$* $@ $1 :; <@> 37358174Seric 37451222Seric# basic textual canonicalization -- note RFC733 heuristic here 37564144SericR$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 37658158SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 37758499SericR$*<>$* $@ <@> MAIL FROM:<> case 37851222SericR$*<$+>$* $2 basic RFC821/822 parsing 37951222Seric 38051222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 38155416SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 38251222Seric 38351222Seric# localize and dispose of route-based addresses 38460894SericR@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr> 38551222Seric 38651222Seric# find focus for list syntax 38760894SericR $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax 38855416SericR $+ : $* ; $@ $1 : $2; list syntax 38951222Seric 39051222Seric# find focus for @ syntax addresses 39155416SericR$+ @ $+ $: $1 < @ $2 > focus on domain 39255416SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 39360894SericR$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical 39451222Seric 39558288Sericifdef(`_NO_UUCP_', `dnl', 39658288Seric`# convert old-style addresses to a domain-based address 39760894SericR$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names 39860894SericR$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps 39960894SericR$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains') 40051222Seric 40151222Seric# if we have % signs, take the rightmost one 40255416SericR$* % $* $1 @ $2 First make them all @s. 40355416SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 40460894SericR$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish 40551222Seric 40651222Seric# else we must be a local name 40751222Seric 40851222Seric 40960894Seric################################################ 41060894Seric### Ruleset _SET_96_ -- bottom half of ruleset 3 ### 41160894Seric################################################ 41251222Seric 41357245Seric# At this point, everything should be in a "local_part<@domain>extra" format. 41460894SericS`'_SET_96_ 41551222Seric 41651222Seric# handle special cases for local names 41760262SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 41860262SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 41960262Sericifdef(`_NO_UUCP_', `dnl', 42060262Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 42164693SericR$* < @ [ $+ ] > $* $: $1 < @ [[ $2 ]] > $3 catch [a.b.c.d] 42264693SericR$* < @ [ $=w ] > $* $: $1 < @ $j . > $3 self-literal 42364693SericR$* < @ [[ $+ ]] > $* $: $1 < @ [ $2 ] > $3 strip dbl [[]] 42463754Sericifdef(`DOMAIN_TABLE', ` 42563754Seric# look up unqualified domains in the domain table 42663754SericR$* < @ $- > $* $: $1 < @ $(domaintable $2 $) > $3', 42763754Seric`dnl') 42851889Sericundivert(2)dnl 42951222Seric 43059081Sericifdef(`_NO_UUCP_', `dnl', 43159081Seric`ifdef(`UUCP_RELAY', 43251274Seric`# pass UUCP addresses straight through 43355416SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP > $3', 43451274Seric`# if really UUCP, handle it immediately 43551322Sericifdef(`_CLASS_U_', 43655416Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 43751322Sericifdef(`_CLASS_V_', 43855416Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 43951322Sericifdef(`_CLASS_W_', 44055416Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 44151322Sericifdef(`_CLASS_X_', 44255416Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 44351322Sericifdef(`_CLASS_Y_', 44455416Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 44551267Seric 44651267Seric# try UUCP traffic as a local address 44755416SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP > $3 44851992Sericifdef(`_OLD_SENDMAIL_', 44955416Seric`R$* < @ $+ . $+ . UUCP > $* $@ $1 < @ $2 . $3 . > $4', 45055416Seric`R$* < @ $+ . . UUCP > $* $@ $1 < @ $2 . > $3')') 45159081Seric') 45261470Sericifdef(`_NO_CANONIFY_', 45361470Seric`# make sure local host names appear canonical 45461470SericR$* < @ $=w > $* $: $1 < @ $2 . > $3', 45559081Seric`# pass to name server to make hostname canonical 45661470SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 45761470Seric 45851889Sericundivert(8)dnl 45951889Seric 46051322Seric# if this is the local hostname, make sure we treat is as canonical 46151322SericR$* < @ $j > $* $: $1 < @ $j . > $2 46251222Seric 46351322Seric 46451222Seric################################################## 46551222Seric### Ruleset 4 -- Final Output Post-rewriting ### 46651222Seric################################################## 46751222SericS4 46851222Seric 46958499SericR$*<@> $@ $1 handle <> and list:; 47051222Seric 47151222Seric# resolve numeric addresses to name if possible 47251322SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr 47351222Seric 47451322Seric# strip trailing dot off possibly canonical name 47551322SericR$* < @ $+ . > $* $1 < @ $2 > $3 47651322Seric 47751222Seric# externalize local domain info 47851322SericR$* < $+ > $* $1 $2 $3 defocus 47951322SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 48051997SericR@ $* $@ @ $1 ... and exit 48151222Seric 48258288Sericifdef(`_NO_UUCP_', `dnl', 48358288Seric`# UUCP must always be presented in old form 48458288SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 48551222Seric 48651222Seric# delete duplicate local names 48751322SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 48851222Seric 48951222Seric 49051222Seric 49160894Seric############################################################## 49260894Seric### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ### 49360894Seric### (used for recursive calls) ### 49460894Seric############################################################## 49551222Seric 49660894SericS`'_SET_97_ 49751222SericR$* $: $>3 $1 49851222SericR$* $@ $>0 $1 49951222Seric 50051222Seric 50151222Seric###################################### 50251222Seric### Ruleset 0 -- Parse Address ### 50351222Seric###################################### 50451222Seric 50551222SericS0 50651222Seric 50763998SericR<@> $#_LOCAL_ $: <> special case error msgs 50859887SericR$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 50958340Seric 51055416Sericifdef(`_MAILER_smtp_', 51155416Seric`# handle numeric address spec 51263860Sericifdef(`_NO_CANONIFY_', `dnl', 51363860Seric`R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr') 51463858SericR$* < @ [ $+ ] > $* $: $>_SET_98_ $1 < @ [ $2 ] > $3 numeric internet spec 51563973SericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 @ [$2] $3 still numeric: send', 51663858Seric `dnl') 51751222Seric 51851887Seric# now delete the local info -- note $=O to find characters that cause forwarding 51964321SericR$* < @ > $* $@ $>_SET_97_ $1 user@ => user 52064321SericR< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ... 52164321SericR$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... 52263967Seric 52363967Seric# handle local hacks 52463967SericR$* $: $>_SET_98_ $1 52558781Sericifdef(`MAILER_TABLE', 52658781Seric` 52758781Seric# try mailer table lookup 52860540SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 52961106SericR< $+ . > $* $: < $1 > $2 strip trailing dot 53062582SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 53161106SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 53262582SericR< $+ > $* $: $>90 <$1> $2 try domain', 53358781Seric`dnl') 53451222Seric 53551222Seric# short circuit local delivery so forwarded email works 53658516Sericifdef(`_LOCAL_NOT_STICKY_', 53763998Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 53863998SericR$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly', 53960894Seric`R$+ < @ $=w . > $: $1 < @ $2 @ $H > first try hub 54051992Sericifdef(`_OLD_SENDMAIL_', 54159635Seric`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 < $2 > yep .... 54259635SericR$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... 54363998SericR$+ < $+ @ > $#_LOCAL_ $: $1 nope, local address', 54463998Seric`R$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... 54563998SericR$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address')') 54651260Sericundivert(4)dnl 54751260Seric 54861468Sericifdef(`_NO_UUCP_', `dnl', 54961468Seric`# resolve remotely connected UUCP links (if any) 55051285Sericifdef(`_CLASS_V_', 551*64719Seric`R$* < @ $=V . UUCP > $* $: $>_SET_95_ < $V > $1 <@$2.UUCP> $3', 55252044Seric `dnl') 55351285Sericifdef(`_CLASS_W_', 554*64719Seric`R$* < @ $=W . UUCP > $* $: $>_SET_95_ < $W > $1 <@$2.UUCP> $3', 55552044Seric `dnl') 55651285Sericifdef(`_CLASS_X_', 557*64719Seric`R$* < @ $=X . UUCP > $* $: $>_SET_95_ < $X > $1 <@$2.UUCP> $3', 55861468Seric `dnl')') 55951260Seric 56051222Seric# resolve fake top level domains by forwarding to other hosts 56151222Sericifdef(`BITNET_RELAY', 56264010Seric`R$*<@$+.BITNET>$* $: $>_SET_95_ < $B > $1 <@$2.BITNET> $3 user@host.BITNET', 56351222Seric `dnl') 56451222Sericifdef(`CSNET_RELAY', 56564010Seric`R$*<@$+.CSNET>$* $: $>_SET_95_ < $C > $1 <@$2.CSNET> $3 user@host.CSNET', 56651222Seric `dnl') 56758364Sericifdef(`_MAILER_fax_', 56863858Seric`R$+ < @ $+ .FAX > $#fax $@ $2 $: $1 user@host.FAX', 56958364Seric`ifdef(`FAX_RELAY', 57064010Seric`R$*<@$+.FAX>$* $: $>_SET_95_ < $F > $1 <@$2.FAX> $3 user@host.FAX', 57158364Seric `dnl')') 57251222Seric 57351260Sericifdef(`UUCP_RELAY', 57451260Seric`# forward non-local UUCP traffic to our UUCP relay 575*64719SericR$*<@$*.UUCP>$* $: $>_SET_95_ < $Y > $1 @ <$2.UUCP> $3 uucp mail', 57655416Seric`ifdef(`_MAILER_uucp_', 57751260Seric`# forward other UUCP traffic straight to UUCP 57863858SericR< @ $+ .UUCP > : $+ $#uucp $@ $1 $: $2 @host.UUCP:... 57963858SericR$+ < @ $+ .UUCP > $#uucp $@ $2 $: $1 user@host.UUCP', 58051260Seric `dnl')') 58163967Sericifdef(`_MAILER_usenet_', ` 58263754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 58363998SericR$+ . USENET $#usenet $: $1', 58463860Seric `dnl') 58563754Seric 58658070Sericifdef(`_LOCAL_RULES_', 58758070Seric`# figure out what should stay in our local mail system 58863754Sericundivert(1)', `dnl') 58963754Seric 59064321Seric# pass names that still have a host to a smarthost (if defined) 59164010SericR$* < @ $* > $* $: $>_SET_95_ < $S > $1 < @ $2 > $3 glue on smarthost name 59263754Seric 59364321Seric# deal with other remote names 59463946Sericifdef(`_MAILER_smtp_', 59563973Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 59664321Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2') 59751222Seric 59851992Sericifdef(`_OLD_SENDMAIL_', 59951887Seric`# forward remaining names to local relay, if any 60063998SericR$=L $#_LOCAL_ $: $1 special local names 60164010SericR$+ $: $>_SET_95_ < $R > $1 try relay 60264010SericR$+ $: $>_SET_95_ < $H > $1 try hub 60364010SericR$+ $#_LOCAL_ $: $1 no relay or hub: local', 60458811Seric 60558811Seric`# if this is quoted, strip the quotes and try again 60658811SericR$+ $: $(dequote $1 $) strip quotes 60764502SericR$+ $=O $+ $@ $>_SET_97_ $1 $2 $3 try again 60858811Seric 60958811Seric# handle locally delivered names 61063998SericR$=L $#_LOCAL_ $: @ $1 special local names 61163998SericR$+ $#_LOCAL_ $: $1 regular local names 61251222Seric 61355416Seric########################################################################### 61455416Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 61555416Seric### (new sendmail only) ### 61655416Seric########################################################################### 61751222Seric 61851322SericS5 61951322Seric 62058808Seric# see if we have a relay or a hub 62164010SericR$+ $: $>_SET_95_ < $R > $1 try relay 62264010SericR$+ $: $>_SET_95_ < $H > $1 try hub') 62360540Sericifdef(`MAILER_TABLE', 62460540Seric` 62560540Seric 62663858Seric################################################################### 62763858Seric### Ruleset 90 -- try domain part of mailertable entry ### 62863858Seric### (new sendmail only) ### 62963858Seric################################################################### 63060540Seric 63160540SericS90 63264010SericR<$- . $+ > $* $: < $(mailertable .$2 $@ $1 $) > $3 lookup 63360540SericR<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 63462372SericR< . $+ > $* $@ $>90 <$1> $2 no -- strip & try again 63560540SericR<$*> $* $@ $2 no match', 63660540Seric`dnl') 63763858Seric 63863858Seric################################################################### 63964010Seric### Ruleset _SET_95_ -- canonify mailer:host syntax to triple ### 64064010Seric################################################################### 64164010Seric 64264010SericS`'_SET_95_ 64364010SericR< > $* $@ $1 strip off null relay 64464010SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 64564010SericR< $=w > $* $@ $2 delete local host 64664010SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 64764010Seric 64864010Seric################################################################### 64963858Seric### Ruleset _SET_98_ -- local part of ruleset zero (can be null) ### 65063858Seric################################################################### 65163858Seric 65263858SericS`'_SET_98_ 65363858Sericundivert(3)dnl 65451222Seric# 65551222Seric###################################################################### 65651222Seric###################################################################### 65751222Seric##### 65856790Seric`##### MAILER DEFINITIONS' 65951222Seric##### 66051222Seric###################################################################### 66151222Seric###################################################################### 66251222Sericundivert(7)dnl 663