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*67469SericVERSIONID(`@(#)proto.m4 8.49 (Berkeley) 07/02/94') 1251222Seric 1351322SericMAILER(local)dnl 1451222Seric 15*67469Seric# level 5 config file format 1664260SericV5 1764010Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl 1863998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl 1964010Sericifdef(`confRELAY_MAILER',, 2064010Seric `define(`confRELAY_MAILER', 2164010Seric `ifdef(`_MAILER_smtp_', `relay', 2264010Seric `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl 2363998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 2463998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 2564010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 2652646Seric 2751222Seric################## 2851222Seric# local info # 2951222Seric################## 3051222Seric 3151889SericCwlocalhost 3251887Sericifdef(`USE_CW_FILE', 3351889Seric`# file containing names of hosts for which we receive email 3464033SericFw`'confCW_FILE', 3564033Seric `dnl') 3664321Sericifdef(`confDOMAIN_NAME', ` 3764321Seric# my official domain name 3864321SericDj`'confDOMAIN_NAME', 3964321Seric `dnl') 4051222Seric 4164321Sericifdef(`_NULL_CLIENT_ONLY_', 4264321Seric`include(../m4/nullrelay.m4)m4exit', 4364321Seric `dnl') 4464321Seric 4564321SericCP. 4664321Seric 4751222Sericifdef(`UUCP_RELAY', 4851222Seric`# UUCP relay host 4964033SericDY`'UUCP_RELAY 5060212SericCPUUCP 5157944Seric 5251222Seric')dnl 5351222Sericifdef(`BITNET_RELAY', 5451222Seric`# BITNET relay host 5564033SericDB`'BITNET_RELAY 5660212SericCPBITNET 5757944Seric 5851222Seric')dnl 5958364Sericifdef(`FAX_RELAY', 6058364Seric`# FAX relay host 6164033SericDF`'FAX_RELAY 6260212SericCPFAX 6358364Seric 6458364Seric')dnl 6564321Seric# "Smart" relay host (may be null) 6664321SericDS`'ifdef(`SMART_HOST', SMART_HOST) 6751222Seric 6858781Sericifdef(`MAILER_TABLE', 6958781Seric`# Mailer table (overriding domains) 7058781SericKmailertable MAILER_TABLE 7158781Seric 7258781Seric')dnl 7363754Sericifdef(`DOMAIN_TABLE', 7463754Seric`# Domain table (adding domains) 7563754SericKdomaintable DOMAIN_TABLE 7663754Seric 7763754Seric')dnl 7851222Seric# who I send unqualified names to (null means deliver locally) 7964033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) 8051222Seric 8157527Seric# who gets all local email traffic ($R has precedence for unqualified names) 8264033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB) 8357527Seric 8466085Seric# who I masquerade as (null for no masquerading) 8566085SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME) 8658070Seric 8757245Seric# class L: names that should be delivered locally, even if we have a relay 8857245Seric# class E: names that should be exposed as from this host, even if we masquerade 8966050Seric#CLroot 9057245SericCEroot 9151279Sericundivert(5)dnl 9251279Seric 9351222Seric# operators that cannot be in local usernames (i.e., network indicators) 9458288SericCO @ % ifdef(`_NO_UUCP_', `', `!') 9551222Seric 9651322Seric# a class with just dot (for identifying canonical names) 9751322SericC.. 9851322Seric 99*67469Seric# dequoting map 100*67469SericKdequote dequote 10157944Seric 10259033Sericundivert(6)dnl 10359033Seric 10457944Seric###################### 10557944Seric# Special macros # 10657944Seric###################### 10757944Seric 10857944Seric# SMTP initial login message 10964033SericDe`'confSMTP_LOGIN_MSG 11057944Seric 11157944Seric# UNIX initial From header format 11264033SericDl`'confFROM_LINE 11357944Seric 11457944Seric# my name for error messages 11564033SericDn`'confMAILER_NAME 11657944Seric 11757944Seric# delimiter (operator) characters 11864033SericDo`'confOPERATORS 11957944Seric 12057944Seric# format of a total name 121*67469SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, $g$?x ($x)$.', `$?x$x <$g>$|$g$.) 12257944Sericinclude(`../m4/version.m4') 12357944Seric 12457944Seric############### 12557944Seric# Options # 12657944Seric############### 12757944Seric 12859887Seric# strip message body to 7 bits on input? 12964033SericO7`'confSEVEN_BIT_INPUT 13057944Seric 13157944Seric# wait (in minutes) for alias file rebuild 13264033SericOa`'confALIAS_WAIT 13357944Seric 13457944Seric# location of alias file 13565825SericOA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases) 13657944Seric 13758084Seric# minimum number of free blocks on filesystem 13864033SericOb`'confMIN_FREE_BLOCKS 13958084Seric 14057944Seric# substitution for space (blank) characters 14164033SericOB`'confBLANK_SUB 14257944Seric 14365618Seric# avoid connecting to "expensive" mailers on initial submission? 14464033SericOc`'confCON_EXPENSIVE 14557944Seric 14657944Seric# checkpoint queue runs after every N successful deliveries 14764033SericOC`'confCHECKPOINT_INTERVAL 14857944Seric 14957944Seric# default delivery mode 15064033SericOd`'confDELIVERY_MODE 15157944Seric 15257944Seric# automatically rebuild the alias database? 15364033SericOD`'confAUTO_REBUILD 15457944Seric 15564033Seric# error message header/file 15657944Sericifdef(`confERROR_MESSAGE', 15764033Seric OE`'confERROR_MESSAGE, 15857944Seric #OE/etc/sendmail.oE) 15957944Seric 16057944Seric# error mode 16157944Sericifdef(`confERROR_MODE', 16264033Seric Oe`'confERROR_MODE, 16357944Seric #Oep) 16457944Seric 16557944Seric# save Unix-style "From_" lines at top of header? 16664033SericOf`'confSAVE_FROM_LINES 16757944Seric 16857944Seric# temporary file mode 16964033SericOF`'confTEMP_FILE_MODE 17057944Seric 17157944Seric# match recipients against GECOS field? 17264033SericOG`'confMATCH_GECOS 17357944Seric 17457944Seric# default GID 17564033SericOg`'confDEF_GROUP_ID 17657944Seric 17757944Seric# maximum hop count 17864033SericOh`'confMAX_HOP 17957944Seric 18057944Seric# location of help file 18164033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf) 18257944Seric 18357944Seric# ignore dots as terminators in incoming messages? 18464033SericOi`'confIGNORE_DOTS 18557944Seric 18657944Seric# Insist that the BIND name server be running to resolve names 18757944Sericifdef(`confBIND_OPTS', 18864033Seric OI`'confBIND_OPTS, 18957944Seric #OI) 19057944Seric 19159887Seric# deliver MIME-encapsulated error messages? 19264033SericOj`'confMIME_FORMAT_ERRORS 19359887Seric 19457944Seric# Forward file search path 19557944Sericifdef(`confFORWARD_PATH', 19664033Seric OJ`'confFORWARD_PATH, 19757944Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 19857944Seric 19957944Seric# open connection cache size 20064033SericOk`'confMCI_CACHE_SIZE 20157944Seric 20257944Seric# open connection cache timeout 20364033SericOK`'confMCI_CACHE_TIMEOUT 20457944Seric 20561106Seric# use Errors-To: header? 20664033SericOl`'confUSE_ERRORS_TO 20761106Seric 20857944Seric# log level 20964033SericOL`'confLOG_LEVEL 21057944Seric 21157944Seric# send to me too, even in an alias expansion? 21264033SericOm`'confME_TOO 21357944Seric 21457944Seric# verify RHS in newaliases? 21564033SericOn`'confCHECK_ALIASES 21657944Seric 21757944Seric# default messages to old style headers if no special punctuation? 21864033SericOo`'confOLD_STYLE_HEADERS 21957944Seric 22058860Seric# SMTP daemon options 22158860Sericifdef(`confDAEMON_OPTIONS', 22264033Seric OO`'confDAEMON_OPTIONS, 22358860Seric #OOPort=esmtp) 22458860Seric 22558084Seric# privacy flags 22664033SericOp`'confPRIVACY_FLAGS 22758084Seric 22857944Seric# who (if anyone) should get extra copies of error messages 22957944Sericifdef(`confCOPY_ERRORS_TO', 23064033Seric OP`'confCOPY_ERRORS_TO, 23157944Seric #OPPostmaster) 23257944Seric 23357944Seric# slope of queue-only function 23457944Sericifdef(`confQUEUE_FACTOR', 23564033Seric Oq`'confQUEUE_FACTOR, 23657944Seric #Oq600000) 23757944Seric 23857944Seric# queue directory 23964033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue) 24057944Seric 24157944Seric# read timeout -- now OK per RFC 1123 section 5.3.2 24258119Sericifdef(`confREAD_TIMEOUT', 24364033Seric Or`'confREAD_TIMEOUT, 24458119Seric #Ordatablock=10m) 24557944Seric 24657944Seric# queue up everything before forking? 24764033SericOs`'confSAFE_QUEUE 24857944Seric 24957944Seric# status file 25064033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st) 25157944Seric 25257944Seric# default message timeout interval 25364033SericOT`'confMESSAGE_TIMEOUT 25457944Seric 25557944Seric# time zone handling: 25657944Seric# if undefined, use system default 25757944Seric# if defined but null, use TZ envariable passed in 25857944Seric# if defined and non-null, use that info 25957944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', 26064341Seric confTIME_ZONE, `USE_TZ', `Ot', 26164033Seric `Ot`'confTIME_ZONE') 26257944Seric 26357944Seric# default UID 26464033SericOu`'confDEF_USER_ID 26557944Seric 26651887Seric# list of locations of user database file (null means no lookup) 26758720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') 26851222Seric 26958860Seric# fallback MX host 27058860Sericifdef(`confFALLBACK_MX', 27164033Seric OV`'confFALLBACK_MX, 27258860Seric #OVfall.back.host.net) 27358860Seric 27463858Seric# if we are the best MX host for a site, try it directly instead of config err 27564033SericOw`'confTRY_NULL_MX_LIST 27663858Seric 27757944Seric# load average at which we just queue messages 27864033SericOx`'confQUEUE_LA 27957944Seric 28057944Seric# load average at which we refuse connections 28164033SericOX`'confREFUSE_LA 28257944Seric 28357944Seric# work recipient factor 28457944Sericifdef(`confWORK_RECIPIENT_FACTOR', 28564033Seric Oy`'confWORK_RECIPIENT_FACTOR, 28657944Seric #Oy30000) 28757944Seric 28857944Seric# deliver each queued job in a separate process? 28964033SericOY`'confSEPARATE_PROC 29057944Seric 29157944Seric# work class factor 29257944Sericifdef(`confWORK_CLASS_FACTOR', 29364033Seric Oz`'confWORK_CLASS_FACTOR, 29457944Seric #Oz1800) 29557944Seric 29657944Seric# work time factor 29757944Sericifdef(`confWORK_TIME_FACTOR', 29864033Seric OZ`'confWORK_TIME_FACTOR, 29957944Seric #OZ90000) 30057944Seric 30157944Seric########################### 30257944Seric# Message precedences # 30357944Seric########################### 30457944Seric 30557944SericPfirst-class=0 30657944SericPspecial-delivery=100 30758070SericPlist=-30 30857944SericPbulk=-60 30957944SericPjunk=-100 31057944Seric 31157944Seric##################### 31257944Seric# Trusted users # 31357944Seric##################### 31457944Seric 31557944SericTroot 31657944SericTdaemon 31757944SericTuucp 31857944Seric 31957944Seric######################### 32057944Seric# Format of headers # 32157944Seric######################### 32257944Seric 32358679SericH?P?Return-Path: $g 32466015SericHReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b 32557944SericH?D?Resent-Date: $a 32657944SericH?D?Date: $a 32757944SericH?F?Resent-From: $q 32857944SericH?F?From: $q 32957944SericH?x?Full-Name: $x 33057944SericHSubject: 33157944Seric# HPosted-Date: $a 33257944Seric# H?l?Received-Date: $b 33357944SericH?M?Resent-Message-Id: <$t.$i@$j> 33457944SericH?M?Message-Id: <$t.$i@$j> 33551222Seric# 33651222Seric###################################################################### 33751222Seric###################################################################### 33851222Seric##### 33951222Seric##### REWRITING RULES 34051222Seric##### 34151222Seric###################################################################### 34251222Seric###################################################################### 34351222Seric 34458678Sericundivert(9)dnl 34551222Seric 34651222Seric########################################### 34751222Seric### Rulset 3 -- Name Canonicalization ### 34851222Seric########################################### 34951260SericS3 35051222Seric 35164802Seric# handle null input (translate to <@> special case) 35258499SericR$@ $@ <@> 35358174Seric 35451222Seric# basic textual canonicalization -- note RFC733 heuristic here 35564144SericR$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 35658158SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 35758499SericR$*<>$* $@ <@> MAIL FROM:<> case 35851222SericR$*<$+>$* $2 basic RFC821/822 parsing 35951222Seric 36064802Seric# handle list:; syntax as special case 36164802SericR$*:;$* $@ $1 :; <@> 36264802Seric 36351222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 36455416SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 36551222Seric 36651222Seric# localize and dispose of route-based addresses 367*67469SericR@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> 36851222Seric 36951222Seric# find focus for list syntax 370*67469SericR $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax 37155416SericR $+ : $* ; $@ $1 : $2; list syntax 37251222Seric 37351222Seric# find focus for @ syntax addresses 37455416SericR$+ @ $+ $: $1 < @ $2 > focus on domain 37555416SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 376*67469SericR$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical 37751222Seric 37864968Seric# do some sanity checking 37964968SericR$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 38064968Seric 38158288Sericifdef(`_NO_UUCP_', `dnl', 38258288Seric`# convert old-style addresses to a domain-based address 383*67469SericR$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names 384*67469SericR$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps 385*67469SericR$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains') 38651222Seric 38751222Seric# if we have % signs, take the rightmost one 38855416SericR$* % $* $1 @ $2 First make them all @s. 38955416SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 390*67469SericR$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish 39151222Seric 39251222Seric# else we must be a local name 39351222Seric 39451222Seric 39560894Seric################################################ 396*67469Seric### Ruleset 96 -- bottom half of ruleset 3 ### 39760894Seric################################################ 39851222Seric 39957245Seric# At this point, everything should be in a "local_part<@domain>extra" format. 400*67469SericS96 40151222Seric 40251222Seric# handle special cases for local names 40360262SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 40460262SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 40560262Sericifdef(`_NO_UUCP_', `dnl', 40660262Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 40765825SericR$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] 40865825SericR$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 40966306SericR$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 41063754Sericifdef(`DOMAIN_TABLE', ` 41167450Seric# look up domains in the domain table 41267450SericR$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', 41363754Seric`dnl') 41451889Sericundivert(2)dnl 41551222Seric 41659081Sericifdef(`_NO_UUCP_', `dnl', 41759081Seric`ifdef(`UUCP_RELAY', 41851274Seric`# pass UUCP addresses straight through 41964971SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 42051274Seric`# if really UUCP, handle it immediately 42151322Sericifdef(`_CLASS_U_', 42264971Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 42351322Sericifdef(`_CLASS_V_', 42464971Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 42551322Sericifdef(`_CLASS_W_', 42664971Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 42751322Sericifdef(`_CLASS_X_', 42864971Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 42951322Sericifdef(`_CLASS_Y_', 43064971Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 43151267Seric 43251267Seric# try UUCP traffic as a local address 43364971SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 434*67469SericR$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 43559081Seric') 43665061Sericifdef(`_NO_CANONIFY_', `dnl', 43759081Seric`# pass to name server to make hostname canonical 43861470SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 43961470Seric 44065061Seric# local host aliases and pseudo-domains are always canonical 44165061SericR$* < @ $=w > $* $: $1 < @ $2 . > $3 44264971SericR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 44365061SericR$* < @ $* . . > $* $1 < @ $2 . > $3 44464971Seric 44551322Seric# if this is the local hostname, make sure we treat is as canonical 44651322SericR$* < @ $j > $* $: $1 < @ $j . > $2 44751222Seric 44851322Seric 44951222Seric################################################## 45051222Seric### Ruleset 4 -- Final Output Post-rewriting ### 45151222Seric################################################## 45251222SericS4 45351222Seric 45458499SericR$*<@> $@ $1 handle <> and list:; 45551222Seric 45651322Seric# strip trailing dot off possibly canonical name 45751322SericR$* < @ $+ . > $* $1 < @ $2 > $3 45851322Seric 45951222Seric# externalize local domain info 46051322SericR$* < $+ > $* $1 $2 $3 defocus 46151322SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 46251997SericR@ $* $@ @ $1 ... and exit 46351222Seric 46458288Sericifdef(`_NO_UUCP_', `dnl', 46558288Seric`# UUCP must always be presented in old form 46658288SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 46751222Seric 46851222Seric# delete duplicate local names 46951322SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 47051222Seric 47151222Seric 47251222Seric 47360894Seric############################################################## 474*67469Seric### Ruleset 97 -- recanonicalize and call ruleset zero ### 47560894Seric### (used for recursive calls) ### 47660894Seric############################################################## 47751222Seric 478*67469SericS`'97 47951222SericR$* $: $>3 $1 48051222SericR$* $@ $>0 $1 48151222Seric 48251222Seric 48351222Seric###################################### 48451222Seric### Ruleset 0 -- Parse Address ### 48551222Seric###################################### 48651222Seric 48751222SericS0 48851222Seric 48967118SericR<@> $#_LOCAL_ $: <@> special case error msgs 49066035SericR$* : $* ; $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 49165048SericR<@ $+> $#error $@ USAGE $: "user address required" 49267118SericR$* <$* : $* > $* $#error $@ USAGE $: "colon illegal in host name part" 49367132SericR$* < @ . > $* $#error $@ USAGE $: "invalid host name" 49458340Seric 49555416Sericifdef(`_MAILER_smtp_', 49655416Seric`# handle numeric address spec 497*67469SericR$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec 49865191SericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', 49963858Seric `dnl') 50051222Seric 50151887Seric# now delete the local info -- note $=O to find characters that cause forwarding 502*67469SericR$* < @ > $* $@ $>97 $1 user@ => user 503*67469SericR< @ $=w . > : $* $@ $>97 $2 @here:... -> ... 504*67469SericR$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... 50563967Seric 50663967Seric# handle local hacks 507*67469SericR$* $: $>98 $1 50866048Seric 50966048Seric# short circuit local delivery so forwarded email works 51066048Sericifdef(`_LOCAL_NOT_STICKY_', 51166048Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 51266048SericR$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly', 51366048Seric`R$+ < @ $=w . > $: $1 < @ $2 . @ $H > first try hub 514*67469SericR$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... 515*67469SericR$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address') 51666090Sericifdef(`MAILER_TABLE', 51766090Seric` 51866090Seric# not local -- try mailer table lookup 51966090SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 52066090SericR< $+ . > $* $: < $1 > $2 strip trailing dot 52166090SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 52266090SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 52366090SericR< $+ > $* $: $>90 <$1> $2 try domain', 52466090Seric`dnl') 52551260Sericundivert(4)dnl 52651260Seric 52761468Sericifdef(`_NO_UUCP_', `dnl', 52861468Seric`# resolve remotely connected UUCP links (if any) 52951285Sericifdef(`_CLASS_V_', 530*67469Seric`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3', 53152044Seric `dnl') 53251285Sericifdef(`_CLASS_W_', 533*67469Seric`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3', 53452044Seric `dnl') 53551285Sericifdef(`_CLASS_X_', 536*67469Seric`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3', 53761468Seric `dnl')') 53851260Seric 53951222Seric# resolve fake top level domains by forwarding to other hosts 54051222Sericifdef(`BITNET_RELAY', 541*67469Seric`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 54251222Seric `dnl') 54365149Sericifdef(`_MAILER_pop_', 54465149Seric`R$+ < @ POP. > $#pop $: $1 user@POP', 54565149Seric `dnl') 54658364Sericifdef(`_MAILER_fax_', 54764971Seric`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 54858364Seric`ifdef(`FAX_RELAY', 549*67469Seric`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX', 55058364Seric `dnl')') 55151222Seric 55251260Sericifdef(`UUCP_RELAY', 55351260Seric`# forward non-local UUCP traffic to our UUCP relay 554*67469SericR$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail', 55555416Seric`ifdef(`_MAILER_uucp_', 55651260Seric`# forward other UUCP traffic straight to UUCP 55765557SericR$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 55851260Seric `dnl')') 55963967Sericifdef(`_MAILER_usenet_', ` 56063754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 56165851SericR$+ . USENET $#usenet $: $1', 56263860Seric `dnl') 56363754Seric 56458070Sericifdef(`_LOCAL_RULES_', 56558070Seric`# figure out what should stay in our local mail system 56663754Sericundivert(1)', `dnl') 56763754Seric 56864321Seric# pass names that still have a host to a smarthost (if defined) 569*67469SericR$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name 57063754Seric 57164321Seric# deal with other remote names 57263946Sericifdef(`_MAILER_smtp_', 57363973Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 57464321Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2') 57551222Seric 576*67469Seric# if this is quoted, strip the quotes and try again 57758811SericR$+ $: $(dequote $1 $) strip quotes 578*67469SericR$+ $=O $+ $@ $>97 $1 $2 $3 try again 57958811Seric 58058811Seric# handle locally delivered names 58163998SericR$=L $#_LOCAL_ $: @ $1 special local names 58263998SericR$+ $#_LOCAL_ $: $1 regular local names 58351222Seric 58455416Seric########################################################################### 58555416Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 58655416Seric### (new sendmail only) ### 58755416Seric########################################################################### 58851222Seric 58951322SericS5 59051322Seric 59158808Seric# see if we have a relay or a hub 59266048SericR$+ $: < $R > $1 try relay 59366048SericR< > $+ $: < $H > $1 try hub 59466048SericR< > $+ $@ $1 nope, give up 595*67469SericR< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 > 596*67469SericR< $+ > $+ $@ $>95 < $1 > $2 < @ $1 > 59760540Sericifdef(`MAILER_TABLE', 59860540Seric` 59960540Seric 60063858Seric################################################################### 60163858Seric### Ruleset 90 -- try domain part of mailertable entry ### 60263858Seric### (new sendmail only) ### 60363858Seric################################################################### 60460540Seric 60560540SericS90 60666091SericR$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 60766081SericR$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? 60866081SericR$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again 60966094SericR$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 61066090SericR<$- : $+ > $* $# $1 $@ $2 $: $3 "." found? 61166090SericR< $* > $* $@ $2 no mailertable match', 61260540Seric`dnl') 61363858Seric 61463858Seric################################################################### 615*67469Seric### Ruleset 95 -- canonify mailer:host syntax to triple ### 61664010Seric################################################################### 61764010Seric 618*67469SericS95 61964010SericR< > $* $@ $1 strip off null relay 62064010SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 62164010SericR< $=w > $* $@ $2 delete local host 62264010SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 62364010Seric 62464010Seric################################################################### 625*67469Seric### Ruleset 98 -- local part of ruleset zero (can be null) ### 62663858Seric################################################################### 62763858Seric 628*67469SericS98 62963858Sericundivert(3)dnl 63051222Seric# 63151222Seric###################################################################### 63251222Seric###################################################################### 63351222Seric##### 63456790Seric`##### MAILER DEFINITIONS' 63551222Seric##### 63651222Seric###################################################################### 63751222Seric###################################################################### 63851222Sericundivert(7)dnl 639