16f4c5567Sericdivert(-1) 26f4c5567Seric# 36f4c5567Seric# Copyright (c) 1983 Eric P. Allman 46f4c5567Seric# Copyright (c) 1988 The Regents of the University of California. 56f4c5567Seric# All rights reserved. 66f4c5567Seric# 76f4c5567Seric# %sccs.include.redist.sh% 86f4c5567Seric# 96f4c5567Sericdivert(0) 106f4c5567Seric 11*e54d09e1SericVERSIONID(`@(#)proto.m4 6.48 (Berkeley) 06/24/93') 126f4c5567Seric 1363eeb308SericMAILER(local)dnl 146f4c5567Seric 15585ddacfSericifdef(`_OLD_SENDMAIL_', 16585ddacfSeric`define(`_SET_96_', 6)dnl 17585ddacfSericdefine(`_SET_97_', 7)dnl', 182635e5f8Seric`# level 4 config file format 19585ddacfSericV4 20585ddacfSericdefine(`_SET_96_', 96)dnl 21585ddacfSericdefine(`_SET_97_', 97)dnl') 22472f2a37Seric 236f4c5567Seric################## 246f4c5567Seric# local info # 256f4c5567Seric################## 266f4c5567Seric 27a8d79e3dSericCP. 28a8d79e3dSeric 2931695942SericCwlocalhost 30b1286b66Sericifdef(`USE_CW_FILE', 3131695942Seric`# file containing names of hosts for which we receive email 320bf9a1dbSericCONCAT(`Fw', confCW_FILE)', `dnl') 336f4c5567Seric 346f4c5567Sericifdef(`UUCP_RELAY', 356f4c5567Seric`# UUCP relay host 3613c6b009SericCONCAT(DY, UUCP_RELAY) 37a8d79e3dSericCPUUCP 380fc742e1Seric 396f4c5567Seric')dnl 406f4c5567Sericifdef(`BITNET_RELAY', 416f4c5567Seric`# BITNET relay host 426f4c5567SericCONCAT(DB, BITNET_RELAY) 43a8d79e3dSericCPBITNET 440fc742e1Seric 456f4c5567Seric')dnl 466f4c5567Sericifdef(`CSNET_RELAY', 476f4c5567Seric`# CSNET relay host 486f4c5567SericCONCAT(DC, CSNET_RELAY) 49a8d79e3dSericCPCSNET 500fc742e1Seric 516f4c5567Seric')dnl 525caa7271Sericifdef(`FAX_RELAY', 535caa7271Seric`# FAX relay host 545caa7271SericCONCAT(DF, FAX_RELAY) 55a8d79e3dSericCPFAX 565caa7271Seric 575caa7271Seric')dnl 5885afb57eSericifdef(`SMART_HOST', 5985afb57eSeric`# "Smart" UUCP relay host 6085afb57eSericCONCAT(DS, SMART_HOST) 616f4c5567Seric 6285afb57eSeric')dnl 633be47185Sericifdef(`MAILER_TABLE', 643be47185Seric`# Mailer table (overriding domains) 653be47185SericKmailertable MAILER_TABLE 663be47185Seric 673be47185Seric')dnl 686f4c5567Seric# who I send unqualified names to (null means deliver locally) 696f4c5567SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY)) 706f4c5567Seric 71525ff8d9Seric# who gets all local email traffic ($R has precedence for unqualified names) 72525ff8d9SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB)) 73525ff8d9Seric 7485afb57eSeric# my official hostname ($w or $w.$D) 7585afb57eSericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D)) 7685afb57eSeric 7785afb57eSeric# who I masquerade as (can be $j) 7885afb57eSericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)) 7985afb57eSeric 8082027dd5Seric# class L: names that should be delivered locally, even if we have a relay 8182027dd5Seric# class E: names that should be exposed as from this host, even if we masquerade 8271dc253dSericCLroot 8382027dd5SericCEroot 8471dc253dSericundivert(5)dnl 8571dc253dSeric 866f4c5567Seric# operators that cannot be in local usernames (i.e., network indicators) 8790caf1e3SericCO @ % ifdef(`_NO_UUCP_', `', `!') 886f4c5567Seric 8963eeb308Seric# a class with just dot (for identifying canonical names) 9063eeb308SericC.. 9163eeb308Seric 92fdf362d5Sericifdef(`_OLD_SENDMAIL_', `dnl', 93fdf362d5Seric`# dequoting map 94fdf362d5SericKdequote dequote') 956f4c5567Seric 9616748008Sericundivert(6)dnl 9716748008Seric 980fc742e1Seric###################### 990fc742e1Seric# Special macros # 1000fc742e1Seric###################### 1016f4c5567Seric 1020fc742e1Seric# SMTP initial login message 1030fc742e1SericCONCAT(De, confSMTP_LOGIN_MSG) 1040fc742e1Seric 1050fc742e1Seric# UNIX initial From header format 1060fc742e1SericCONCAT(Dl, confFROM_LINE) 1070fc742e1Seric 1080fc742e1Seric# my name for error messages 1090fc742e1SericCONCAT(Dn, confMAILER_NAME) 1100fc742e1Seric 1110fc742e1Seric# delimiter (operator) characters 1120fc742e1SericCONCAT(Do, confOPERATORS) 1130fc742e1Seric 1140fc742e1Seric# format of a total name 1150fc742e1SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER, 1160fc742e1Seric ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))) 1176f4c5567Sericinclude(`../m4/version.m4') 1180fc742e1Seric 1190fc742e1Seric############### 1200fc742e1Seric# Options # 1210fc742e1Seric############### 1220fc742e1Seric 12370de6e01Seric# strip message body to 7 bits on input? 12470de6e01SericCONCAT(O7, confSEVEN_BIT_INPUT) 1250fc742e1Seric 1260fc742e1Seric# wait (in minutes) for alias file rebuild 1270fc742e1SericCONCAT(Oa, confALIAS_WAIT) 1280fc742e1Seric 1290fc742e1Seric# location of alias file 1300fc742e1SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)) 1310fc742e1Seric 1322188aa70Seric# minimum number of free blocks on filesystem 1332188aa70SericCONCAT(Ob, confMIN_FREE_BLOCKS) 1342188aa70Seric 1350fc742e1Seric# substitution for space (blank) characters 1360fc742e1SericCONCAT(OB, confBLANK_SUB) 1370fc742e1Seric 1380fc742e1Seric# connect to "expensive" mailers on initial submission? 1390fc742e1SericCONCAT(Oc, confCON_EXPENSIVE) 1400fc742e1Seric 1410fc742e1Seric# checkpoint queue runs after every N successful deliveries 1420fc742e1SericCONCAT(OC, confCHECKPOINT_INTERVAL) 1430fc742e1Seric 1440fc742e1Seric# default delivery mode 1450fc742e1SericCONCAT(Od, confDELIVERY_MODE) 1460fc742e1Seric 1470fc742e1Seric# automatically rebuild the alias database? 1480fc742e1SericCONCAT(OD, confAUTO_REBUILD) 1490fc742e1Seric 1500fc742e1Seric# error message header/file */ 1510fc742e1Sericifdef(`confERROR_MESSAGE', 152*e54d09e1Seric CONCAT(OE, confERROR_MESSAGE), 1530fc742e1Seric #OE/etc/sendmail.oE) 1540fc742e1Seric 1550fc742e1Seric# error mode 1560fc742e1Sericifdef(`confERROR_MODE', 157*e54d09e1Seric CONCAT(Oe, confERROR_MODE), 1580fc742e1Seric #Oep) 1590fc742e1Seric 1600fc742e1Seric# save Unix-style "From_" lines at top of header? 1610fc742e1SericCONCAT(Of, confSAVE_FROM_LINES) 1620fc742e1Seric 1630fc742e1Seric# temporary file mode 1640fc742e1SericCONCAT(OF, confTEMP_FILE_MODE) 1650fc742e1Seric 1660fc742e1Seric# match recipients against GECOS field? 1670fc742e1SericCONCAT(OG, confMATCH_GECOS) 1680fc742e1Seric 1690fc742e1Seric# default GID 1700fc742e1SericCONCAT(Og, confDEF_GROUP_ID) 1710fc742e1Seric 1720fc742e1Seric# maximum hop count 1730fc742e1SericCONCAT(Oh, confMAX_HOP) 1740fc742e1Seric 1750fc742e1Seric# location of help file 1760fc742e1SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)) 1770fc742e1Seric 1780fc742e1Seric# ignore dots as terminators in incoming messages? 1790fc742e1SericCONCAT(Oi, confIGNORE_DOTS) 1800fc742e1Seric 1810fc742e1Seric# Insist that the BIND name server be running to resolve names 1820fc742e1Sericifdef(`confBIND_OPTS', 1830fc742e1Seric CONCAT(OI, confBIND_OPTS), 1840fc742e1Seric #OI) 1850fc742e1Seric 18670de6e01Seric# deliver MIME-encapsulated error messages? 18770de6e01SericCONCAT(Oj, confMIME_FORMAT_ERRORS) 18870de6e01Seric 1890fc742e1Seric# Forward file search path 1900fc742e1Sericifdef(`confFORWARD_PATH', 1910fc742e1Seric CONCAT(OJ, confFORWARD_PATH), 1920fc742e1Seric #OJ/var/forward/$u:$z/.forward.$w:$z/.forward) 1930fc742e1Seric 1940fc742e1Seric# open connection cache size 1950fc742e1SericCONCAT(Ok, confMCI_CACHE_SIZE) 1960fc742e1Seric 1970fc742e1Seric# open connection cache timeout 1980fc742e1SericCONCAT(OK, confMCI_CACHE_TIMEOUT) 1990fc742e1Seric 200bd6adeb9Seric# use Errors-To: header? 201bd6adeb9SericCONCAT(Ol, confUSE_ERRORS_TO) 202bd6adeb9Seric 2030fc742e1Seric# log level 2040fc742e1SericCONCAT(OL, confLOG_LEVEL) 2050fc742e1Seric 2060fc742e1Seric# send to me too, even in an alias expansion? 2070fc742e1SericCONCAT(Om, confME_TOO) 2080fc742e1Seric 2090fc742e1Seric# verify RHS in newaliases? 2100fc742e1SericCONCAT(On, confCHECK_ALIASES) 2110fc742e1Seric 2120fc742e1Seric# default messages to old style headers if no special punctuation? 2130fc742e1SericCONCAT(Oo, confOLD_STYLE_HEADERS) 2140fc742e1Seric 2158bcc474dSeric# SMTP daemon options 2168bcc474dSericifdef(`confDAEMON_OPTIONS', 2178bcc474dSeric CONCAT(OO, confDAEMON_OPTIONS), 2188bcc474dSeric #OOPort=esmtp) 2198bcc474dSeric 2202188aa70Seric# privacy flags 2212188aa70SericCONCAT(Op, confPRIVACY_FLAGS) 2222188aa70Seric 2230fc742e1Seric# who (if anyone) should get extra copies of error messages 2240fc742e1Sericifdef(`confCOPY_ERRORS_TO', 2250fc742e1Seric CONCAT(OP, confCOPY_ERRORS_TO), 2260fc742e1Seric #OPPostmaster) 2270fc742e1Seric 2280fc742e1Seric# slope of queue-only function 2290fc742e1Sericifdef(`confQUEUE_FACTOR', 2300fc742e1Seric CONCAT(Oq, confQUEUE_FACTOR), 2310fc742e1Seric #Oq600000) 2320fc742e1Seric 2330fc742e1Seric# queue directory 2340fc742e1SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)) 2350fc742e1Seric 2360fc742e1Seric# read timeout -- now OK per RFC 1123 section 5.3.2 2372635e5f8Sericifdef(`confREAD_TIMEOUT', 2382635e5f8Seric CONCAT(Or, confREAD_TIMEOUT), 2392635e5f8Seric #Ordatablock=10m) 2400fc742e1Seric 2410fc742e1Seric# queue up everything before forking? 2420fc742e1SericCONCAT(Os, confSAFE_QUEUE) 2430fc742e1Seric 2440fc742e1Seric# status file 2450fc742e1SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)) 2460fc742e1Seric 2470fc742e1Seric# default message timeout interval 2480fc742e1SericCONCAT(OT, confMESSAGE_TIMEOUT) 2490fc742e1Seric 2500fc742e1Seric# time zone handling: 2510fc742e1Seric# if undefined, use system default 2520fc742e1Seric# if defined but null, use TZ envariable passed in 2530fc742e1Seric# if defined and non-null, use that info 2540fc742e1Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot', 2550fc742e1Seric confTIME_ZONE, `USE_TZ', `', 2560fc742e1Seric `CONCAT(Ot, confTIME_ZONE)') 2570fc742e1Seric 2580fc742e1Seric# default UID 2590fc742e1SericCONCAT(Ou, confDEF_USER_ID) 2600fc742e1Seric 2610fc742e1Seric# list of locations of user database file (null means no lookup) 262b1ca68b5SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC') 2630fc742e1Seric 2648bcc474dSeric# fallback MX host 2658bcc474dSericifdef(`confFALLBACK_MX', 2668bcc474dSeric CONCAT(OV, confFALLBACK_MX), 2678bcc474dSeric #OVfall.back.host.net) 2688bcc474dSeric 2690fc742e1Seric# load average at which we just queue messages 2700fc742e1SericCONCAT(Ox, confQUEUE_LA) 2710fc742e1Seric 2720fc742e1Seric# load average at which we refuse connections 2730fc742e1SericCONCAT(OX, confREFUSE_LA) 2740fc742e1Seric 2750fc742e1Seric# work recipient factor 2760fc742e1Sericifdef(`confWORK_RECIPIENT_FACTOR', 2770fc742e1Seric CONCAT(Oy, confWORK_RECIPIENT_FACTOR), 2780fc742e1Seric #Oy30000) 2790fc742e1Seric 2800fc742e1Seric# deliver each queued job in a separate process? 2810fc742e1SericCONCAT(OY, confSEPARATE_PROC) 2820fc742e1Seric 2830fc742e1Seric# work class factor 2840fc742e1Sericifdef(`confWORK_CLASS_FACTOR', 2850fc742e1Seric CONCAT(Oz, confWORK_CLASS_FACTOR), 2860fc742e1Seric #Oz1800) 2870fc742e1Seric 2880fc742e1Seric# work time factor 2890fc742e1Sericifdef(`confWORK_TIME_FACTOR', 2900fc742e1Seric CONCAT(OZ, confWORK_TIME_FACTOR), 2910fc742e1Seric #OZ90000) 2920fc742e1Seric 2930fc742e1Seric########################### 2940fc742e1Seric# Message precedences # 2950fc742e1Seric########################### 2960fc742e1Seric 2970fc742e1SericPfirst-class=0 2980fc742e1SericPspecial-delivery=100 29985afb57eSericPlist=-30 3000fc742e1SericPbulk=-60 3010fc742e1SericPjunk=-100 3020fc742e1Seric 3030fc742e1Seric##################### 3040fc742e1Seric# Trusted users # 3050fc742e1Seric##################### 3060fc742e1Seric 3070fc742e1SericTroot 3080fc742e1SericTdaemon 3090fc742e1SericTuucp 3100fc742e1Seric 3110fc742e1Seric######################### 3120fc742e1Seric# Format of headers # 3130fc742e1Seric######################### 3140fc742e1Seric 315d5ba2395SericH?P?Return-Path: $g 316585ddacfSericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b 3170fc742e1SericH?D?Resent-Date: $a 3180fc742e1SericH?D?Date: $a 3190fc742e1SericH?F?Resent-From: $q 3200fc742e1SericH?F?From: $q 3210fc742e1SericH?x?Full-Name: $x 3220fc742e1SericHSubject: 3230fc742e1Seric# HPosted-Date: $a 3240fc742e1Seric# H?l?Received-Date: $b 3250fc742e1SericH?M?Resent-Message-Id: <$t.$i@$j> 3260fc742e1SericH?M?Message-Id: <$t.$i@$j> 3276f4c5567Seric# 3286f4c5567Seric###################################################################### 3296f4c5567Seric###################################################################### 3306f4c5567Seric##### 3316f4c5567Seric##### REWRITING RULES 3326f4c5567Seric##### 3336f4c5567Seric###################################################################### 3346f4c5567Seric###################################################################### 3356f4c5567Seric 3368d35298dSericundivert(9)dnl 3376f4c5567Seric 3386f4c5567Seric########################################### 3396f4c5567Seric### Rulset 3 -- Name Canonicalization ### 3406f4c5567Seric########################################### 34171e1a4d1SericS3 3426f4c5567Seric 3431c0b669eSeric# handle null input and list syntax (translate to <@> special case) 3441c0b669eSericR$@ $@ <@> 34541afd8b4SericR$*:;$* $@ $1 :; <@> 346f2ad5decSeric 3476f4c5567Seric# basic textual canonicalization -- note RFC733 heuristic here 3487b2c0d8dSericR$*<$*>$*<$*>$* <$2>$3$4$5 strip multiple <> <> 34985ebc819SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 3501c0b669eSericR$*<>$* $@ <@> MAIL FROM:<> case 3516f4c5567SericR$*<$+>$* $2 basic RFC821/822 parsing 3526f4c5567Seric 3536f4c5567Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 3546f4c5567SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 3556f4c5567Seric 3566f4c5567Seric# localize and dispose of route-based addresses 357585ddacfSericR@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr> 3586f4c5567Seric 3596f4c5567Seric# find focus for list syntax 360585ddacfSericR $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax 3616f4c5567SericR $+ : $* ; $@ $1 : $2; list syntax 3626f4c5567Seric 3636f4c5567Seric# find focus for @ syntax addresses 3646f4c5567SericR$+ @ $+ $: $1 < @ $2 > focus on domain 3656f4c5567SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 366585ddacfSericR$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical 3676f4c5567Seric 36890caf1e3Sericifdef(`_NO_UUCP_', `dnl', 36990caf1e3Seric`# convert old-style addresses to a domain-based address 370585ddacfSericR$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names 371585ddacfSericR$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps 372585ddacfSericR$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains') 3736f4c5567Seric 3746f4c5567Seric# if we have % signs, take the rightmost one 3756f4c5567SericR$* % $* $1 @ $2 First make them all @s. 3766f4c5567SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 377585ddacfSericR$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish 3786f4c5567Seric 3796f4c5567Seric# else we must be a local name 3806f4c5567Seric 3816f4c5567Seric 382585ddacfSeric################################################ 383585ddacfSeric### Ruleset _SET_96_ -- bottom half of ruleset 3 ### 384585ddacfSeric################################################ 3856f4c5567Seric 38682027dd5Seric# At this point, everything should be in a "local_part<@domain>extra" format. 387585ddacfSericS`'_SET_96_ 3886f4c5567Seric 3896f4c5567Seric# handle special cases for local names 390fde20765SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 391fde20765SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 392fde20765Sericifdef(`_NO_UUCP_', `dnl', 393fde20765Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 39431695942Sericundivert(2)dnl 3956f4c5567Seric 39660f3bdf6Sericifdef(`_NO_UUCP_', `dnl', 39760f3bdf6Seric`ifdef(`UUCP_RELAY', 398788179f5Seric`# pass UUCP addresses straight through 399788179f5SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP > $3', 400788179f5Seric`# if really UUCP, handle it immediately 40163eeb308Sericifdef(`_CLASS_U_', 40263eeb308Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 40363eeb308Sericifdef(`_CLASS_V_', 40463eeb308Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 40563eeb308Sericifdef(`_CLASS_W_', 40663eeb308Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 40763eeb308Sericifdef(`_CLASS_X_', 40863eeb308Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 40963eeb308Sericifdef(`_CLASS_Y_', 41063eeb308Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl') 411a027f997Seric 412a027f997Seric# try UUCP traffic as a local address 41363eeb308SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP > $3 4144588ece0Sericifdef(`_OLD_SENDMAIL_', 4154cad3747Seric`R$* < @ $+ . $+ . UUCP > $* $@ $1 < @ $2 . $3 . > $4', 41697777037Seric`R$* < @ $+ . . UUCP > $* $@ $1 < @ $2 . > $3')') 41760f3bdf6Seric') 4182f61eeb4Sericifdef(`_NO_CANONIFY_', 4192f61eeb4Seric`# make sure local host names appear canonical 4202f61eeb4SericR$* < @ $=w > $* $: $1 < @ $2 . > $3', 42160f3bdf6Seric`# pass to name server to make hostname canonical 4222f61eeb4SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 4232f61eeb4Seric 42431695942Sericundivert(8)dnl 42531695942Seric 42663eeb308Seric# if this is the local hostname, make sure we treat is as canonical 42763eeb308SericR$* < @ $j > $* $: $1 < @ $j . > $2 4286f4c5567Seric 4296f4c5567Seric 4306f4c5567Seric################################################## 4316f4c5567Seric### Ruleset 4 -- Final Output Post-rewriting ### 4326f4c5567Seric################################################## 4336f4c5567SericS4 4346f4c5567Seric 4351c0b669eSericR$*<@> $@ $1 handle <> and list:; 4366f4c5567Seric 4376f4c5567Seric# resolve numeric addresses to name if possible 4386f4c5567SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr 4396f4c5567Seric 44063eeb308Seric# strip trailing dot off possibly canonical name 44163eeb308SericR$* < @ $+ . > $* $1 < @ $2 > $3 44263eeb308Seric 4436f4c5567Seric# externalize local domain info 4446f4c5567SericR$* < $+ > $* $1 $2 $3 defocus 4456f4c5567SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 4461f23b499SericR@ $* $@ @ $1 ... and exit 4476f4c5567Seric 44890caf1e3Sericifdef(`_NO_UUCP_', `dnl', 44990caf1e3Seric`# UUCP must always be presented in old form 45090caf1e3SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 4516f4c5567Seric 4526f4c5567Seric# delete duplicate local names 453b47d0647SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 4546f4c5567Seric 4556f4c5567Seric 4566f4c5567Seric 457585ddacfSeric############################################################## 458585ddacfSeric### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ### 4596f4c5567Seric### (used for recursive calls) ### 460585ddacfSeric############################################################## 4616f4c5567Seric 462585ddacfSericS`'_SET_97_ 4636f4c5567SericR$* $: $>3 $1 4646f4c5567SericR$* $@ $>0 $1 4656f4c5567Seric 4666f4c5567Seric 4676f4c5567Seric###################################### 4686f4c5567Seric### Ruleset 0 -- Parse Address ### 4696f4c5567Seric###################################### 4706f4c5567Seric 4716f4c5567SericS0 4726f4c5567Seric 4733d995905SericR<@> $#local $: <> special case error msgs 47470de6e01SericR$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 4751c5e29abSeric 4764cad3747Sericifdef(`_MAILER_smtp_', 4774cad3747Seric`# handle numeric address spec 4786f4c5567SericR$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr 4794cad3747SericR$* < @ [ $+ ] > $* $#smtp $@ [$2] $: $1 @ [$2] $3 numeric internet spec', 4803c5c069fSeric`dnl') 4816f4c5567Seric 482b1286b66Seric# now delete the local info -- note $=O to find characters that cause forwarding 483585ddacfSericR$* < @ > $* $@ $>_SET_97_ $1 user@ => user 484585ddacfSericR< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ... 485585ddacfSericR$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... 4863be47185Sericifdef(`MAILER_TABLE', 4873be47185Seric` 4883be47185Seric# try mailer table lookup 489bc926da7SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 490bc926da7SericR< $+ . > $* $: < $1 > $2 strip trailing dot 4913fb97881SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 492bc926da7SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 4933fb97881SericR< $+ > $* $: $>90 <$1> $2 try domain', 4943be47185Seric`dnl') 4956f4c5567Seric 4966f4c5567Seric# short circuit local delivery so forwarded email works 497c4cdc003Sericifdef(`_LOCAL_NOT_STICKY_', 498585ddacfSeric`R$=L < @ $=w . > $#local $: @ $1 special local names 499585ddacfSericR$+ < @ $=w . > $#local $: $1 dispose directly', 500585ddacfSeric`R$+ < @ $=w . > $: $1 < @ $2 @ $H > first try hub 5014588ece0Sericifdef(`_OLD_SENDMAIL_', 502c3d0eb4bSeric`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 < $2 > yep .... 503c3d0eb4bSericR$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... 504525ff8d9SericR$+ < $+ @ > $#local $: $1 nope, local address', 505525ff8d9Seric`R$+ < $+ @ $+ > $#local $: $1 yep .... 506c4cdc003SericR$+ < $+ @ > $#local $: @ $1 nope, local address')') 5076f4c5567Sericundivert(3)dnl 50871e1a4d1Sericundivert(4)dnl 50971e1a4d1Seric 51007da7f83Sericifdef(`_NO_UUCP_', `dnl', 51107da7f83Seric`# resolve remotely connected UUCP links (if any) 512138c6544Sericifdef(`_CLASS_V_', 513c3d0eb4bSeric`R$* < @ $=V . UUCP > $* $#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3', 5146dafc3b0Seric `dnl') 515138c6544Sericifdef(`_CLASS_W_', 516c3d0eb4bSeric`R$* < @ $=W . UUCP > $* $#smtp $@ $W $: <@ $W> : $1 @ $2.UUCP $3', 5176dafc3b0Seric `dnl') 518138c6544Sericifdef(`_CLASS_X_', 519c3d0eb4bSeric`R$* < @ $=X . UUCP > $* $#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3', 52007da7f83Seric `dnl')') 52171e1a4d1Seric 5226f4c5567Seric# resolve fake top level domains by forwarding to other hosts 5236f4c5567Sericifdef(`BITNET_RELAY', 52407da7f83Seric`R$*<@$+.BITNET>$* $#smtp $@ $B $: $1 <@$2.BITNET> $3 user@host.BITNET', 5256f4c5567Seric `dnl') 5266f4c5567Sericifdef(`CSNET_RELAY', 52707da7f83Seric`R$*<@$+.CSNET>$* $#smtp $@ $C $: $1 <@$2.CSNET> $3 user@host.CSNET', 5286f4c5567Seric `dnl') 5295caa7271Sericifdef(`_MAILER_fax_', 5305caa7271Seric`R$+ < @ $+ .FAX > $#fax $@ $2 $: $1 user@host.FAX', 5315caa7271Seric`ifdef(`FAX_RELAY', 53207da7f83Seric`R$*<@$+.FAX>$* $#smtp $@ $F $: $1 <@$2.FAX> $3 user@host.FAX', 5335caa7271Seric `dnl')') 5346f4c5567Seric 53571e1a4d1Sericifdef(`UUCP_RELAY', 53671e1a4d1Seric`# forward non-local UUCP traffic to our UUCP relay 53707da7f83SericR$*<@$*.UUCP>$* $#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3 uucp mail', 5384cad3747Seric`ifdef(`_MAILER_uucp_', 53971e1a4d1Seric`# forward other UUCP traffic straight to UUCP 540837ed21dSericR< @ $+ .UUCP > : $+ $#uucp $@ $1 $: $2 @host.UUCP:... 54171e1a4d1SericR$+ < @ $+ .UUCP > $#uucp $@ $2 $: $1 user@host.UUCP', 54271e1a4d1Seric `dnl')') 5436f4c5567Seric 54485afb57eSericifdef(`_LOCAL_RULES_', 54585afb57eSeric`# figure out what should stay in our local mail system 54685afb57eSericundivert(1)', 54785afb57eSeric`ifdef(`_MAILER_smtp_', 5484cad3747Seric`# deal with other remote names 549c3d0eb4bSericR$* < @ $* > $* $#smtp $@ $2 $: $1 < @ $2 > $3 user@host.domain')') 55085afb57eSericifdef(`SMART_HOST', ` 55185afb57eSeric# pass names that still have a host to a smarthost 55285afb57eSericR$* < @ $* > $* $: < $S > $1 < @ $2 > $3 glue on smarthost name 553c3d0eb4bSericR<$-:$+> $* < @$* > $* $# $1 $@ $2 $: $3 < @ $4 > $5 if non-null, use it 554c3d0eb4bSericR<$+> $* < @$* > $* $#suucp $@ $1 $: $2 < @ $3 > $4 if non-null, use it 55585afb57eSericR<> $* < @ $* > $* $1 < @ $2 > $3 else strip off gunk', 55685afb57eSeric`ifdef(`_LOCAL_RULES_', ` 55785afb57eSeric# reject messages that have host names we do not understand 55885afb57eSericR$* < @ $* > $* $#error $@ NOHOST $: Unrecognized host name $2', 55985afb57eSeric`dnl')') 5602188aa70Sericifdef(`_MAILER_USENET_', ` 5612188aa70Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 562a9e49ad1SericR$+ . USENET $# usenet $: $1') 5636f4c5567Seric 5644588ece0Sericifdef(`_OLD_SENDMAIL_', 565b1286b66Seric`# forward remaining names to local relay, if any 566adca7ddbSericR$=L $#local $: $1 special local names 567adca7ddbSericR$+ $: $1 < @ $R > append relay 568525ff8d9SericR$+ < @ > $: $1 < @ $H > no relay, try hub 569525ff8d9SericR$+ < @ > $#local $: $1 no relay or hub: local 570585ddacfSericR$+ < @ $=w > $#local $: $1 we are relay/hub: local 57185afb57eSericR$+ < @ $-:$+ > $# $2 $@ $3 $: $1 deliver to relay/hub 572e319d9beSericR$+ < @ $+ > $#relay $@ $2 $: $1 deliver to relay/hub', 573d31361c2Seric 574d31361c2Seric`# if this is quoted, strip the quotes and try again 575d31361c2SericR$+ $: $(dequote $1 $) strip quotes 576585ddacfSericR$* $=O $* $@ $>_SET_97_ $1 $2 $3 try again 577d31361c2Seric 578d31361c2Seric# handle locally delivered names 5794588ece0SericR$=L $#local $: @ $1 special local names 580adca7ddbSericR$+ $#local $: $1 regular local names 5816f4c5567Seric 5824cad3747Seric########################################################################### 5834cad3747Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 5844cad3747Seric### (new sendmail only) ### 5854cad3747Seric########################################################################### 5866f4c5567Seric 58763eeb308SericS5 58863eeb308Seric 589fdf362d5Seric# see if we have a relay or a hub 590fdf362d5SericR$+ $: $1 < @ $R > 591525ff8d9SericR$+ < @ > $: $1 < @ $H > no relay, try hub 592585ddacfSericR$+ < @ $=w > $@ $1 we are relay/hub: local 59385afb57eSericR$+ < @ $-:$+ > $# $2 $@ $3 $: $1 send to relay or hub 594fdf362d5Sericifdef(`_MAILER_smtp_', 595fdf362d5Seric`R$+ < @ $+ > $#relay $@ $2 $: $1 send to relay or hub')') 596bc926da7Sericifdef(`MAILER_TABLE', 597bc926da7Seric` 598bc926da7Seric 599bc926da7Seric########################################################################### 600bc926da7Seric### Ruleset 90 -- try domain part of mailertable entry ### 601bc926da7Seric### (new sendmail only) ### 602bc926da7Seric########################################################################### 603bc926da7Seric 604bc926da7SericS90 605bd6adeb9SericR<$- . $+ > $* $: < $(mailertable .$2 $) > $3 lookup 606bc926da7SericR<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 607f3789658SericR< . $+ > $* $@ $>90 <$1> $2 no -- strip & try again 608bc926da7SericR<$*> $* $@ $2 no match', 609bc926da7Seric`dnl') 6106f4c5567Seric# 6116f4c5567Seric###################################################################### 6126f4c5567Seric###################################################################### 6136f4c5567Seric##### 6141297e20cSeric`##### MAILER DEFINITIONS' 6156f4c5567Seric##### 6166f4c5567Seric###################################################################### 6176f4c5567Seric###################################################################### 6186f4c5567Sericundivert(7)dnl 619