16f4c5567Sericdivert(-1) 26f4c5567Seric# 3*e8a06660Seric# Copyright (c) 1983, 1995 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*e8a06660SericVERSIONID(`@(#)proto.m4 8.69 (Berkeley) 04/21/95') 126f4c5567Seric 1363eeb308SericMAILER(local)dnl 146f4c5567Seric 15444240c0Seric# level 6 config file format 1633714691SericV6/Berkeley 1733714691Sericdivert(-1) 1833714691Seric 19cce2d2c9Seric# do some sanity checking 20cce2d2c9Sericifdef(`__OSTYPE__',, 21cce2d2c9Seric `errprint(`*** ERROR: No system type defined (use OSTYPE macro)')') 22cce2d2c9Seric 2333714691Seric# pick our default mailers 2433714691Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')') 2533714691Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')') 26aeacfb61Sericifdef(`confRELAY_MAILER',, 27aeacfb61Seric `define(`confRELAY_MAILER', 28aeacfb61Seric `ifdef(`_MAILER_smtp_', `relay', 2933714691Seric `ifdef(`_MAILER_uucp', `suucp', `unknown')')')') 3019110660Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl for readability only 31d6e720f1Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only 32aeacfb61Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl for readability only 33472f2a37Seric 3433714691Seric# back compatibility with old config files 3533714691Sericifdef(`confDEF_GROUP_ID', 3633714691Seric `errprint(`*** confDEF_GROUP_ID is obsolete.') 3733714691Seric errprint(` Use confDEF_USER_ID with a colon in the value instead.')') 3833714691Sericifdef(`confREAD_TIMEOUT', 3933714691Seric `errprint(`*** confREAD_TIMEOUT is obsolete.') 4033714691Seric errprint(` Use individual confTO_<timeout> parameters instead.')') 4133714691Sericifdef(`confMESSAGE_TIMEOUT', 4233714691Seric `define(`_ARG_', index(confMESSAGE_TIMEOUT, /)) 4333714691Seric ifelse(_ARG_, -1, 4433714691Seric `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)', 4533714691Seric `define(`confTO_QUEUERETURN', 4633714691Seric substr(confMESSAGE_TIMEOUT, 0, _ARG_)) 4733714691Seric define(`confTO_QUEUEWARN', 4833714691Seric substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')') 4933714691Sericifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,, 5033714691Seric `errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.') 5133714691Seric errprint(` Use confMAX_MESSAGE_SIZE for the second part of the value.')')') 5233714691Seric 5333714691Seric# clean option definitions below.... 5433714691Sericdefine(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl 5533714691Seric 5633714691Sericdivert(0)dnl 5733714691Seric 586f4c5567Seric################## 596f4c5567Seric# local info # 606f4c5567Seric################## 616f4c5567Seric 6231695942SericCwlocalhost 63b1286b66Sericifdef(`USE_CW_FILE', 6431695942Seric`# file containing names of hosts for which we receive email 653727fc2bSericFw`'confCW_FILE', 663727fc2bSeric `dnl') 678a1641c9Seric 6833714691Seric# my official domain name 6933714691Seric# ... define this only if sendmail cannot automatically determine your domain 7033714691Sericifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM') 7133714691Seric 7233714691Sericifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl 738a1641c9Seric 748a1641c9SericCP. 756f4c5567Seric 766f4c5567Sericifdef(`UUCP_RELAY', 776f4c5567Seric`# UUCP relay host 783727fc2bSericDY`'UUCP_RELAY 79a8d79e3dSericCPUUCP 800fc742e1Seric 816f4c5567Seric')dnl 826f4c5567Sericifdef(`BITNET_RELAY', 836f4c5567Seric`# BITNET relay host 843727fc2bSericDB`'BITNET_RELAY 85a8d79e3dSericCPBITNET 860fc742e1Seric 876f4c5567Seric')dnl 885caa7271Sericifdef(`FAX_RELAY', 895caa7271Seric`# FAX relay host 903727fc2bSericDF`'FAX_RELAY 91a8d79e3dSericCPFAX 925caa7271Seric 935caa7271Seric')dnl 948a1641c9Seric# "Smart" relay host (may be null) 958a1641c9SericDS`'ifdef(`SMART_HOST', SMART_HOST) 966f4c5567Seric 9780df0526Sericifdef(`LUSER_RELAY', 9880df0526Seric`# place to which unknown users should be forwarded 9980df0526SericKuser user -m -a<> 10080df0526SericDL`'LUSER_RELAY 10180df0526Seric', `dnl') 10280df0526Seric 10333714691Seric# operators that cannot be in local usernames (i.e., network indicators) 10433714691SericCO @ % ifdef(`_NO_UUCP_', `', `!') 10533714691Seric 10633714691Seric# a class with just dot (for identifying canonical names) 10733714691SericC.. 10833714691Seric 1093be47185Sericifdef(`MAILER_TABLE', 1103be47185Seric`# Mailer table (overriding domains) 1113be47185SericKmailertable MAILER_TABLE 1123be47185Seric 1133be47185Seric')dnl 114f6f96ca7Sericifdef(`DOMAIN_TABLE', 115f6f96ca7Seric`# Domain table (adding domains) 116f6f96ca7SericKdomaintable DOMAIN_TABLE 117f6f96ca7Seric 118f6f96ca7Seric')dnl 1196f4c5567Seric# who I send unqualified names to (null means deliver locally) 1203727fc2bSericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) 1216f4c5567Seric 122525ff8d9Seric# who gets all local email traffic ($R has precedence for unqualified names) 1233727fc2bSericDH`'ifdef(`MAIL_HUB', MAIL_HUB) 124525ff8d9Seric 12582027dd5Seric# class L: names that should be delivered locally, even if we have a relay 12682027dd5Seric# class E: names that should be exposed as from this host, even if we masquerade 127b3d9bc08Seric# class D: dotted names, e.g., root.machinename 12871b259abSeric#CL root 12982027dd5SericCE root 13071dc253dSericundivert(5)dnl 131b3d9bc08Sericifdef(`__DOTTED_USER_LIST__', 132b3d9bc08Seric `__DOTTED_USER_LIST__', 133b3d9bc08Seric `#CD postmaster') 13471dc253dSeric 13598c7c04fSeric# dequoting map 13698c7c04fSericKdequote dequote 1376f4c5567Seric 13833714691Sericdivert(0)dnl 13933714691Seric# who I masquerade as (null for no masquerading) 14033714691SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME) 14133714691Seric 14216748008Sericundivert(6)dnl 14316748008Seric 1440fc742e1Seric###################### 1450fc742e1Seric# Special macros # 1460fc742e1Seric###################### 1476f4c5567Seric 1480fc742e1Seric# SMTP initial login message 1493727fc2bSericDe`'confSMTP_LOGIN_MSG 1500fc742e1Seric 1510fc742e1Seric# UNIX initial From header format 1523727fc2bSericDl`'confFROM_LINE 1530fc742e1Seric 1540fc742e1Seric# my name for error messages 1553727fc2bSericDn`'confMAILER_NAME 1560fc742e1Seric 1570fc742e1Seric# delimiter (operator) characters 1583727fc2bSericDo`'confOPERATORS 1590fc742e1Seric 1600fc742e1Seric# format of a total name 161b3d9bc08SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.') 1626f4c5567Sericinclude(`../m4/version.m4') 1630fc742e1Seric 1640fc742e1Seric############### 1650fc742e1Seric# Options # 1660fc742e1Seric############### 1670fc742e1Seric 16870de6e01Seric# strip message body to 7 bits on input? 16933714691Seric_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT') 1700fc742e1Seric 171f3e98e3bSeric# 8-bit data handling 17233714691Seric_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive) 173f3e98e3bSeric 17433714691Seric# wait for alias file rebuild (default units: minutes) 17533714691Seric_OPTION(AliasWait, `confALIAS_WAIT', 5m) 1760fc742e1Seric 1770fc742e1Seric# location of alias file 17833714691SericO AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases) 1790fc742e1Seric 1802188aa70Seric# minimum number of free blocks on filesystem 18133714691Seric_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100) 18233714691Seric 18333714691Seric# maximum message size 18433714691Seric_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000) 1852188aa70Seric 1860fc742e1Seric# substitution for space (blank) characters 18733714691Seric_OPTION(BlankSub, `confBLANK_SUB', _) 1880fc742e1Seric 1895724067cSeric# avoid connecting to "expensive" mailers on initial submission? 19033714691Seric_OPTION(HoldExpensive, `confCON_EXPENSIVE') 1910fc742e1Seric 1920fc742e1Seric# checkpoint queue runs after every N successful deliveries 19333714691Seric_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10) 1940fc742e1Seric 1950fc742e1Seric# default delivery mode 19633714691Seric_OPTION(DeliveryMode, `confDELIVERY_MODE', background) 1970fc742e1Seric 1980fc742e1Seric# automatically rebuild the alias database? 19933714691Seric_OPTION(AutoRebuildAliases, `confAUTO_REBUILD') 2000fc742e1Seric 2013727fc2bSeric# error message header/file 20233714691Seric_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE) 2030fc742e1Seric 2040fc742e1Seric# error mode 20533714691Seric_OPTION(ErrorMode, `confERROR_MODE', print) 2060fc742e1Seric 2070fc742e1Seric# save Unix-style "From_" lines at top of header? 20833714691Seric_OPTION(SaveFromLine, `confSAVE_FROM_LINES') 2090fc742e1Seric 2100fc742e1Seric# temporary file mode 21133714691Seric_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600) 2120fc742e1Seric 2130fc742e1Seric# match recipients against GECOS field? 21433714691Seric_OPTION(MatchGECOS, `confMATCH_GECOS') 2150fc742e1Seric 2160fc742e1Seric# maximum hop count 21733714691Seric_OPTION(MaxHopCount, `confMAX_HOP', 17) 2180fc742e1Seric 2190fc742e1Seric# location of help file 22033714691SericO HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf) 2210fc742e1Seric 2220fc742e1Seric# ignore dots as terminators in incoming messages? 22333714691Seric_OPTION(IgnoreDots, `confIGNORE_DOTS') 2240fc742e1Seric 22533714691Seric# name resolver options 22633714691Seric_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY) 2270fc742e1Seric 22870de6e01Seric# deliver MIME-encapsulated error messages? 22933714691Seric_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS') 23070de6e01Seric 2310fc742e1Seric# Forward file search path 23233714691Seric_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward) 2330fc742e1Seric 2340fc742e1Seric# open connection cache size 23533714691Seric_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2) 2360fc742e1Seric 2370fc742e1Seric# open connection cache timeout 23833714691Seric_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m) 2390fc742e1Seric 240bd6adeb9Seric# use Errors-To: header? 24133714691Seric_OPTION(UseErrorsTo, `confUSE_ERRORS_TO') 242bd6adeb9Seric 2430fc742e1Seric# log level 24433714691Seric_OPTION(LogLevel, `confLOG_LEVEL', 10) 2450fc742e1Seric 2460fc742e1Seric# send to me too, even in an alias expansion? 24733714691Seric_OPTION(MeToo, `confME_TOO') 2480fc742e1Seric 2490fc742e1Seric# verify RHS in newaliases? 25033714691Seric_OPTION(CheckAliases, `confCHECK_ALIASES') 2510fc742e1Seric 2520fc742e1Seric# default messages to old style headers if no special punctuation? 25333714691Seric_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS') 2540fc742e1Seric 2558bcc474dSeric# SMTP daemon options 25633714691Seric_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp) 2578bcc474dSeric 2582188aa70Seric# privacy flags 25933714691Seric_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings) 2602188aa70Seric 2610fc742e1Seric# who (if anyone) should get extra copies of error messages 26233714691Seric_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster) 2630fc742e1Seric 2640fc742e1Seric# slope of queue-only function 26533714691Seric_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000) 2660fc742e1Seric 2670fc742e1Seric# queue directory 26833714691SericO QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue) 2690fc742e1Seric 27033714691Seric# timeouts (many of these) 27133714691Seric_OPTION(Timeout.initial, `confTO_INITIAL', 5m) 27233714691Seric_OPTION(Timeout.helo, `confTO_HELO', 5m) 27333714691Seric_OPTION(Timeout.mail, `confTO_MAIL', 10m) 27433714691Seric_OPTION(Timeout.rcpt, `confTO_RCPT', 1h) 27533714691Seric_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m) 27633714691Seric_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h) 27733714691Seric_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h) 27833714691Seric_OPTION(Timeout.rset, `confTO_RSET', 5m) 27933714691Seric_OPTION(Timeout.quit, `confTO_QUIT', 2m) 28033714691Seric_OPTION(Timeout.misc, `confTO_MISC', 2m) 28133714691Seric_OPTION(Timeout.command, `confTO_COMMAND', 1h) 28233714691Seric_OPTION(Timeout.ident, `confTO_IDENT', 30s) 28333714691Seric_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s) 28433714691Seric_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d) 28533714691Seric_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d) 28633714691Seric_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d) 28733714691Seric_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d) 28833714691Seric_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h) 28933714691Seric_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h) 29033714691Seric_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h) 29133714691Seric_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h) 2920fc742e1Seric 2934517714dSeric# should we not prune routes in route-addr syntax addresses? 29433714691Seric_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES') 2954517714dSeric 2960fc742e1Seric# queue up everything before forking? 29733714691Seric_OPTION(SuperSafe, `confSAFE_QUEUE') 2980fc742e1Seric 2990fc742e1Seric# status file 30033714691Seric_OPTION(StatusFile, `STATUS_FILE', /etc/sendmail.st) 3010fc742e1Seric 3020fc742e1Seric# time zone handling: 3030fc742e1Seric# if undefined, use system default 3040fc742e1Seric# if defined but null, use TZ envariable passed in 3050fc742e1Seric# if defined and non-null, use that info 30633714691Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=', 30733714691Seric confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=', 30833714691Seric `O TimeZoneSpec=confTIME_ZONE') 3090fc742e1Seric 31033714691Seric# default UID (can be username or userid:groupid) 31133714691Seric_OPTION(DefaultUser, `confDEF_USER_ID', nobody) 3120fc742e1Seric 3130fc742e1Seric# list of locations of user database file (null means no lookup) 31433714691Seric_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb) 3150fc742e1Seric 3168bcc474dSeric# fallback MX host 31733714691Seric_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net) 3188bcc474dSeric 31911f06b84Seric# if we are the best MX host for a site, try it directly instead of config err 32033714691Seric_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST') 32111f06b84Seric 3220fc742e1Seric# load average at which we just queue messages 32333714691Seric_OPTION(QueueLA, `confQUEUE_LA', 8) 3240fc742e1Seric 3250fc742e1Seric# load average at which we refuse connections 32633714691Seric_OPTION(RefuseLA, `confREFUSE_LA', 12) 3270fc742e1Seric 3280fc742e1Seric# work recipient factor 32933714691Seric_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000) 3300fc742e1Seric 3310fc742e1Seric# deliver each queued job in a separate process? 33233714691Seric_OPTION(ForkEachJob, `confSEPARATE_PROC') 3330fc742e1Seric 3340fc742e1Seric# work class factor 33533714691Seric_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800) 3360fc742e1Seric 3370fc742e1Seric# work time factor 33833714691Seric_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000) 3390fc742e1Seric 3407837870bSeric# shall we sort the queue by hostname first? 34133714691Seric_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority) 34233714691Seric 34333714691Seric# minimum time in queue before retry 34433714691Seric_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m) 34533714691Seric 34633714691Seric# default character set 34733714691Seric_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1) 34833714691Seric 34933714691Seric# service switch file (ignored on Solaris, Ultrix, OSF/1, others) 35033714691Seric_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch) 35133714691Seric 35233714691Seric# dialup line delay on connection failure 35333714691Seric_OPTION(DialDelay, `confDIAL_DELAY', 10s) 35433714691Seric 35533714691Seric# action to take if there are no recipients in the message 35633714691Seric_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed) 35733714691Seric 35833714691Seric# chrooted environment for writing to files 35933714691Seric_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch) 3607837870bSeric 3610d03837eSeric# are colons OK in addresses? 3620d03837eSeric_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR') 3630d03837eSeric 3640fc742e1Seric########################### 3650fc742e1Seric# Message precedences # 3660fc742e1Seric########################### 3670fc742e1Seric 3680fc742e1SericPfirst-class=0 3690fc742e1SericPspecial-delivery=100 37085afb57eSericPlist=-30 3710fc742e1SericPbulk=-60 3720fc742e1SericPjunk=-100 3730fc742e1Seric 3740fc742e1Seric##################### 3750fc742e1Seric# Trusted users # 3760fc742e1Seric##################### 3770fc742e1Seric 37833714691Seric# this is equivalent to setting class "t" 37933714691Seric#Ft/etc/sendmail.trusted 3800fc742e1SericTroot 3810fc742e1SericTdaemon 3820fc742e1SericTuucp 3830fc742e1Seric 3840fc742e1Seric######################### 3850fc742e1Seric# Format of headers # 3860fc742e1Seric######################### 3870fc742e1Seric 388d5ba2395SericH?P?Return-Path: $g 3890c76e09cSericHReceived: confRECEIVED_HEADER 3900fc742e1SericH?D?Resent-Date: $a 3910fc742e1SericH?D?Date: $a 3920fc742e1SericH?F?Resent-From: $q 3930fc742e1SericH?F?From: $q 3940fc742e1SericH?x?Full-Name: $x 3950fc742e1SericHSubject: 3960fc742e1Seric# HPosted-Date: $a 3970fc742e1Seric# H?l?Received-Date: $b 3980fc742e1SericH?M?Resent-Message-Id: <$t.$i@$j> 3990fc742e1SericH?M?Message-Id: <$t.$i@$j> 40033714691Sericifdef(`_NULL_CLIENT_ONLY_', 40133714691Seric `include(../m4/nullrelay.m4)m4exit', 40233714691Seric `dnl') 4036f4c5567Seric# 4046f4c5567Seric###################################################################### 4056f4c5567Seric###################################################################### 4066f4c5567Seric##### 4076f4c5567Seric##### REWRITING RULES 4086f4c5567Seric##### 4096f4c5567Seric###################################################################### 4106f4c5567Seric###################################################################### 4116f4c5567Seric 4128d35298dSericundivert(9)dnl 4136f4c5567Seric 4146f4c5567Seric########################################### 4156f4c5567Seric### Rulset 3 -- Name Canonicalization ### 4166f4c5567Seric########################################### 41771e1a4d1SericS3 4186f4c5567Seric 4193669020aSeric# handle null input (translate to <@> special case) 4201c0b669eSericR$@ $@ <@> 421f2ad5decSeric 422afc39b13Seric# strip group: syntax (not inside angle brackets!) and trailing semicolon 423afc39b13SericR$* $: $1 <@> mark addresses 424afc39b13SericR$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr> 425afc39b13SericR$* :: $* <@> $: $1 :: $2 unmark host::addr 426afc39b13SericR$* : $* <@> $: $2 strip colon if marked 427afc39b13SericR$* <@> $: $1 unmark 428afc39b13SericR$* ; $: $1 strip trailing semi 429afc39b13Seric 430afc39b13Seric# null input now results from list:; syntax 431afc39b13SericR$@ $@ :; <@> 432afc39b13Seric 4336f4c5567Seric# basic textual canonicalization -- note RFC733 heuristic here 4348d0fcb8eSericR$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> 43585ebc819SericR$*<$*<$+>$*>$* <$3>$5 2-level <> nesting 4361c0b669eSericR$*<>$* $@ <@> MAIL FROM:<> case 4376f4c5567SericR$*<$+>$* $2 basic RFC821/822 parsing 4386f4c5567Seric 4396f4c5567Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later 4406f4c5567SericR@ $+ , $+ @ $1 : $2 change all "," to ":" 4416f4c5567Seric 4426f4c5567Seric# localize and dispose of route-based addresses 44398c7c04fSericR@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> 4446f4c5567Seric 4456f4c5567Seric# find focus for list syntax 44698c7c04fSericR $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax 4476f4c5567SericR $+ : $* ; $@ $1 : $2; list syntax 4486f4c5567Seric 4496f4c5567Seric# find focus for @ syntax addresses 4506f4c5567SericR$+ @ $+ $: $1 < @ $2 > focus on domain 4516f4c5567SericR$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right 45298c7c04fSericR$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical 4536f4c5567Seric 454af3c6a2dSeric# do some sanity checking 455af3c6a2dSericR$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs 456af3c6a2dSeric 45790caf1e3Sericifdef(`_NO_UUCP_', `dnl', 45890caf1e3Seric`# convert old-style addresses to a domain-based address 45998c7c04fSericR$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names 46098c7c04fSericR$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps 46198c7c04fSericR$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains') 4626f4c5567Seric 4636f4c5567Seric# if we have % signs, take the rightmost one 4646f4c5567SericR$* % $* $1 @ $2 First make them all @s. 4656f4c5567SericR$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. 46698c7c04fSericR$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish 4676f4c5567Seric 4686f4c5567Seric# else we must be a local name 4696f4c5567Seric 4706f4c5567Seric 471585ddacfSeric################################################ 47298c7c04fSeric### Ruleset 96 -- bottom half of ruleset 3 ### 473585ddacfSeric################################################ 4746f4c5567Seric 47582027dd5Seric# At this point, everything should be in a "local_part<@domain>extra" format. 47698c7c04fSericS96 4776f4c5567Seric 4786f4c5567Seric# handle special cases for local names 479fde20765SericR$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all 480fde20765SericR$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain 481fde20765Sericifdef(`_NO_UUCP_', `dnl', 482fde20765Seric`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') 48329627271SericR$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] 48429627271SericR$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal 485aabb28c9SericR$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr 486f6f96ca7Sericifdef(`DOMAIN_TABLE', ` 4874e4d6dd0Seric# look up domains in the domain table 4884e4d6dd0SericR$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', 489f6f96ca7Seric`dnl') 49031695942Sericundivert(2)dnl 4916f4c5567Seric 49260f3bdf6Sericifdef(`_NO_UUCP_', `dnl', 49360f3bdf6Seric`ifdef(`UUCP_RELAY', 494788179f5Seric`# pass UUCP addresses straight through 495a6293a76SericR$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', 496788179f5Seric`# if really UUCP, handle it immediately 49763eeb308Sericifdef(`_CLASS_U_', 498a6293a76Seric`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 49963eeb308Sericifdef(`_CLASS_V_', 500a6293a76Seric`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 50163eeb308Sericifdef(`_CLASS_W_', 502a6293a76Seric`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 50363eeb308Sericifdef(`_CLASS_X_', 504a6293a76Seric`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 50563eeb308Sericifdef(`_CLASS_Y_', 506a6293a76Seric`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') 507a027f997Seric 508a027f997Seric# try UUCP traffic as a local address 509a6293a76SericR$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 51098c7c04fSericR$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') 51160f3bdf6Seric') 51223e264c3Sericifdef(`_NO_CANONIFY_', `dnl', 51360f3bdf6Seric`# pass to name server to make hostname canonical 5142f61eeb4SericR$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') 5152f61eeb4Seric 51623e264c3Seric# local host aliases and pseudo-domains are always canonical 51723e264c3SericR$* < @ $=w > $* $: $1 < @ $2 . > $3 518a6293a76SericR$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 51923e264c3SericR$* < @ $* . . > $* $1 < @ $2 . > $3 520a6293a76Seric 52163eeb308Seric# if this is the local hostname, make sure we treat is as canonical 52263eeb308SericR$* < @ $j > $* $: $1 < @ $j . > $2 5236f4c5567Seric 5246f4c5567Seric 5256f4c5567Seric################################################## 5266f4c5567Seric### Ruleset 4 -- Final Output Post-rewriting ### 5276f4c5567Seric################################################## 5286f4c5567SericS4 5296f4c5567Seric 5301c0b669eSericR$*<@> $@ $1 handle <> and list:; 5316f4c5567Seric 53263eeb308Seric# strip trailing dot off possibly canonical name 53363eeb308SericR$* < @ $+ . > $* $1 < @ $2 > $3 53463eeb308Seric 5356f4c5567Seric# externalize local domain info 5366f4c5567SericR$* < $+ > $* $1 $2 $3 defocus 5376f4c5567SericR@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical 5381f23b499SericR@ $* $@ @ $1 ... and exit 5396f4c5567Seric 54090caf1e3Sericifdef(`_NO_UUCP_', `dnl', 54190caf1e3Seric`# UUCP must always be presented in old form 54290caf1e3SericR$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') 5436f4c5567Seric 5446f4c5567Seric# delete duplicate local names 545b47d0647SericR$+ % $=w @ $=w $1 @ $j u%host@host => u@host 5466f4c5567Seric 5476f4c5567Seric 5486f4c5567Seric 549585ddacfSeric############################################################## 55098c7c04fSeric### Ruleset 97 -- recanonicalize and call ruleset zero ### 5516f4c5567Seric### (used for recursive calls) ### 552585ddacfSeric############################################################## 5536f4c5567Seric 55498c7c04fSericS`'97 5556f4c5567SericR$* $: $>3 $1 5566f4c5567SericR$* $@ $>0 $1 5576f4c5567Seric 5586f4c5567Seric 5596f4c5567Seric###################################### 5606f4c5567Seric### Ruleset 0 -- Parse Address ### 5616f4c5567Seric###################################### 5626f4c5567Seric 5636f4c5567SericS0 5646f4c5567Seric 5659ea84951SericR<@> $#_LOCAL_ $: <@> special case error msgs 566c3dee10cSericR$* : $* ; $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" 5672afea1f3SericR<@ $+> $#error $@ USAGE $: "user address required" 5689ea84951SericR$* <$* : $* > $* $#error $@ USAGE $: "colon illegal in host name part" 569270180daSericR$* < @ . > $* $#error $@ USAGE $: "invalid host name" 5701c5e29abSeric 5714cad3747Sericifdef(`_MAILER_smtp_', 5724cad3747Seric`# handle numeric address spec 57398c7c04fSericR$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec 5740df17a5aSericR$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', 5753c5c069fSeric `dnl') 5766f4c5567Seric 577b1286b66Seric# now delete the local info -- note $=O to find characters that cause forwarding 57898c7c04fSericR$* < @ > $* $@ $>97 $1 user@ => user 57998c7c04fSericR< @ $=w . > : $* $@ $>97 $2 @here:... -> ... 58098c7c04fSericR$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... 5818e83e806Seric 5828e83e806Seric# handle local hacks 58398c7c04fSericR$* $: $>98 $1 584ee3aff56Seric 585ee3aff56Seric# short circuit local delivery so forwarded email works 58680df0526Sericifdef(`_STICKY_LOCAL_DOMAIN_', 58780df0526Seric`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub 5889e90d93dSericR< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep .... 58980df0526SericR< > $=D . $+ < $+ > $#_LOCAL_ $: $1 . $2 dotted name? 590b9996d05SericR< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name? 59180df0526SericR< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address', 592ee3aff56Seric`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names 593b9996d05SericR$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name') 59421933f06Sericifdef(`MAILER_TABLE', 59521933f06Seric` 59621933f06Seric# not local -- try mailer table lookup 59721933f06SericR$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name 59821933f06SericR< $+ . > $* $: < $1 > $2 strip trailing dot 59921933f06SericR< $+ > $* $: < $(mailertable $1 $) > $2 lookup 60021933f06SericR< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? 60121933f06SericR< $+ > $* $: $>90 <$1> $2 try domain', 60221933f06Seric`dnl') 60371e1a4d1Sericundivert(4)dnl 60471e1a4d1Seric 60507da7f83Sericifdef(`_NO_UUCP_', `dnl', 60607da7f83Seric`# resolve remotely connected UUCP links (if any) 607138c6544Sericifdef(`_CLASS_V_', 60898c7c04fSeric`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3', 6096dafc3b0Seric `dnl') 610138c6544Sericifdef(`_CLASS_W_', 61198c7c04fSeric`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3', 6126dafc3b0Seric `dnl') 613138c6544Sericifdef(`_CLASS_X_', 61498c7c04fSeric`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3', 61507da7f83Seric `dnl')') 61671e1a4d1Seric 6176f4c5567Seric# resolve fake top level domains by forwarding to other hosts 6186f4c5567Sericifdef(`BITNET_RELAY', 61998c7c04fSeric`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET', 6206f4c5567Seric `dnl') 621d5e4353cSericifdef(`_MAILER_pop_', 622d5e4353cSeric`R$+ < @ POP. > $#pop $: $1 user@POP', 623d5e4353cSeric `dnl') 6245caa7271Sericifdef(`_MAILER_fax_', 625a6293a76Seric`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX', 6265caa7271Seric`ifdef(`FAX_RELAY', 62798c7c04fSeric`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX', 6285caa7271Seric `dnl')') 6296f4c5567Seric 63071e1a4d1Sericifdef(`UUCP_RELAY', 63171e1a4d1Seric`# forward non-local UUCP traffic to our UUCP relay 63298c7c04fSericR$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail', 6334cad3747Seric`ifdef(`_MAILER_uucp_', 63471e1a4d1Seric`# forward other UUCP traffic straight to UUCP 6350a7545bbSericR$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', 63671e1a4d1Seric `dnl')') 6378e83e806Sericifdef(`_MAILER_usenet_', ` 638f6f96ca7Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup 639a6e5b286SericR$+ . USENET $#usenet $: $1', 640f6f96ca7Seric `dnl') 641f6f96ca7Seric 64285afb57eSericifdef(`_LOCAL_RULES_', 64385afb57eSeric`# figure out what should stay in our local mail system 644f6f96ca7Sericundivert(1)', `dnl') 645f6f96ca7Seric 6468a1641c9Seric# pass names that still have a host to a smarthost (if defined) 64798c7c04fSericR$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name 648f6f96ca7Seric 6498a1641c9Seric# deal with other remote names 650b501d107Sericifdef(`_MAILER_smtp_', 65119110660Seric`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain', 6528a1641c9Seric`R$* < @$* > $* $#error $@NOHOST $: Unrecognized host name $2') 6536f4c5567Seric 65498c7c04fSeric# if this is quoted, strip the quotes and try again 655d31361c2SericR$+ $: $(dequote $1 $) strip quotes 65698c7c04fSericR$+ $=O $+ $@ $>97 $1 $2 $3 try again 657d31361c2Seric 658d31361c2Seric# handle locally delivered names 659d6e720f1SericR$=L $#_LOCAL_ $: @ $1 special local names 660d6e720f1SericR$+ $#_LOCAL_ $: $1 regular local names 6616f4c5567Seric 6624cad3747Seric########################################################################### 6634cad3747Seric### Ruleset 5 -- special rewriting after aliases have been expanded ### 6644cad3747Seric########################################################################### 6656f4c5567Seric 66663eeb308SericS5 66763eeb308Seric 668b3d9bc08Seric# if we have a "special dotted user", convert it back to the base name 669b3d9bc08SericR$=D . * $#_LOCAL_ $: $1 670b3d9bc08SericR$=D . $+ $#_LOCAL_ $: $1 . * 671b3d9bc08Seric 67280df0526Seric# prepend an empty "forward host" on the front 67380df0526SericR$+ $: <> $1 67480df0526Seric 67580df0526Sericifdef(`LUSER_RELAY', 67680df0526Seric`# send unrecognized local users to a relay host 677708f9b8bSericR< > $+ + $* $: < $L . > $( user $1 $) + $2 678708f9b8bSericR< > $+ $: < $L . > $( user $1 $) look up user 679708f9b8bSericR< $* > $+ <> $* $: < > $2 $3 found; strip $L 680708f9b8bSericR< $* . > $+ $: < $1 > $2 strip extra dot') 681708f9b8bSeric 682708f9b8bSeric# handle plussed local names 683708f9b8bSericR< > $+ + $* $#_LOCAL_ $@ $2 $: $1 68480df0526Seric 685fdf362d5Seric# see if we have a relay or a hub 686ee3aff56SericR< > $+ $: < $H > $1 try hub 6879e90d93dSericR< > $+ $: < $R > $1 try relay 688ee3aff56SericR< > $+ $@ $1 nope, give up 68998c7c04fSericR< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 > 69098c7c04fSericR< $+ > $+ $@ $>95 < $1 > $2 < @ $1 > 691bc926da7Sericifdef(`MAILER_TABLE', 692bc926da7Seric` 693bc926da7Seric 69411f06b84Seric################################################################### 695bc926da7Seric### Ruleset 90 -- try domain part of mailertable entry ### 69611f06b84Seric################################################################### 697bc926da7Seric 698bc926da7SericS90 699833e6943SericR$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 70074fcb73aSericR$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? 70174fcb73aSericR$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again 702a69811b9SericR$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." 70321933f06SericR<$- : $+ > $* $# $1 $@ $2 $: $3 "." found? 70421933f06SericR< $* > $* $@ $2 no mailertable match', 705bc926da7Seric`dnl') 70611f06b84Seric 70711f06b84Seric################################################################### 70898c7c04fSeric### Ruleset 95 -- canonify mailer:host syntax to triple ### 709aeacfb61Seric################################################################### 710aeacfb61Seric 71198c7c04fSericS95 712aeacfb61SericR< > $* $@ $1 strip off null relay 713aeacfb61SericR< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer 714aeacfb61SericR< $=w > $* $@ $2 delete local host 715aeacfb61SericR< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer 716aeacfb61Seric 717aeacfb61Seric################################################################### 71898c7c04fSeric### Ruleset 98 -- local part of ruleset zero (can be null) ### 71911f06b84Seric################################################################### 72011f06b84Seric 72198c7c04fSericS98 72211f06b84Sericundivert(3)dnl 7236f4c5567Seric# 7246f4c5567Seric###################################################################### 7256f4c5567Seric###################################################################### 7266f4c5567Seric##### 7271297e20cSeric`##### MAILER DEFINITIONS' 7286f4c5567Seric##### 7296f4c5567Seric###################################################################### 7306f4c5567Seric###################################################################### 7316f4c5567Sericundivert(7)dnl 732