16f4c5567Sericdivert(-1) 26f4c5567Seric# 36f4c5567Seric# Copyright (c) 1983 Eric P. Allman 494a19095Sbostic# Copyright (c) 1988, 1993 594a19095Sbostic# The Regents of the University of California. All rights reserved. 66f4c5567Seric# 76f4c5567Seric# %sccs.include.redist.sh% 86f4c5567Seric# 96f4c5567Sericdivert(0) 106f4c5567Seric 11*7837870bSericVERSIONID(`@(#)proto.m4 8.54 (Berkeley) 08/17/94') 126f4c5567Seric 1363eeb308SericMAILER(local)dnl 146f4c5567Seric 15444240c0Seric# level 6 config file format 16444240c0SericV6 17aeacfb61Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl 18d6e720f1Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl 19aeacfb61Sericifdef(`confRELAY_MAILER',, 20aeacfb61Seric `define(`confRELAY_MAILER', 21aeacfb61Seric `ifdef(`_MAILER_smtp_', `relay', 22aeacfb61Seric `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl 2319110660Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 24d6e720f1Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 25aeacfb61Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 26472f2a37Seric 276f4c5567Seric################## 286f4c5567Seric# local info # 296f4c5567Seric################## 306f4c5567Seric 3131695942SericCwlocalhost 32b1286b66Sericifdef(`USE_CW_FILE', 3331695942Seric`# file containing names of hosts for which we receive email 343727fc2bSericFw`'confCW_FILE', 353727fc2bSeric `dnl') 368a1641c9Sericifdef(`confDOMAIN_NAME', ` 378a1641c9Seric# my official domain name 388a1641c9SericDj`'confDOMAIN_NAME', 398a1641c9Seric `dnl') 408a1641c9Seric 418a1641c9Sericifdef(`_NULL_CLIENT_ONLY_', 428a1641c9Seric`include(../m4/nullrelay.m4)m4exit', 438a1641c9Seric `dnl') 448a1641c9Seric 458a1641c9SericCP. 466f4c5567Seric 476f4c5567Sericifdef(`UUCP_RELAY', 486f4c5567Seric`# UUCP relay host 493727fc2bSericDY`'UUCP_RELAY 50a8d79e3dSericCPUUCP 510fc742e1Seric 526f4c5567Seric')dnl 536f4c5567Sericifdef(`BITNET_RELAY', 546f4c5567Seric`# BITNET relay host 553727fc2bSericDB`'BITNET_RELAY 56a8d79e3dSericCPBITNET 570fc742e1Seric 586f4c5567Seric')dnl 595caa7271Sericifdef(`FAX_RELAY', 605caa7271Seric`# FAX relay host 613727fc2bSericDF`'FAX_RELAY 62a8d79e3dSericCPFAX 635caa7271Seric 645caa7271Seric')dnl 658a1641c9Seric# "Smart" relay host (may be null) 668a1641c9SericDS`'ifdef(`SMART_HOST', SMART_HOST) 676f4c5567Seric 683be47185Sericifdef(`MAILER_TABLE', 693be47185Seric`# Mailer table (overriding domains) 703be47185SericKmailertable MAILER_TABLE 713be47185Seric 723be47185Seric')dnl 73f6f96ca7Sericifdef(`DOMAIN_TABLE', 74f6f96ca7Seric`# Domain table (adding domains) 75f6f96ca7SericKdomaintable DOMAIN_TABLE 76f6f96ca7Seric 77f6f96ca7Seric')dnl 786f4c5567Seric# who I send unqualified names to (null means deliver locally) 793727fc2bSericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) 806f4c5567Seric 81525ff8d9Seric# who gets all local email traffic ($R has precedence for unqualified names) 823727fc2bSericDH`'ifdef(`MAIL_HUB', MAIL_HUB) 83525ff8d9Seric 847fcd5399Seric# who I masquerade as (null for no masquerading) 857fcd5399SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME) 8685afb57eSeric 8782027dd5Seric# class L: names that should be delivered locally, even if we have a relay 8882027dd5Seric# class E: names that should be exposed as from this host, even if we masquerade 89b3d9bc08Seric# class D: dotted names, e.g., root.machinename 9071b259abSeric#CL root 9182027dd5SericCE root 9271dc253dSericundivert(5)dnl 93b3d9bc08Sericifdef(`__DOTTED_USER_LIST__', 94b3d9bc08Seric `__DOTTED_USER_LIST__', 95b3d9bc08Seric `#CD postmaster') 9671dc253dSeric 976f4c5567Seric# operators that cannot be in local usernames (i.e., network indicators) 9890caf1e3SericCO @ % ifdef(`_NO_UUCP_', `', `!') 996f4c5567Seric 10063eeb308Seric# a class with just dot (for identifying canonical names) 10163eeb308SericC.. 10263eeb308Seric 10398c7c04fSeric# dequoting map 10498c7c04fSericKdequote dequote 1056f4c5567Seric 10616748008Sericundivert(6)dnl 10716748008Seric 1080fc742e1Seric###################### 1090fc742e1Seric# Special macros # 1100fc742e1Seric###################### 1116f4c5567Seric 1120fc742e1Seric# SMTP initial login message 1133727fc2bSericDe`'confSMTP_LOGIN_MSG 1140fc742e1Seric 1150fc742e1Seric# UNIX initial From header format 1163727fc2bSericDl`'confFROM_LINE 1170fc742e1Seric 1180fc742e1Seric# my name for error messages 1193727fc2bSericDn`'confMAILER_NAME 1200fc742e1Seric 1210fc742e1Seric# delimiter (operator) characters 1223727fc2bSericDo`'confOPERATORS 1230fc742e1Seric 1240fc742e1Seric# format of a total name 125b3d9bc08SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.') 1266f4c5567Sericinclude(`../m4/version.m4') 1270fc742e1Seric 1280fc742e1Seric############### 1290fc742e1Seric# Options # 1300fc742e1Seric############### 1310fc742e1Seric 13270de6e01Seric# strip message body to 7 bits on input? 1333727fc2bSericO7`'confSEVEN_BIT_INPUT 1340fc742e1Seric 135f3e98e3bSeric# 8-bit data handling 136f3e98e3bSericO8`'confEIGHT_BIT_HANDLING 137f3e98e3bSeric 1380fc742e1Seric# wait (in minutes) for alias file rebuild 1393727fc2bSericOa`'confALIAS_WAIT 1400fc742e1Seric 1410fc742e1Seric# location of alias file 14229627271SericOA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases) 1430fc742e1Seric 1442188aa70Seric# minimum number of free blocks on filesystem 1453727fc2bSericOb`'confMIN_FREE_BLOCKS 1462188aa70Seric 1470fc742e1Seric# substitution for space (blank) characters 1483727fc2bSericOB`'confBLANK_SUB 1490fc742e1Seric 1505724067cSeric# avoid connecting to "expensive" mailers on initial submission? 1513727fc2bSericOc`'confCON_EXPENSIVE 1520fc742e1Seric 1530fc742e1Seric# checkpoint queue runs after every N successful deliveries 1543727fc2bSericOC`'confCHECKPOINT_INTERVAL 1550fc742e1Seric 1560fc742e1Seric# default delivery mode 1573727fc2bSericOd`'confDELIVERY_MODE 1580fc742e1Seric 1590fc742e1Seric# automatically rebuild the alias database? 1603727fc2bSericOD`'confAUTO_REBUILD 1610fc742e1Seric 1623727fc2bSeric# error message header/file 1630fc742e1Sericifdef(`confERROR_MESSAGE', 1643727fc2bSeric OE`'confERROR_MESSAGE, 1650fc742e1Seric #OE/etc/sendmail.oE) 1660fc742e1Seric 1670fc742e1Seric# error mode 1680fc742e1Sericifdef(`confERROR_MODE', 1693727fc2bSeric Oe`'confERROR_MODE, 1700fc742e1Seric #Oep) 1710fc742e1Seric 1720fc742e1Seric# save Unix-style "From_" lines at top of header? 1733727fc2bSericOf`'confSAVE_FROM_LINES 1740fc742e1Seric 1750fc742e1Seric# temporary file mode 1763727fc2bSericOF`'confTEMP_FILE_MODE 1770fc742e1Seric 1780fc742e1Seric# match recipients against GECOS field? 1793727fc2bSericOG`'confMATCH_GECOS 1800fc742e1Seric 1810fc742e1Seric# default GID 1823727fc2bSericOg`'confDEF_GROUP_ID 1830fc742e1Seric 1840fc742e1Seric# maximum hop count 1853727fc2bSericOh`'confMAX_HOP 1860fc742e1Seric 1870fc742e1Seric# location of help file 1883727fc2bSericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf) 1890fc742e1Seric 1900fc742e1Seric# ignore dots as terminators in incoming messages? 1913727fc2bSericOi`'confIGNORE_DOTS 1920fc742e1Seric 1930fc742e1Seric# Insist that the BIND name server be running to resolve names 1940fc742e1Sericifdef(`confBIND_OPTS', 1953727fc2bSeric OI`'confBIND_OPTS, 1960fc742e1Seric #OI) 1970fc742e1Seric 19870de6e01Seric# deliver MIME-encapsulated error messages? 1993727fc2bSericOj`'confMIME_FORMAT_ERRORS 20070de6e01Seric 2010fc742e1Seric# Forward file search path 2020fc742e1Sericifdef(`confFORWARD_PATH', 2033727fc2bSeric OJ`'confFORWARD_PATH, 2040fc742e1Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 2050fc742e1Seric 2060fc742e1Seric# open connection cache size 2073727fc2bSericOk`'confMCI_CACHE_SIZE 2080fc742e1Seric 2090fc742e1Seric# open connection cache timeout 2103727fc2bSericOK`'confMCI_CACHE_TIMEOUT 2110fc742e1Seric 212bd6adeb9Seric# use Errors-To: header? 2133727fc2bSericOl`'confUSE_ERRORS_TO 214bd6adeb9Seric 2150fc742e1Seric# log level 2163727fc2bSericOL`'confLOG_LEVEL 2170fc742e1Seric 2180fc742e1Seric# send to me too, even in an alias expansion? 2193727fc2bSericOm`'confME_TOO 2200fc742e1Seric 2210fc742e1Seric# verify RHS in newaliases? 2223727fc2bSericOn`'confCHECK_ALIASES 2230fc742e1Seric 2240fc742e1Seric# default messages to old style headers if no special punctuation? 2253727fc2bSericOo`'confOLD_STYLE_HEADERS 2260fc742e1Seric 2278bcc474dSeric# SMTP daemon options 2288bcc474dSericifdef(`confDAEMON_OPTIONS', 2293727fc2bSeric OO`'confDAEMON_OPTIONS, 2308bcc474dSeric #OOPort=esmtp) 2318bcc474dSeric 2322188aa70Seric# privacy flags 2333727fc2bSericOp`'confPRIVACY_FLAGS 2342188aa70Seric 2350fc742e1Seric# who (if anyone) should get extra copies of error messages 2360fc742e1Sericifdef(`confCOPY_ERRORS_TO', 2373727fc2bSeric OP`'confCOPY_ERRORS_TO, 2380fc742e1Seric #OPPostmaster) 2390fc742e1Seric 2400fc742e1Seric# slope of queue-only function 2410fc742e1Sericifdef(`confQUEUE_FACTOR', 2423727fc2bSeric Oq`'confQUEUE_FACTOR, 2430fc742e1Seric #Oq600000) 2440fc742e1Seric 2450fc742e1Seric# queue directory 2463727fc2bSericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue) 2470fc742e1Seric 2480fc742e1Seric# read timeout -- now OK per RFC 1123 section 5.3.2 2492635e5f8Sericifdef(`confREAD_TIMEOUT', 2503727fc2bSeric Or`'confREAD_TIMEOUT, 2512635e5f8Seric #Ordatablock=10m) 2520fc742e1Seric 2530fc742e1Seric# queue up everything before forking? 2543727fc2bSericOs`'confSAFE_QUEUE 2550fc742e1Seric 2560fc742e1Seric# status file 2573727fc2bSericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st) 2580fc742e1Seric 2590fc742e1Seric# default message timeout interval 2603727fc2bSericOT`'confMESSAGE_TIMEOUT 2610fc742e1Seric 2620fc742e1Seric# time zone handling: 2630fc742e1Seric# if undefined, use system default 2640fc742e1Seric# if defined but null, use TZ envariable passed in 2650fc742e1Seric# if defined and non-null, use that info 2660fc742e1Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', 2674f368a26Seric confTIME_ZONE, `USE_TZ', `Ot', 2683727fc2bSeric `Ot`'confTIME_ZONE') 2690fc742e1Seric 2700fc742e1Seric# default UID 2713727fc2bSericOu`'confDEF_USER_ID 2720fc742e1Seric 2730fc742e1Seric# list of locations of user database file (null means no lookup) 274b1ca68b5SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') 2750fc742e1Seric 2768bcc474dSeric# fallback MX host 2778bcc474dSericifdef(`confFALLBACK_MX', 2783727fc2bSeric OV`'confFALLBACK_MX, 2798bcc474dSeric #OVfall.back.host.net) 2808bcc474dSeric 28111f06b84Seric# if we are the best MX host for a site, try it directly instead of config err 2823727fc2bSericOw`'confTRY_NULL_MX_LIST 28311f06b84Seric 2840fc742e1Seric# load average at which we just queue messages 2853727fc2bSericOx`'confQUEUE_LA 2860fc742e1Seric 2870fc742e1Seric# load average at which we refuse connections 2883727fc2bSericOX`'confREFUSE_LA 2890fc742e1Seric 2900fc742e1Seric# work recipient factor 2910fc742e1Sericifdef(`confWORK_RECIPIENT_FACTOR', 2923727fc2bSeric Oy`'confWORK_RECIPIENT_FACTOR, 2930fc742e1Seric #Oy30000) 2940fc742e1Seric 2950fc742e1Seric# deliver each queued job in a separate process? 2963727fc2bSericOY`'confSEPARATE_PROC 2970fc742e1Seric 2980fc742e1Seric# work class factor 2990fc742e1Sericifdef(`confWORK_CLASS_FACTOR', 3003727fc2bSeric Oz`'confWORK_CLASS_FACTOR, 3010fc742e1Seric #Oz1800) 3020fc742e1Seric 3030fc742e1Seric# work time factor 3040fc742e1Sericifdef(`confWORK_TIME_FACTOR', 3053727fc2bSeric OZ`'confWORK_TIME_FACTOR, 3060fc742e1Seric #OZ90000) 3070fc742e1Seric 308*7837870bSeric# do our SMTP peers choke on multi-line greeting messages? 309*7837870bSericO BrokenSmtpPeers=confBROKEN_SMTP_PEERS 310*7837870bSeric 311*7837870bSeric# shall we sort the queue by hostname first? 312*7837870bSericO SortQueueByHost=confSORT_QUEUE_BY_HOST 313*7837870bSeric 3140fc742e1Seric########################### 3150fc742e1Seric# Message precedences # 3160fc742e1Seric########################### 3170fc742e1Seric 3180fc742e1SericPfirst-class=0 3190fc742e1SericPspecial-delivery=100 32085afb57eSericPlist=-30 3210fc742e1SericPbulk=-60 3220fc742e1SericPjunk=-100 3230fc742e1Seric 3240fc742e1Seric##################### 3250fc742e1Seric# Trusted users # 3260fc742e1Seric##################### 3270fc742e1Seric 3280fc742e1SericTroot 3290fc742e1SericTdaemon 3300fc742e1SericTuucp 3310fc742e1Seric 3320fc742e1Seric######################### 3330fc742e1Seric# Format of headers # 3340fc742e1Seric######################### 3350fc742e1Seric 336d5ba2395SericH?P?Return-Path: $g 3379343d85eSericHReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b 3380fc742e1SericH?D?Resent-Date: $a 3390fc742e1SericH?D?Date: $a 3400fc742e1SericH?F?Resent-From: $q 3410fc742e1SericH?F?From: $q 3420fc742e1SericH?x?Full-Name: $x 3430fc742e1SericHSubject: 3440fc742e1Seric# HPosted-Date: $a 3450fc742e1Seric# H?l?Received-Date: $b 3460fc742e1SericH?M?Resent-Message-Id: <$t.$i@$j> 3470fc742e1SericH?M?Message-Id: <$t.$i@$j> 3486f4c5567Seric# 3496f4c5567Seric###################################################################### 3506f4c5567Seric###################################################################### 3516f4c5567Seric##### 3526f4c5567Seric##### REWRITING RULES 3536f4c5567Seric##### 3546f4c5567Seric###################################################################### 3556f4c5567Seric###################################################################### 3566f4c5567Seric 3578d35298dSericundivert(9)dnl 3586f4c5567Seric 3596f4c5567Seric########################################### 3606f4c5567Seric### Rulset 3 -- Name Canonicalization ### 3616f4c5567Seric########################################### 36271e1a4d1SericS3 3636f4c5567Seric 3643669020aSeric# handle null input (translate to <@> special case) 3651c0b669eSericR$@ $@ <@> 366f2ad5decSeric 3676f4c5567Seric# basic textual canonicalization -- note RFC733 heuristic here 3688d0fcb8eSericR$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 36985ebc819SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 3701c0b669eSericR$*<>$* $@ <@> MAIL FROM:<> case 3716f4c5567SericR$*<$+>$* $2 basic RFC821/822 parsing 3726f4c5567Seric 3733669020aSeric# handle list:; syntax as special case 3743669020aSericR$*:;$* $@ $1 :; <@> 3753669020aSeric 3766f4c5567Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 3776f4c5567SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 3786f4c5567Seric 3796f4c5567Seric# localize and dispose of route-based addresses 38098c7c04fSericR@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> 3816f4c5567Seric 3826f4c5567Seric# find focus for list syntax 38398c7c04fSericR $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax 3846f4c5567SericR $+ : $* ; $@ $1 : $2; list syntax 3856f4c5567Seric 3866f4c5567Seric# find focus for @ syntax addresses 3876f4c5567SericR$+ @ $+ $: $1 < @ $2 > focus on domain 3886f4c5567SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 38998c7c04fSericR$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical 3906f4c5567Seric 391af3c6a2dSeric# do some sanity checking 392af3c6a2dSericR$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 393af3c6a2dSeric 39490caf1e3Sericifdef(`_NO_UUCP_', `dnl', 39590caf1e3Seric`# convert old-style addresses to a domain-based address 39698c7c04fSericR$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names 39798c7c04fSericR$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps 39898c7c04fSericR$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains') 3996f4c5567Seric 4006f4c5567Seric# if we have % signs, take the rightmost one 4016f4c5567SericR$* % $* $1 @ $2 First make them all @s. 4026f4c5567SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 40398c7c04fSericR$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish 4046f4c5567Seric 4056f4c5567Seric# else we must be a local name 4066f4c5567Seric 4076f4c5567Seric 408585ddacfSeric################################################ 40998c7c04fSeric### Ruleset 96 -- bottom half of ruleset 3 ### 410585ddacfSeric################################################ 4116f4c5567Seric 41282027dd5Seric# At this point, everything should be in a "local_part<@domain>extra" format. 41398c7c04fSericS96 4146f4c5567Seric 4156f4c5567Seric# handle special cases for local names 416fde20765SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 417fde20765SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 418fde20765Sericifdef(`_NO_UUCP_', `dnl', 419fde20765Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 42029627271SericR$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] 42129627271SericR$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 422aabb28c9SericR$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 423f6f96ca7Sericifdef(`DOMAIN_TABLE', ` 4244e4d6dd0Seric# look up domains in the domain table 4254e4d6dd0SericR$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', 426f6f96ca7Seric`dnl') 42731695942Sericundivert(2)dnl 4286f4c5567Seric 42960f3bdf6Sericifdef(`_NO_UUCP_', `dnl', 43060f3bdf6Seric`ifdef(`UUCP_RELAY', 431788179f5Seric`# pass UUCP addresses straight through 432a6293a76SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 433788179f5Seric`# if really UUCP, handle it immediately 43463eeb308Sericifdef(`_CLASS_U_', 435a6293a76Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 43663eeb308Sericifdef(`_CLASS_V_', 437a6293a76Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 43863eeb308Sericifdef(`_CLASS_W_', 439a6293a76Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44063eeb308Sericifdef(`_CLASS_X_', 441a6293a76Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 44263eeb308Sericifdef(`_CLASS_Y_', 443a6293a76Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 444a027f997Seric 445a027f997Seric# try UUCP traffic as a local address 446a6293a76SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 44798c7c04fSericR$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 44860f3bdf6Seric') 44923e264c3Sericifdef(`_NO_CANONIFY_', `dnl', 45060f3bdf6Seric`# pass to name server to make hostname canonical 4512f61eeb4SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 4522f61eeb4Seric 45323e264c3Seric# local host aliases and pseudo-domains are always canonical 45423e264c3SericR$* < @ $=w > $* $: $1 < @ $2 . > $3 455a6293a76SericR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 45623e264c3SericR$* < @ $* . . > $* $1 < @ $2 . > $3 457a6293a76Seric 45863eeb308Seric# if this is the local hostname, make sure we treat is as canonical 45963eeb308SericR$* < @ $j > $* $: $1 < @ $j . > $2 4606f4c5567Seric 4616f4c5567Seric 4626f4c5567Seric################################################## 4636f4c5567Seric### Ruleset 4 -- Final Output Post-rewriting ### 4646f4c5567Seric################################################## 4656f4c5567SericS4 4666f4c5567Seric 4671c0b669eSericR$*<@> $@ $1 handle <> and list:; 4686f4c5567Seric 46963eeb308Seric# strip trailing dot off possibly canonical name 47063eeb308SericR$* < @ $+ . > $* $1 < @ $2 > $3 47163eeb308Seric 4726f4c5567Seric# externalize local domain info 4736f4c5567SericR$* < $+ > $* $1 $2 $3 defocus 4746f4c5567SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 4751f23b499SericR@ $* $@ @ $1 ... and exit 4766f4c5567Seric 47790caf1e3Sericifdef(`_NO_UUCP_', `dnl', 47890caf1e3Seric`# UUCP must always be presented in old form 47990caf1e3SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 4806f4c5567Seric 4816f4c5567Seric# delete duplicate local names 482b47d0647SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 4836f4c5567Seric 4846f4c5567Seric 4856f4c5567Seric 486585ddacfSeric############################################################## 48798c7c04fSeric### Ruleset 97 -- recanonicalize and call ruleset zero ### 4886f4c5567Seric### (used for recursive calls) ### 489585ddacfSeric############################################################## 4906f4c5567Seric 49198c7c04fSericS`'97 4926f4c5567SericR$* $: $>3 $1 4936f4c5567SericR$* $@ $>0 $1 4946f4c5567Seric 4956f4c5567Seric 4966f4c5567Seric###################################### 4976f4c5567Seric### Ruleset 0 -- Parse Address ### 4986f4c5567Seric###################################### 4996f4c5567Seric 5006f4c5567SericS0 5016f4c5567Seric 5029ea84951SericR<@> $#_LOCAL_ $: <@> special case error msgs 503c3dee10cSericR$* : $* ; $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 5042afea1f3SericR<@ $+> $#error $@ USAGE $: "user address required" 5059ea84951SericR$* <$* : $* > $* $#error $@ USAGE $: "colon illegal in host name part" 506270180daSericR$* < @ . > $* $#error $@ USAGE $: "invalid host name" 5071c5e29abSeric 5084cad3747Sericifdef(`_MAILER_smtp_', 5094cad3747Seric`# handle numeric address spec 51098c7c04fSericR$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec 5110df17a5aSericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', 5123c5c069fSeric `dnl') 5136f4c5567Seric 514b1286b66Seric# now delete the local info -- note $=O to find characters that cause forwarding 51598c7c04fSericR$* < @ > $* $@ $>97 $1 user@ => user 51698c7c04fSericR< @ $=w . > : $* $@ $>97 $2 @here:... -> ... 51798c7c04fSericR$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... 5188e83e806Seric 5198e83e806Seric# handle local hacks 52098c7c04fSericR$* $: $>98 $1 521ee3aff56Seric 522ee3aff56Seric# short circuit local delivery so forwarded email works 523ee3aff56Sericifdef(`_LOCAL_NOT_STICKY_', 524ee3aff56Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 525ee3aff56SericR$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly', 526ee3aff56Seric`R$+ < @ $=w . > $: $1 < @ $2 . @ $H > first try hub 52798c7c04fSericR$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... 528dd270128SericR$=D . $+ < $+ @ > $#_LOCAL_ $: $1 . $2 dotted name? 52998c7c04fSericR$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address') 53021933f06Sericifdef(`MAILER_TABLE', 53121933f06Seric` 53221933f06Seric# not local -- try mailer table lookup 53321933f06SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 53421933f06SericR< $+ . > $* $: < $1 > $2 strip trailing dot 53521933f06SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 53621933f06SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 53721933f06SericR< $+ > $* $: $>90 <$1> $2 try domain', 53821933f06Seric`dnl') 53971e1a4d1Sericundivert(4)dnl 54071e1a4d1Seric 54107da7f83Sericifdef(`_NO_UUCP_', `dnl', 54207da7f83Seric`# resolve remotely connected UUCP links (if any) 543138c6544Sericifdef(`_CLASS_V_', 54498c7c04fSeric`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3', 5456dafc3b0Seric `dnl') 546138c6544Sericifdef(`_CLASS_W_', 54798c7c04fSeric`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3', 5486dafc3b0Seric `dnl') 549138c6544Sericifdef(`_CLASS_X_', 55098c7c04fSeric`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3', 55107da7f83Seric `dnl')') 55271e1a4d1Seric 5536f4c5567Seric# resolve fake top level domains by forwarding to other hosts 5546f4c5567Sericifdef(`BITNET_RELAY', 55598c7c04fSeric`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 5566f4c5567Seric `dnl') 557d5e4353cSericifdef(`_MAILER_pop_', 558d5e4353cSeric`R$+ < @ POP. > $#pop $: $1 user@POP', 559d5e4353cSeric `dnl') 5605caa7271Sericifdef(`_MAILER_fax_', 561a6293a76Seric`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 5625caa7271Seric`ifdef(`FAX_RELAY', 56398c7c04fSeric`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX', 5645caa7271Seric `dnl')') 5656f4c5567Seric 56671e1a4d1Sericifdef(`UUCP_RELAY', 56771e1a4d1Seric`# forward non-local UUCP traffic to our UUCP relay 56898c7c04fSericR$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail', 5694cad3747Seric`ifdef(`_MAILER_uucp_', 57071e1a4d1Seric`# forward other UUCP traffic straight to UUCP 5710a7545bbSericR$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 57271e1a4d1Seric `dnl')') 5738e83e806Sericifdef(`_MAILER_usenet_', ` 574f6f96ca7Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 575a6e5b286SericR$+ . USENET $#usenet $: $1', 576f6f96ca7Seric `dnl') 577f6f96ca7Seric 57885afb57eSericifdef(`_LOCAL_RULES_', 57985afb57eSeric`# figure out what should stay in our local mail system 580f6f96ca7Sericundivert(1)', `dnl') 581f6f96ca7Seric 5828a1641c9Seric# pass names that still have a host to a smarthost (if defined) 58398c7c04fSericR$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name 584f6f96ca7Seric 5858a1641c9Seric# deal with other remote names 586b501d107Sericifdef(`_MAILER_smtp_', 58719110660Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 5888a1641c9Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2') 5896f4c5567Seric 59098c7c04fSeric# if this is quoted, strip the quotes and try again 591d31361c2SericR$+ $: $(dequote $1 $) strip quotes 59298c7c04fSericR$+ $=O $+ $@ $>97 $1 $2 $3 try again 593d31361c2Seric 594d31361c2Seric# handle locally delivered names 595d6e720f1SericR$=L $#_LOCAL_ $: @ $1 special local names 596d6e720f1SericR$+ $#_LOCAL_ $: $1 regular local names 5976f4c5567Seric 5984cad3747Seric########################################################################### 5994cad3747Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 6004cad3747Seric### (new sendmail only) ### 6014cad3747Seric########################################################################### 6026f4c5567Seric 60363eeb308SericS5 60463eeb308Seric 605b3d9bc08Seric# if we have a "special dotted user", convert it back to the base name 606b3d9bc08SericR$=D . * $#_LOCAL_ $: $1 607b3d9bc08SericR$=D . $+ $#_LOCAL_ $: $1 . * 608b3d9bc08Seric 609fdf362d5Seric# see if we have a relay or a hub 610ee3aff56SericR$+ $: < $R > $1 try relay 611ee3aff56SericR< > $+ $: < $H > $1 try hub 612ee3aff56SericR< > $+ $@ $1 nope, give up 61398c7c04fSericR< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 > 61498c7c04fSericR< $+ > $+ $@ $>95 < $1 > $2 < @ $1 > 615bc926da7Sericifdef(`MAILER_TABLE', 616bc926da7Seric` 617bc926da7Seric 61811f06b84Seric################################################################### 619bc926da7Seric### Ruleset 90 -- try domain part of mailertable entry ### 620bc926da7Seric### (new sendmail only) ### 62111f06b84Seric################################################################### 622bc926da7Seric 623bc926da7SericS90 624833e6943SericR$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 62574fcb73aSericR$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? 62674fcb73aSericR$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again 627a69811b9SericR$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 62821933f06SericR<$- : $+ > $* $# $1 $@ $2 $: $3 "." found? 62921933f06SericR< $* > $* $@ $2 no mailertable match', 630bc926da7Seric`dnl') 63111f06b84Seric 63211f06b84Seric################################################################### 63398c7c04fSeric### Ruleset 95 -- canonify mailer:host syntax to triple ### 634aeacfb61Seric################################################################### 635aeacfb61Seric 63698c7c04fSericS95 637aeacfb61SericR< > $* $@ $1 strip off null relay 638aeacfb61SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 639aeacfb61SericR< $=w > $* $@ $2 delete local host 640aeacfb61SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 641aeacfb61Seric 642aeacfb61Seric################################################################### 64398c7c04fSeric### Ruleset 98 -- local part of ruleset zero (can be null) ### 64411f06b84Seric################################################################### 64511f06b84Seric 64698c7c04fSericS98 64711f06b84Sericundivert(3)dnl 6486f4c5567Seric# 6496f4c5567Seric###################################################################### 6506f4c5567Seric###################################################################### 6516f4c5567Seric##### 6521297e20cSeric`##### MAILER DEFINITIONS' 6536f4c5567Seric##### 6546f4c5567Seric###################################################################### 6556f4c5567Seric###################################################################### 6566f4c5567Sericundivert(7)dnl 657