Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
# Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
Ryan Haggerty e50d1d
#	All rights reserved.
Ryan Haggerty e50d1d
# Copyright (c) 1983, 1995 Eric P. Allman.  All rights reserved.
Ryan Haggerty e50d1d
# Copyright (c) 1988, 1993
Ryan Haggerty e50d1d
#	The Regents of the University of California.  All rights reserved.
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
# By using this file, you agree to the terms and conditions set
Ryan Haggerty e50d1d
# forth in the LICENSE file which can be found at the top level of
Ryan Haggerty e50d1d
# the sendmail distribution.
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
#####		SENDMAIL CONFIGURATION FILE
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
##### built by root@gibbons on Thu Nov 10 11:40:01 EST 2005
Ryan Haggerty e50d1d
##### in /etc/mail
Ryan Haggerty e50d1d
##### using /usr/share/sendmail-cf/ as configuration include directory
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
#####	DO NOT EDIT THIS FILE!  Only edit the source .mc file.
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: cfhead.m4,v 8.116 2004/01/28 22:02:22 ca Exp $  #####
Ryan Haggerty e50d1d
#####  $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $  #####
Ryan Haggerty e50d1d
#####  setup for Red Hat Linux  #####
Ryan Haggerty e50d1d
#####  $Id: linux.m4,v 8.13 2000/09/17 17:30:00 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: local_procmail.m4,v 8.22 2002/11/17 04:24:19 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: no_default_msa.m4,v 8.2 2001/02/14 05:03:22 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: smrsh.m4,v 8.14 1999/11/18 05:06:23 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: mailertable.m4,v 8.25 2002/06/27 23:23:57 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: virtusertable.m4,v 8.23 2002/06/27 23:23:57 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: redirect.m4,v 8.15 1999/08/06 01:47:36 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: always_add_domain.m4,v 8.11 2000/09/12 22:00:53 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: use_cw_file.m4,v 8.11 2001/08/26 20:58:57 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: use_ct_file.m4,v 8.11 2001/08/26 20:58:57 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: local_procmail.m4,v 8.22 2002/11/17 04:24:19 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: access_db.m4,v 8.26 2004/06/24 18:10:02 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: blacklist_recipients.m4,v 8.13 1999/04/02 02:25:13 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: accept_unresolvable_domains.m4,v 8.10 1999/02/07 07:26:07 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: proto.m4,v 8.718 2005/08/24 18:07:23 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# level 10 config file format
Ryan Haggerty e50d1d
V10/Berkeley
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# override file safeties - setting this option compromises system security,
Ryan Haggerty e50d1d
# addressing the actual file configuration problem is preferred
Ryan Haggerty e50d1d
# need to set this before any file actions are encountered in the cf file
Ryan Haggerty e50d1d
#O DontBlameSendmail=safe
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# default LDAP map specification
Ryan Haggerty e50d1d
# need to set this now before any LDAP maps are defined
Ryan Haggerty e50d1d
#O LDAPDefaultSpec=-h localhost
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
##################
Ryan Haggerty e50d1d
#   local info   #
Ryan Haggerty e50d1d
##################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# my LDAP cluster
Ryan Haggerty e50d1d
# need to set this before any LDAP lookups are done (including classes)
Ryan Haggerty e50d1d
#D{sendmailMTACluster}$m
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Cwlocalhost
Ryan Haggerty e50d1d
# file containing names of hosts for which we receive email
Ryan Haggerty e50d1d
Fw/etc/mail/local-host-names
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# my official domain name
Ryan Haggerty e50d1d
# ... define this only if sendmail cannot automatically determine your domain
Ryan Haggerty e50d1d
#Dj$w.Foo.COM
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# host/domain names ending with a token in class P are canonical
Ryan Haggerty e50d1d
CP.
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# "Smart" relay host (may be null)
Ryan Haggerty e50d1d
DS
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# operators that cannot be in local usernames (i.e., network indicators)
Ryan Haggerty e50d1d
CO @ % !
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# a class with just dot (for identifying canonical names)
Ryan Haggerty e50d1d
C..
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# a class with just a left bracket (for identifying domain literals)
Ryan Haggerty e50d1d
C[[
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# access_db acceptance class
Ryan Haggerty e50d1d
C{Accept}OK RELAY
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
C{ResOk}OKR
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Hosts for which relaying is permitted ($=R)
Ryan Haggerty e50d1d
FR-o /etc/mail/relay-domains
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# arithmetic map
Ryan Haggerty e50d1d
Karith arith
Ryan Haggerty e50d1d
# macro storage map
Ryan Haggerty e50d1d
Kmacro macro
Ryan Haggerty e50d1d
# possible values for TLS_connection in access map
Ryan Haggerty e50d1d
C{Tls}VERIFY ENCR
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# dequoting map
Ryan Haggerty e50d1d
Kdequote dequote
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# class E: names that should be exposed as from this host, even if we masquerade
Ryan Haggerty e50d1d
# class L: names that should be delivered locally, even if we have a relay
Ryan Haggerty e50d1d
# class M: domains that should be converted to $M
Ryan Haggerty e50d1d
# class N: domains that should not be converted to $M
Ryan Haggerty e50d1d
#CL root
Ryan Haggerty e50d1d
C{E}root
Ryan Haggerty e50d1d
C{w}localhost.localdomain
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# my name for error messages
Ryan Haggerty e50d1d
DnMAILER-DAEMON
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Mailer table (overriding domains)
Ryan Haggerty e50d1d
Kmailertable hash -o /etc/mail/mailertable.db
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Virtual user table (maps incoming users)
Ryan Haggerty e50d1d
Kvirtuser hash -o /etc/mail/virtusertable.db
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
CPREDIRECT
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Access list database (for spam stomping)
Ryan Haggerty e50d1d
Kaccess hash -T<TMPF> -o /etc/mail/access.db
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Configuration version number
Ryan Haggerty e50d1d
DZ8.13.5
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###############
Ryan Haggerty e50d1d
#   Options   #
Ryan Haggerty e50d1d
###############
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# strip message body to 7 bits on input?
Ryan Haggerty e50d1d
O SevenBitInput=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# 8-bit data handling
Ryan Haggerty e50d1d
#O EightBitMode=pass8
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# wait for alias file rebuild (default units: minutes)
Ryan Haggerty e50d1d
O AliasWait=10
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# location of alias file
Ryan Haggerty e50d1d
O AliasFile=/etc/aliases
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# minimum number of free blocks on filesystem
Ryan Haggerty e50d1d
O MinFreeBlocks=100
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# maximum message size
Ryan Haggerty e50d1d
#O MaxMessageSize=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# substitution for space (blank) characters
Ryan Haggerty e50d1d
O BlankSub=.
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# avoid connecting to "expensive" mailers on initial submission?
Ryan Haggerty e50d1d
O HoldExpensive=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# checkpoint queue runs after every N successful deliveries
Ryan Haggerty e50d1d
#O CheckpointInterval=10
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# default delivery mode
Ryan Haggerty e50d1d
O DeliveryMode=background
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# error message header/file
Ryan Haggerty e50d1d
#O ErrorHeader=/etc/mail/error-header
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# error mode
Ryan Haggerty e50d1d
#O ErrorMode=print
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# save Unix-style "From_" lines at top of header?
Ryan Haggerty e50d1d
#O SaveFromLine=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# queue file mode (qf files)
Ryan Haggerty e50d1d
#O QueueFileMode=0600
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# temporary file mode
Ryan Haggerty e50d1d
O TempFileMode=0600
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# match recipients against GECOS field?
Ryan Haggerty e50d1d
#O MatchGECOS=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# maximum hop count
Ryan Haggerty e50d1d
#O MaxHopCount=25
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# location of help file
Ryan Haggerty e50d1d
O HelpFile=/etc/mail/helpfile
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# ignore dots as terminators in incoming messages?
Ryan Haggerty e50d1d
#O IgnoreDots=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# name resolver options
Ryan Haggerty e50d1d
#O ResolverOptions=+AAONLY
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# deliver MIME-encapsulated error messages?
Ryan Haggerty e50d1d
O SendMimeErrors=True
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Forward file search path
Ryan Haggerty e50d1d
O ForwardPath=$z/.forward.$w:$z/.forward
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# open connection cache size
Ryan Haggerty e50d1d
O ConnectionCacheSize=2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# open connection cache timeout
Ryan Haggerty e50d1d
O ConnectionCacheTimeout=5m
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# persistent host status directory
Ryan Haggerty e50d1d
#O HostStatusDirectory=.hoststat
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# single thread deliveries (requires HostStatusDirectory)?
Ryan Haggerty e50d1d
#O SingleThreadDelivery=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# use Errors-To: header?
Ryan Haggerty e50d1d
O UseErrorsTo=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# log level
Ryan Haggerty e50d1d
O LogLevel=9
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# send to me too, even in an alias expansion?
Ryan Haggerty e50d1d
#O MeToo=True
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# verify RHS in newaliases?
Ryan Haggerty e50d1d
O CheckAliases=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# default messages to old style headers if no special punctuation?
Ryan Haggerty e50d1d
O OldStyleHeaders=True
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# SMTP daemon options
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# SMTP client options
Ryan Haggerty e50d1d
#O ClientPortOptions=Family=inet, Address=0.0.0.0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Modifiers to define {daemon_flags} for direct submissions
Ryan Haggerty e50d1d
#O DirectSubmissionModifiers
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Use as mail submission program? See sendmail/SECURITY
Ryan Haggerty e50d1d
#O UseMSP
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# privacy flags
Ryan Haggerty e50d1d
O PrivacyOptions=authwarnings,novrfy,noexpn,restrictqrun
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# who (if anyone) should get extra copies of error messages
Ryan Haggerty e50d1d
#O PostmasterCopy=Postmaster
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# slope of queue-only function
Ryan Haggerty e50d1d
#O QueueFactor=600000
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# limit on number of concurrent queue runners
Ryan Haggerty e50d1d
#O MaxQueueChildren
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# maximum number of queue-runners per queue-grouping with multiple queues
Ryan Haggerty e50d1d
#O MaxRunnersPerQueue=1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# priority of queue runners (nice(3))
Ryan Haggerty e50d1d
#O NiceQueueRun
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# shall we sort the queue by hostname first?
Ryan Haggerty e50d1d
#O QueueSortOrder=priority
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# minimum time in queue before retry
Ryan Haggerty e50d1d
#O MinQueueAge=30m
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# how many jobs can you process in the queue?
Ryan Haggerty e50d1d
#O MaxQueueRunSize=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# perform initial split of envelope without checking MX records
Ryan Haggerty e50d1d
#O FastSplit=1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# queue directory
Ryan Haggerty e50d1d
O QueueDirectory=/var/spool/mqueue
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# key for shared memory; 0 to turn off
Ryan Haggerty e50d1d
#O SharedMemoryKey=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# timeouts (many of these)
Ryan Haggerty e50d1d
#O Timeout.initial=5m
Ryan Haggerty e50d1d
O Timeout.connect=1m
Ryan Haggerty e50d1d
#O Timeout.aconnect=0s
Ryan Haggerty e50d1d
#O Timeout.iconnect=5m
Ryan Haggerty e50d1d
#O Timeout.helo=5m
Ryan Haggerty e50d1d
#O Timeout.mail=10m
Ryan Haggerty e50d1d
#O Timeout.rcpt=1h
Ryan Haggerty e50d1d
#O Timeout.datainit=5m
Ryan Haggerty e50d1d
#O Timeout.datablock=1h
Ryan Haggerty e50d1d
#O Timeout.datafinal=1h
Ryan Haggerty e50d1d
#O Timeout.rset=5m
Ryan Haggerty e50d1d
#O Timeout.quit=2m
Ryan Haggerty e50d1d
#O Timeout.misc=2m
Ryan Haggerty e50d1d
#O Timeout.command=1h
Ryan Haggerty e50d1d
O Timeout.ident=0
Ryan Haggerty e50d1d
#O Timeout.fileopen=60s
Ryan Haggerty e50d1d
#O Timeout.control=2m
Ryan Haggerty e50d1d
O Timeout.queuereturn=5d
Ryan Haggerty e50d1d
#O Timeout.queuereturn.normal=5d
Ryan Haggerty e50d1d
#O Timeout.queuereturn.urgent=2d
Ryan Haggerty e50d1d
#O Timeout.queuereturn.non-urgent=7d
Ryan Haggerty e50d1d
#O Timeout.queuereturn.dsn=5d
Ryan Haggerty e50d1d
O Timeout.queuewarn=4h
Ryan Haggerty e50d1d
#O Timeout.queuewarn.normal=4h
Ryan Haggerty e50d1d
#O Timeout.queuewarn.urgent=1h
Ryan Haggerty e50d1d
#O Timeout.queuewarn.non-urgent=12h
Ryan Haggerty e50d1d
#O Timeout.queuewarn.dsn=4h
Ryan Haggerty e50d1d
#O Timeout.hoststatus=30m
Ryan Haggerty e50d1d
#O Timeout.resolver.retrans=5s
Ryan Haggerty e50d1d
#O Timeout.resolver.retrans.first=5s
Ryan Haggerty e50d1d
#O Timeout.resolver.retrans.normal=5s
Ryan Haggerty e50d1d
#O Timeout.resolver.retry=4
Ryan Haggerty e50d1d
#O Timeout.resolver.retry.first=4
Ryan Haggerty e50d1d
#O Timeout.resolver.retry.normal=4
Ryan Haggerty e50d1d
#O Timeout.lhlo=2m
Ryan Haggerty e50d1d
#O Timeout.auth=10m
Ryan Haggerty e50d1d
#O Timeout.starttls=1h
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# time for DeliverBy; extension disabled if less than 0
Ryan Haggerty e50d1d
#O DeliverByMin=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# should we not prune routes in route-addr syntax addresses?
Ryan Haggerty e50d1d
#O DontPruneRoutes=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# queue up everything before forking?
Ryan Haggerty e50d1d
O SuperSafe=True
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# status file
Ryan Haggerty e50d1d
O StatusFile=/var/log/mail/statistics
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# time zone handling:
Ryan Haggerty e50d1d
#  if undefined, use system default
Ryan Haggerty e50d1d
#  if defined but null, use TZ envariable passed in
Ryan Haggerty e50d1d
#  if defined and non-null, use that info
Ryan Haggerty e50d1d
#O TimeZoneSpec=
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# default UID (can be username or userid:groupid)
Ryan Haggerty e50d1d
O DefaultUser=8:12
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# list of locations of user database file (null means no lookup)
Ryan Haggerty e50d1d
O UserDatabaseSpec=/etc/mail/userdb.db
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# fallback MX host
Ryan Haggerty e50d1d
#O FallbackMXhost=fall.back.host.net
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# fallback smart host
Ryan Haggerty e50d1d
#O FallbackSmartHost=fall.back.host.net
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# if we are the best MX host for a site, try it directly instead of config err
Ryan Haggerty e50d1d
O TryNullMXList=true
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# load average at which we just queue messages
Ryan Haggerty e50d1d
#O QueueLA=8
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# load average at which we refuse connections
Ryan Haggerty e50d1d
#O RefuseLA=12
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# log interval when refusing connections for this long
Ryan Haggerty e50d1d
#O RejectLogInterval=3h
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# load average at which we delay connections; 0 means no limit
Ryan Haggerty e50d1d
#O DelayLA=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# maximum number of children we allow at one time
Ryan Haggerty e50d1d
#O MaxDaemonChildren=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# maximum number of new connections per second
Ryan Haggerty e50d1d
#O ConnectionRateThrottle=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Width of the window 
Ryan Haggerty e50d1d
#O ConnectionRateWindowSize=60s
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# work recipient factor
Ryan Haggerty e50d1d
#O RecipientFactor=30000
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# deliver each queued job in a separate process?
Ryan Haggerty e50d1d
#O ForkEachJob=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# work class factor
Ryan Haggerty e50d1d
#O ClassFactor=1800
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# work time factor
Ryan Haggerty e50d1d
#O RetryFactor=90000
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# default character set
Ryan Haggerty e50d1d
#O DefaultCharSet=unknown-8bit
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
Ryan Haggerty e50d1d
#O ServiceSwitchFile=/etc/mail/service.switch
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# hosts file (normally /etc/hosts)
Ryan Haggerty e50d1d
#O HostsFile=/etc/hosts
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# dialup line delay on connection failure
Ryan Haggerty e50d1d
#O DialDelay=0s
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# action to take if there are no recipients in the message
Ryan Haggerty e50d1d
#O NoRecipientAction=none
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# chrooted environment for writing to files
Ryan Haggerty e50d1d
#O SafeFileEnvironment
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# are colons OK in addresses?
Ryan Haggerty e50d1d
#O ColonOkInAddr=True
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# shall I avoid expanding CNAMEs (violates protocols)?
Ryan Haggerty e50d1d
#O DontExpandCnames=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# SMTP initial login message (old $e macro)
Ryan Haggerty e50d1d
O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# UNIX initial From header format (old $l macro)
Ryan Haggerty e50d1d
O UnixFromLine=From $g $d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# From: lines that have embedded newlines are unwrapped onto one line
Ryan Haggerty e50d1d
#O SingleLineFromHeader=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Allow HELO SMTP command that does not include a host name
Ryan Haggerty e50d1d
#O AllowBogusHELO=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
Ryan Haggerty e50d1d
#O MustQuoteChars=.
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# delimiter (operator) characters (old $o macro)
Ryan Haggerty e50d1d
O OperatorChars=.:%@!^/[]+
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# shall I avoid calling initgroups(3) because of high NIS costs?
Ryan Haggerty e50d1d
#O DontInitGroups=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# are group-writable :include: and .forward files (un)trustworthy?
Ryan Haggerty e50d1d
# True (the default) means they are not trustworthy.
Ryan Haggerty e50d1d
#O UnsafeGroupWrites=True
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# where do errors that occur when sending errors get sent?
Ryan Haggerty e50d1d
#O DoubleBounceAddress=postmaster
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# where to save bounces if all else fails
Ryan Haggerty e50d1d
#O DeadLetterDrop=/var/tmp/dead.letter
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# what user id do we assume for the majority of the processing?
Ryan Haggerty e50d1d
#O RunAsUser=sendmail
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# maximum number of recipients per SMTP envelope
Ryan Haggerty e50d1d
#O MaxRecipientsPerMessage=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# limit the rate recipients per SMTP envelope are accepted
Ryan Haggerty e50d1d
# once the threshold number of recipients have been rejected
Ryan Haggerty e50d1d
#O BadRcptThrottle=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# shall we get local names from our installed interfaces?
Ryan Haggerty e50d1d
O DontProbeInterfaces=true
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Return-Receipt-To: header implies DSN request
Ryan Haggerty e50d1d
#O RrtImpliesDsn=False
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# override connection address (for testing)
Ryan Haggerty e50d1d
#O ConnectOnlyTo=0.0.0.0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Trusted user for file ownership and starting the daemon
Ryan Haggerty e50d1d
#O TrustedUser=root
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Control socket for daemon management
Ryan Haggerty e50d1d
#O ControlSocketName=/var/spool/mqueue/.control
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Maximum MIME header length to protect MUAs
Ryan Haggerty e50d1d
#O MaxMimeHeaderLength=0/0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Maximum length of the sum of all headers
Ryan Haggerty e50d1d
#O MaxHeadersLength=32768
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Maximum depth of alias recursion
Ryan Haggerty e50d1d
#O MaxAliasRecursion=10
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# location of pid file
Ryan Haggerty e50d1d
#O PidFile=/var/run/sendmail.pid
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Prefix string for the process title shown on 'ps' listings
Ryan Haggerty e50d1d
#O ProcessTitlePrefix=prefix
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Data file (df) memory-buffer file maximum size
Ryan Haggerty e50d1d
#O DataFileBufferSize=4096
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Transcript file (xf) memory-buffer file maximum size
Ryan Haggerty e50d1d
#O XscriptFileBufferSize=4096
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# lookup type to find information about local mailboxes
Ryan Haggerty e50d1d
#O MailboxDatabase=pw
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# override compile time flag REQUIRES_DIR_FSYNC
Ryan Haggerty e50d1d
#O RequiresDirfsync=true
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# list of authentication mechanisms
Ryan Haggerty e50d1d
#O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Authentication realm
Ryan Haggerty e50d1d
#O AuthRealm
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# default authentication information for outgoing connections
Ryan Haggerty e50d1d
#O DefaultAuthInfo=/etc/mail/default-auth-info
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# SMTP AUTH flags
Ryan Haggerty e50d1d
O AuthOptions=A
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# SMTP AUTH maximum encryption strength
Ryan Haggerty e50d1d
#O AuthMaxBits
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# SMTP STARTTLS server options
Ryan Haggerty e50d1d
#O TLSSrvOptions
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# Input mail filters
Ryan Haggerty e50d1d
#O InputMailFilters
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# CA directory
Ryan Haggerty e50d1d
#O CACertPath
Ryan Haggerty e50d1d
# CA file
Ryan Haggerty e50d1d
#O CACertFile
Ryan Haggerty e50d1d
# Server Cert
Ryan Haggerty e50d1d
#O ServerCertFile
Ryan Haggerty e50d1d
# Server private key
Ryan Haggerty e50d1d
#O ServerKeyFile
Ryan Haggerty e50d1d
# Client Cert
Ryan Haggerty e50d1d
#O ClientCertFile
Ryan Haggerty e50d1d
# Client private key
Ryan Haggerty e50d1d
#O ClientKeyFile
Ryan Haggerty e50d1d
# File containing certificate revocation lists 
Ryan Haggerty e50d1d
#O CRLFile
Ryan Haggerty e50d1d
# DHParameters (only required if DSA/DH is used)
Ryan Haggerty e50d1d
#O DHParameters
Ryan Haggerty e50d1d
# Random data source (required for systems without /dev/urandom under OpenSSL)
Ryan Haggerty e50d1d
#O RandFile
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
############################
Ryan Haggerty e50d1d
# QUEUE GROUP DEFINITIONS  #
Ryan Haggerty e50d1d
############################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###########################
Ryan Haggerty e50d1d
#   Message precedences   #
Ryan Haggerty e50d1d
###########################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Pfirst-class=0
Ryan Haggerty e50d1d
Pspecial-delivery=100
Ryan Haggerty e50d1d
Plist=-30
Ryan Haggerty e50d1d
Pbulk=-60
Ryan Haggerty e50d1d
Pjunk=-100
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####################
Ryan Haggerty e50d1d
#   Trusted users   #
Ryan Haggerty e50d1d
#####################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# this is equivalent to setting class "t"
Ryan Haggerty e50d1d
Ft/etc/mail/trusted-users
Ryan Haggerty e50d1d
Troot
Ryan Haggerty e50d1d
Tdaemon
Ryan Haggerty e50d1d
Tuucp
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#########################
Ryan Haggerty e50d1d
#   Format of headers   #
Ryan Haggerty e50d1d
#########################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
H?P?Return-Path: <$g>
Ryan Haggerty e50d1d
HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
Ryan Haggerty e50d1d
	$.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
Ryan Haggerty e50d1d
	$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
Ryan Haggerty e50d1d
	(version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
Ryan Haggerty e50d1d
	for $u; $|;
Ryan Haggerty e50d1d
	$.$b
Ryan Haggerty e50d1d
H?D?Resent-Date: $a
Ryan Haggerty e50d1d
H?D?Date: $a
Ryan Haggerty e50d1d
H?F?Resent-From: $?x$x <$g>$|$g$.
Ryan Haggerty e50d1d
H?F?From: $?x$x <$g>$|$g$.
Ryan Haggerty e50d1d
H?x?Full-Name: $x
Ryan Haggerty e50d1d
# HPosted-Date: $a
Ryan Haggerty e50d1d
# H?l?Received-Date: $b
Ryan Haggerty e50d1d
H?M?Resent-Message-Id: <$t.$i@$j>
Ryan Haggerty e50d1d
H?M?Message-Id: <$t.$i@$j>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
#####			REWRITING RULES
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
############################################
Ryan Haggerty e50d1d
###  Ruleset 3 -- Name Canonicalization  ###
Ryan Haggerty e50d1d
############################################
Ryan Haggerty e50d1d
Scanonify=3
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle null input (translate to <@> special case)
Ryan Haggerty e50d1d
R$@			$@ <@>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# strip group: syntax (not inside angle brackets!) and trailing semicolon
Ryan Haggerty e50d1d
R$*			$: $1 <@>			mark addresses
Ryan Haggerty e50d1d
R$* < $* > $* <@>	$: $1 < $2 > $3			unmark <addr>
Ryan Haggerty e50d1d
R@ $* <@>		$: @ $1				unmark @host:...
Ryan Haggerty e50d1d
R$* [ IPv6 : $+ ] <@>	$: $1 [ IPv6 : $2 ]		unmark IPv6 addr
Ryan Haggerty e50d1d
R$* :: $* <@>		$: $1 :: $2			unmark node::addr
Ryan Haggerty e50d1d
R:include: $* <@>	$: :include: $1			unmark :include:...
Ryan Haggerty e50d1d
R$* : $* [ $* ]		$: $1 : $2 [ $3 ] <@>		remark if leading colon
Ryan Haggerty e50d1d
R$* : $* <@>		$: $2				strip colon if marked
Ryan Haggerty e50d1d
R$* <@>			$: $1				unmark
Ryan Haggerty e50d1d
R$* ;			   $1				strip trailing semi
Ryan Haggerty e50d1d
R$* < $+ :; > $*	$@ $2 :; <@>			catch <list:;>
Ryan Haggerty e50d1d
R$* < $* ; >		   $1 < $2 >			bogus bracketed semi
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# null input now results from list:; syntax
Ryan Haggerty e50d1d
R$@			$@ :; <@>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# strip angle brackets -- note RFC733 heuristic to get innermost item
Ryan Haggerty e50d1d
R$*			$: < $1 >			housekeeping <>
Ryan Haggerty e50d1d
R$+ < $* >		   < $2 >			strip excess on left
Ryan Haggerty e50d1d
R< $* > $+		   < $1 >			strip excess on right
Ryan Haggerty e50d1d
R<>			$@ < @ >			MAIL FROM:<> case
Ryan Haggerty e50d1d
R< $+ >			$: $1				remove housekeeping <>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# strip route address <@a,@b,@c:user@d> -> <user@d>
Ryan Haggerty e50d1d
R@ $+ , $+		$2
Ryan Haggerty e50d1d
R@ [ $* ] : $+		$2
Ryan Haggerty e50d1d
R@ $+ : $+		$2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# find focus for list syntax
Ryan Haggerty e50d1d
R $+ : $* ; @ $+	$@ $>Canonify2 $1 : $2 ; < @ $3 >	list syntax
Ryan Haggerty e50d1d
R $+ : $* ;		$@ $1 : $2;			list syntax
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# find focus for @ syntax addresses
Ryan Haggerty e50d1d
R$+ @ $+		$: $1 < @ $2 >			focus on domain
Ryan Haggerty e50d1d
R$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
Ryan Haggerty e50d1d
R$+ < @ $+ >		$@ $>Canonify2 $1 < @ $2 >	already canonical
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# convert old-style addresses to a domain-based address
Ryan Haggerty e50d1d
R$- ! $+		$@ $>Canonify2 $2 < @ $1 .UUCP >	resolve uucp names
Ryan Haggerty e50d1d
R$+ . $- ! $+		$@ $>Canonify2 $3 < @ $1 . $2 >		domain uucps
Ryan Haggerty e50d1d
R$+ ! $+		$@ $>Canonify2 $2 < @ $1 .UUCP >	uucp subdomains
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# if we have % signs, take the rightmost one
Ryan Haggerty e50d1d
R$* % $*		$1 @ $2				First make them all @s.
Ryan Haggerty e50d1d
R$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
Ryan Haggerty e50d1d
R$* @ $*		$@ $>Canonify2 $1 < @ $2 >	Insert < > and finish
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# else we must be a local name
Ryan Haggerty e50d1d
R$*			$@ $>Canonify2 $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
################################################
Ryan Haggerty e50d1d
###  Ruleset 96 -- bottom half of ruleset 3  ###
Ryan Haggerty e50d1d
################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SCanonify2=96
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle special cases for local names
Ryan Haggerty e50d1d
R$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
Ryan Haggerty e50d1d
R$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
Ryan Haggerty e50d1d
R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# check for IPv4/IPv6 domain literal
Ryan Haggerty e50d1d
R$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [addr]
Ryan Haggerty e50d1d
R$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
Ryan Haggerty e50d1d
R$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# if really UUCP, handle it immediately
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# try UUCP traffic as a local address
Ryan Haggerty e50d1d
R$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
Ryan Haggerty e50d1d
R$* < @ $+ . . UUCP . > $*	$@ $1 < @ $2 . > $3
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# hostnames ending in class P are always canonical
Ryan Haggerty e50d1d
R$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
Ryan Haggerty e50d1d
R$* < @ $* $~P > $*		$: $&{daemon_flags} $| $1 < @ $2 $3 > $4
Ryan Haggerty e50d1d
R$* CC $* $| $* < @ $+.$+ > $*	$: $3 < @ $4.$5 . > $6
Ryan Haggerty e50d1d
R$* CC $* $| $*			$: $3
Ryan Haggerty e50d1d
# pass to name server to make hostname canonical
Ryan Haggerty e50d1d
R$* $| $* < @ $* > $*		$: $2 < @ $[ $3 $] > $4
Ryan Haggerty e50d1d
R$* $| $*			$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# local host aliases and pseudo-domains are always canonical
Ryan Haggerty e50d1d
R$* < @ $=w > $*		$: $1 < @ $2 . > $3
Ryan Haggerty e50d1d
R$* < @ $=M > $*		$: $1 < @ $2 . > $3
Ryan Haggerty e50d1d
R$* < @ $={VirtHost} > $* 	$: $1 < @ $2 . > $3
Ryan Haggerty e50d1d
R$* < @ $* . . > $*		$1 < @ $2 . > $3
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
##################################################
Ryan Haggerty e50d1d
###  Ruleset 4 -- Final Output Post-rewriting  ###
Ryan Haggerty e50d1d
##################################################
Ryan Haggerty e50d1d
Sfinal=4
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$+ :; <@>		$@ $1 :				handle <list:;>
Ryan Haggerty e50d1d
R$* <@>			$@				handle <> and list:;
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# strip trailing dot off possibly canonical name
Ryan Haggerty e50d1d
R$* < @ $+ . > $*	$1 < @ $2 > $3
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# eliminate internal code
Ryan Haggerty e50d1d
R$* < @ *LOCAL* > $*	$1 < @ $j > $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# externalize local domain info
Ryan Haggerty e50d1d
R$* < $+ > $*		$1 $2 $3			defocus
Ryan Haggerty e50d1d
R@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
Ryan Haggerty e50d1d
R@ $*			$@ @ $1				... and exit
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# UUCP must always be presented in old form
Ryan Haggerty e50d1d
R$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# delete duplicate local names
Ryan Haggerty e50d1d
R$+ % $=w @ $=w		$1 @ $2				u%host@host => u@host
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
##############################################################
Ryan Haggerty e50d1d
###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
Ryan Haggerty e50d1d
###		   (used for recursive calls)		   ###
Ryan Haggerty e50d1d
##############################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SRecurse=97
Ryan Haggerty e50d1d
R$*			$: $>canonify $1
Ryan Haggerty e50d1d
R$*			$@ $>parse $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################
Ryan Haggerty e50d1d
###   Ruleset 0 -- Parse Address   ###
Ryan Haggerty e50d1d
######################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Sparse=0
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$*			$: $>Parse0 $1		initial parsing
Ryan Haggerty e50d1d
R<@>			$#local $: <@>		special case error msgs
Ryan Haggerty e50d1d
R$*			$: $>ParseLocal $1	handle local hacks
Ryan Haggerty e50d1d
R$*			$: $>Parse1 $1		final parsing
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Parse0 -- do initial syntax checking and eliminate local addresses.
Ryan Haggerty e50d1d
#	This should either return with the (possibly modified) input
Ryan Haggerty e50d1d
#	or return with a #error mailer.  It should not return with a
Ryan Haggerty e50d1d
#	#mailer other than the #error mailer.
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SParse0
Ryan Haggerty e50d1d
R<@>			$@ <@>			special case error msgs
Ryan Haggerty e50d1d
R$* : $* ; <@>		$#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
Ryan Haggerty e50d1d
R@ <@ $* >		< @ $1 >		catch "@@host" bogosity
Ryan Haggerty e50d1d
R<@ $+>			$#error $@ 5.1.3 $: "553 User address required"
Ryan Haggerty e50d1d
R$+ <@>			$#error $@ 5.1.3 $: "553 Hostname required"
Ryan Haggerty e50d1d
R$*			$: <> $1
Ryan Haggerty e50d1d
R<> $* < @ [ $* ] : $+ > $*	$1 < @ [ $2 ] : $3 > $4
Ryan Haggerty e50d1d
R<> $* < @ [ $* ] , $+ > $*	$1 < @ [ $2 ] , $3 > $4
Ryan Haggerty e50d1d
R<> $* < @ [ $* ] $+ > $*	$#error $@ 5.1.2 $: "553 Invalid address"
Ryan Haggerty e50d1d
R<> $* < @ [ $+ ] > $*		$1 < @ [ $2 ] > $3
Ryan Haggerty e50d1d
R<> $* <$* : $* > $*	$#error $@ 5.1.3 $: "553 Colon illegal in host name part"
Ryan Haggerty e50d1d
R<> $*			$1
Ryan Haggerty e50d1d
R$* < @ . $* > $*	$#error $@ 5.1.2 $: "553 Invalid host name"
Ryan Haggerty e50d1d
R$* < @ $* .. $* > $*	$#error $@ 5.1.2 $: "553 Invalid host name"
Ryan Haggerty e50d1d
R$* < @ $* @ > $*	$#error $@ 5.1.2 $: "553 Invalid route address"
Ryan Haggerty e50d1d
R$* @ $* < @ $* > $*	$#error $@ 5.1.3 $: "553 Invalid route address"
Ryan Haggerty e50d1d
R$* , $~O $*		$#error $@ 5.1.3 $: "553 Invalid route address"
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# now delete the local info -- note $=O to find characters that cause forwarding
Ryan Haggerty e50d1d
R$* < @ > $*		$@ $>Parse0 $>canonify $1	user@ => user
Ryan Haggerty e50d1d
R< @ $=w . > : $*	$@ $>Parse0 $>canonify $2	@here:... -> ...
Ryan Haggerty e50d1d
R$- < @ $=w . >		$: $(dequote $1 $) < @ $2 . >	dequote "foo"@here
Ryan Haggerty e50d1d
R< @ $+ >		$#error $@ 5.1.3 $: "553 User address required"
Ryan Haggerty e50d1d
R$* $=O $* < @ $=w . >	$@ $>Parse0 $>canonify $1 $2 $3	...@here -> ...
Ryan Haggerty e50d1d
R$- 			$: $(dequote $1 $) < @ *LOCAL* >	dequote "foo"
Ryan Haggerty e50d1d
R< @ *LOCAL* >		$#error $@ 5.1.3 $: "553 User address required"
Ryan Haggerty e50d1d
R$* $=O $* < @ *LOCAL* >
Ryan Haggerty e50d1d
			$@ $>Parse0 $>canonify $1 $2 $3	...@*LOCAL* -> ...
Ryan Haggerty e50d1d
R$* < @ *LOCAL* >	$: $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Parse1 -- the bottom half of ruleset 0.
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SParse1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle numeric address spec
Ryan Haggerty e50d1d
R$* < @ [ $+ ] > $*	$: $>ParseLocal $1 < @ [ $2 ] > $3	numeric internet spec
Ryan Haggerty e50d1d
R$* < @ [ $+ ] > $*	$: $1 < @ [ $2 ] : $S > $3	Add smart host to path
Ryan Haggerty e50d1d
R$* < @ [ $+ ] : > $*		$#esmtp $@ [$2] $: $1 < @ [$2] > $3	no smarthost: send
Ryan Haggerty e50d1d
R$* < @ [ $+ ] : $- : $*> $*	$#$3 $@ $4 $: $1 < @ [$2] > $5	smarthost with mailer
Ryan Haggerty e50d1d
R$* < @ [ $+ ] : $+ > $*	$#esmtp $@ $3 $: $1 < @ [$2] > $4	smarthost without mailer
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle virtual users
Ryan Haggerty e50d1d
R$+			$:  $1		Mark for lookup
Ryan Haggerty e50d1d
R $+ < @ $={VirtHost} . > 	$: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
Ryan Haggerty e50d1d
R $+ < @ $=w . > 	$: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
Ryan Haggerty e50d1d
R<@> $+ + $+ < @ $* . >
Ryan Haggerty e50d1d
			$: < $(virtuser $1 + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
Ryan Haggerty e50d1d
R<@> $+ + $* < @ $* . >
Ryan Haggerty e50d1d
			$: < $(virtuser $1 + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
Ryan Haggerty e50d1d
R<@> $+ + $* < @ $* . >
Ryan Haggerty e50d1d
			$: < $(virtuser $1 @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
Ryan Haggerty e50d1d
R<@> $+ + $+ < @ $+ . >	$: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
Ryan Haggerty e50d1d
R<@> $+ + $* < @ $+ . >	$: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
Ryan Haggerty e50d1d
R<@> $+ + $* < @ $+ . >	$: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . >
Ryan Haggerty e50d1d
R<@> $+ < @ $+ . >	$: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
Ryan Haggerty e50d1d
R<@> $+			$: $1
Ryan Haggerty e50d1d
R $+			$: $1
Ryan Haggerty e50d1d
R< error : $-.$-.$- : $+ > $* 	$#error $@ $1.$2.$3 $: $4
Ryan Haggerty e50d1d
R< error : $- $+ > $* 	$#error $@ $(dequote $1 $) $: $2
Ryan Haggerty e50d1d
R< $+ > $+ < @ $+ >	$: $>Recurse $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# short circuit local delivery so forwarded email works
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$=L < @ $=w . >	$#local $: @ $1			special local names
Ryan Haggerty e50d1d
R$+ < @ $=w . >		$#local $: $1			regular local name
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# not local -- try mailer table lookup
Ryan Haggerty e50d1d
R$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
Ryan Haggerty e50d1d
R< $+ . > $*		$: < $1 > $2			strip trailing dot
Ryan Haggerty e50d1d
R< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
Ryan Haggerty e50d1d
R< $~[ : $* > $* 	$>MailerToTriple < $1 : $2 > $3		check -- resolved?
Ryan Haggerty e50d1d
R< $+ > $*		$: $>Mailertable <$1> $2		try domain
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# resolve remotely connected UUCP links (if any)
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# resolve fake top level domains by forwarding to other hosts
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# pass names that still have a host to a smarthost (if defined)
Ryan Haggerty e50d1d
R$* < @ $* > $*		$: $>MailerToTriple < $S > $1 < @ $2 > $3	glue on smarthost name
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# deal with other remote names
Ryan Haggerty e50d1d
R$* < @$* > $*		$#esmtp $@ $2 $: $1 < @ $2 > $3	user@host.domain
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle locally delivered names
Ryan Haggerty e50d1d
R$=L			$#local $: @ $1		special local names
Ryan Haggerty e50d1d
R$+			$#local $: $1			regular local names
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###########################################################################
Ryan Haggerty e50d1d
###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
Ryan Haggerty e50d1d
###########################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SLocal_localaddr
Ryan Haggerty e50d1d
Slocaladdr=5
Ryan Haggerty e50d1d
R$+			$: $1 $| $>"Local_localaddr" $1
Ryan Haggerty e50d1d
R$+ $| $#ok		$@ $1			no change
Ryan Haggerty e50d1d
R$+ $| $#$*		$#$2
Ryan Haggerty e50d1d
R$+ $| $*		$: $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# deal with plussed users so aliases work nicely
Ryan Haggerty e50d1d
R$+ + *			$#local $@ $&h $: $1
Ryan Haggerty e50d1d
R$+ + $*		$#local $@ + $2 $: $1 + *
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# prepend an empty "forward host" on the front
Ryan Haggerty e50d1d
R$+			$: <> $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R< > $+			$: < > < $1 <> $&h >		nope, restore +detail
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R< > < $+ <> + $* >	$: < > < $1 + $2 >		check whether +detail
Ryan Haggerty e50d1d
R< > < $+ <> $* >	$: < > < $1 >			else discard
Ryan Haggerty e50d1d
R< > < $+ + $* > $*	   < > < $1 > + $2 $3		find the user part
Ryan Haggerty e50d1d
R< > < $+ > + $*	$#local $@ $2 $: @ $1		strip the extra +
Ryan Haggerty e50d1d
R< > < $+ >		$@ $1				no +detail
Ryan Haggerty e50d1d
R$+			$: $1 <> $&h			add +detail back in
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$+ <> + $*		$: $1 + $2			check whether +detail
Ryan Haggerty e50d1d
R$+ <> $*		$: $1				else discard
Ryan Haggerty e50d1d
R< local : $* > $*	$: $>MailerToTriple < local : $1 > $2	no host extension
Ryan Haggerty e50d1d
R< error : $* > $*	$: $>MailerToTriple < error : $1 > $2	no host extension
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R< $~[ : $+ > $+	$: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R< $+ > $+		$@ $>MailerToTriple < $1 > $2 < @ $1 >
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
###  Ruleset 90 -- try domain part of mailertable entry 	###
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SMailertable=90
Ryan Haggerty e50d1d
R$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
Ryan Haggerty e50d1d
R$* <$~[ : $* > $*	$>MailerToTriple < $2 : $3 > $4		check -- resolved?
Ryan Haggerty e50d1d
R$* < . $+ > $* 	$@ $>Mailertable $1 . <$2> $3		no -- strip & try again
Ryan Haggerty e50d1d
R$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
Ryan Haggerty e50d1d
R< $~[ : $* > $*	$>MailerToTriple < $1 : $2 > $3		"." found?
Ryan Haggerty e50d1d
R< $* > $*		$@ $2				no mailertable match
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
###  Ruleset 95 -- canonify mailer:[user@]host syntax to triple	###
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SMailerToTriple=95
Ryan Haggerty e50d1d
R< > $*				$@ $1			strip off null relay
Ryan Haggerty e50d1d
R< error : $-.$-.$- : $+ > $* 	$#error $@ $1.$2.$3 $: $4
Ryan Haggerty e50d1d
R< error : $- : $+ > $*		$#error $@ $(dequote $1 $) $: $2
Ryan Haggerty e50d1d
R< error : $+ > $*		$#error $: $1
Ryan Haggerty e50d1d
R< local : $* > $*		$>CanonLocal < $1 > $2
Ryan Haggerty e50d1d
R< $~[ : $+ @ $+ > $*<$*>$*	$# $1 $@ $3 $: $2<@$3>	use literal user
Ryan Haggerty e50d1d
R< $~[ : $+ > $*		$# $1 $@ $2 $: $3	try qualified mailer
Ryan Haggerty e50d1d
R< $=w > $*			$@ $2			delete local host
Ryan Haggerty e50d1d
R< $+ > $*			$#relay $@ $1 $: $2	use unqualified mailer
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
###  Ruleset CanonLocal -- canonify local: syntax		###
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SCanonLocal
Ryan Haggerty e50d1d
# strip local host from routed addresses
Ryan Haggerty e50d1d
R< $* > < @ $+ > : $+		$@ $>Recurse $3
Ryan Haggerty e50d1d
R< $* > $+ $=O $+ < @ $+ >	$@ $>Recurse $2 $3 $4
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# strip trailing dot from any host name that may appear
Ryan Haggerty e50d1d
R< $* > $* < @ $* . >		$: < $1 > $2 < @ $3 >
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle local: syntax -- use old user, either with or without host
Ryan Haggerty e50d1d
R< > $* < @ $* > $*		$#local $@ $1@$2 $: $1
Ryan Haggerty e50d1d
R< > $+				$#local $@ $1    $: $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle local:user@host syntax -- ignore host part
Ryan Haggerty e50d1d
R< $+ @ $+ > $* < @ $* >	$: < $1 > $3 < @ $4 >
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle local:user syntax
Ryan Haggerty e50d1d
R< $+ > $* <@ $* > $*		$#local $@ $2@$3 $: $1
Ryan Haggerty e50d1d
R< $+ > $* 			$#local $@ $2    $: $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
###  Ruleset 93 -- convert header names to masqueraded form	###
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SMasqHdr=93
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# do not masquerade anything in class N
Ryan Haggerty e50d1d
R$* < @ $* $=N . >	$@ $1 < @ $2 $3 . >
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$* < @ *LOCAL* >	$@ $1 < @ $j . >
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
###  Ruleset 94 -- convert envelope names to masqueraded form	###
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SMasqEnv=94
Ryan Haggerty e50d1d
R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
###  Ruleset 98 -- local part of ruleset zero (can be null)	###
Ryan Haggerty e50d1d
###################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SParseLocal=98
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# addresses sent to foo@host.REDIRECT will give a 551 error code
Ryan Haggerty e50d1d
R$* < @ $+ .REDIRECT. >		$: $1 < @ $2 . REDIRECT . > < ${opMode} >
Ryan Haggerty e50d1d
R$* < @ $+ .REDIRECT. > 	$: $1 < @ $2 . REDIRECT. >
Ryan Haggerty e50d1d
R$* < @ $+ .REDIRECT. > < $- >	$#error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  D: LookUpDomain -- search for domain in access database
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		<$1> -- key (domain name)
Ryan Haggerty e50d1d
###		<$2> -- default (what to return if not found in db)
Ryan Haggerty e50d1d
###		<$3> -- mark (must be <(!|+) single-token>)
Ryan Haggerty e50d1d
###			! does lookup only with tag
Ryan Haggerty e50d1d
###			+ does lookup with and without tag
Ryan Haggerty e50d1d
###		<$4> -- passthru (additional data passed unchanged through)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SD
Ryan Haggerty e50d1d
R<$*> <$+> <$- $-> <$*>		$: < $(access $4:$1 $: ? $) > <$1> <$2> <$3 $4> <$5>
Ryan Haggerty e50d1d
R <$+> <$+> <+ $-> <$*>	$: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4>
Ryan Haggerty e50d1d
R <[$+.$-]> <$+> <$- $-> <$*>	$@ $>D <[$1]> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <[$+::$-]> <$+> <$- $-> <$*>	$: $>D <[$1]> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <[$+:$-]> <$+> <$- $-> <$*>	$: $>D <[$1]> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+.$+> <$+> <$- $-> <$*>	$@ $>D <$2> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+> <$+> <$- $-> <$*>	$@ <$2> <$5>
Ryan Haggerty e50d1d
R<$* <TMPF>> <$+> <$+> <$- $-> <$*>	$@ <<TMPF>> <$6>
Ryan Haggerty e50d1d
R<$*> <$+> <$+> <$- $-> <$*>	$@ <$1> <$6>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  A: LookUpAddress -- search for host address in access database
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		<$1> -- key (dot quadded host address)
Ryan Haggerty e50d1d
###		<$2> -- default (what to return if not found in db)
Ryan Haggerty e50d1d
###		<$3> -- mark (must be <(!|+) single-token>)
Ryan Haggerty e50d1d
###			! does lookup only with tag
Ryan Haggerty e50d1d
###			+ does lookup with and without tag
Ryan Haggerty e50d1d
###		<$4> -- passthru (additional data passed through)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SA
Ryan Haggerty e50d1d
R<$+> <$+> <$- $-> <$*>		$: < $(access $4:$1 $: ? $) > <$1> <$2> <$3 $4> <$5>
Ryan Haggerty e50d1d
R <$+> <$+> <+ $-> <$*>	$: < $(access $1 $: ? $) > <$1> <$2> <+ $3> <$4>
Ryan Haggerty e50d1d
R <$+::$-> <$+> <$- $-> <$*>		$@ $>A <$1> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+:$-> <$+> <$- $-> <$*>		$@ $>A <$1> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+.$-> <$+> <$- $-> <$*>		$@ $>A <$1> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+> <$+> <$- $-> <$*>	$@ <$2> <$5>
Ryan Haggerty e50d1d
R<$* <TMPF>> <$+> <$+> <$- $-> <$*>	$@ <<TMPF>> <$6>
Ryan Haggerty e50d1d
R<$*> <$+> <$+> <$- $-> <$*>	$@ <$1> <$6>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  CanonAddr --	Convert an address into a standard form for
Ryan Haggerty e50d1d
###			relay checking.  Route address syntax is
Ryan Haggerty e50d1d
###			crudely converted into a %-hack address.
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		$1 -- full recipient address
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Returns:
Ryan Haggerty e50d1d
###		parsed address, not in source route form
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SCanonAddr
Ryan Haggerty e50d1d
R$*			$: $>Parse0 $>canonify $1	make domain canonical
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  ParseRecipient --	Strip off hosts in $=R as well as possibly
Ryan Haggerty e50d1d
###			$* $=m or the access database.
Ryan Haggerty e50d1d
###			Check user portion for host separators.
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		$1 -- full recipient address
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Returns:
Ryan Haggerty e50d1d
###		parsed, non-local-relaying address
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SParseRecipient
Ryan Haggerty e50d1d
R$*				$:  $>CanonAddr $1
Ryan Haggerty e50d1d
R $* < @ $* . >		 $1 < @ $2 >			strip trailing dots
Ryan Haggerty e50d1d
R $- < @ $* >		$:  $(dequote $1 $) < @ $2 >	dequote local part
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# if no $=O character, no host in the user portion, we are done
Ryan Haggerty e50d1d
R $* $=O $* < @ $* >		$: <NO> $1 $2 $3 < @ $4>
Ryan Haggerty e50d1d
R $*				$@ $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R<NO> $* < @ $* $=R >		$: <RELAY> $1 < @ $2 $3 >
Ryan Haggerty e50d1d
R<NO> $* < @ $+ >		$: $>D <$2> <NO> <+ To> <$1 < @ $2 >>
Ryan Haggerty e50d1d
R<$+> <$+>			$: <$1> $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R<RELAY> $* < @ $* >		$@ $>ParseRecipient $1
Ryan Haggerty e50d1d
R<$+> $*			$@ $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  check_relay -- check hostname/address on SMTP startup
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SLocal_check_relay
Ryan Haggerty e50d1d
Scheck_relay
Ryan Haggerty e50d1d
R$*			$: $1 $| $>"Local_check_relay" $1
Ryan Haggerty e50d1d
R$* $| $* $| $#$*	$#$3
Ryan Haggerty e50d1d
R$* $| $* $| $*		$@ $>"Basic_check_relay" $1 $| $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SBasic_check_relay
Ryan Haggerty e50d1d
# check for deferred delivery mode
Ryan Haggerty e50d1d
R$*			$: < $&{deliveryMode} > $1
Ryan Haggerty e50d1d
R< d > $*		$@ deferred
Ryan Haggerty e50d1d
R< $* > $*		$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$+ $| $+		$: $>D < $1 >  <+ Connect> < $2 >
Ryan Haggerty e50d1d
R   $| $+		$: $>A < $1 >  <+ Connect> <>	empty client_name
Ryan Haggerty e50d1d
R <$+>		$: $>A < $1 >  <+ Connect> <>	no: another lookup
Ryan Haggerty e50d1d
R <$*>		$: OK				found nothing
Ryan Haggerty e50d1d
R<$={Accept}> <$*>	$@ $1				return value of lookup
Ryan Haggerty e50d1d
R<REJECT> <$*>		$#error $@ 5.7.1 $: "550 Access denied"
Ryan Haggerty e50d1d
R<DISCARD> <$*>		$#discard $: discard
Ryan Haggerty e50d1d
R<QUARANTINE:$+> <$*>	$#error $@ quarantine $: $1
Ryan Haggerty e50d1d
R<ERROR:$-.$-.$-:$+> <$*>	$#error $@ $1.$2.$3 $: $4
Ryan Haggerty e50d1d
R<ERROR:$+> <$*>		$#error $: $1
Ryan Haggerty e50d1d
R<$* <TMPF>> <$*>		$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<$+> <$*>		$#error $: $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  check_mail -- check SMTP `MAIL FROM:' command argument
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SLocal_check_mail
Ryan Haggerty e50d1d
Scheck_mail
Ryan Haggerty e50d1d
R$*			$: $1 $| $>"Local_check_mail" $1
Ryan Haggerty e50d1d
R$* $| $#$*		$#$2
Ryan Haggerty e50d1d
R$* $| $*		$@ $>"Basic_check_mail" $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SBasic_check_mail
Ryan Haggerty e50d1d
# check for deferred delivery mode
Ryan Haggerty e50d1d
R$*			$: < $&{deliveryMode} > $1
Ryan Haggerty e50d1d
R< d > $*		$@ deferred
Ryan Haggerty e50d1d
R< $* > $*		$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# authenticated?
Ryan Haggerty e50d1d
R$*			$: $1 $| $>"tls_client" $&{verify} $| MAIL
Ryan Haggerty e50d1d
R$* $| $#$+		$#$2
Ryan Haggerty e50d1d
R$* $| $*		$: $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R<>			$@ <OK>			we MUST accept <> (RFC 1123)
Ryan Haggerty e50d1d
R$+			$:  $1
Ryan Haggerty e50d1d
R<$+>		$: <@> <$1>
Ryan Haggerty e50d1d
R$+			$: <@> <$1>
Ryan Haggerty e50d1d
R$*			$: $&{daemon_flags} $| $1
Ryan Haggerty e50d1d
R$* f $* $| <@> < $* @ $- >	$: < ? $&{client_name} > < $3 @ $4 >
Ryan Haggerty e50d1d
R$* u $* $| <@> < $* >	$:  < $3 >
Ryan Haggerty e50d1d
R$* $| $*		$: $2
Ryan Haggerty e50d1d
# handle case of @localhost on address
Ryan Haggerty e50d1d
R<@> < $* @ localhost >	$: < ? $&{client_name} > < $1 @ localhost >
Ryan Haggerty e50d1d
R<@> < $* @ [127.0.0.1] >
Ryan Haggerty e50d1d
			$: < ? $&{client_name} > < $1 @ [127.0.0.1] >
Ryan Haggerty e50d1d
R<@> < $* @ localhost.$m >
Ryan Haggerty e50d1d
			$: < ? $&{client_name} > < $1 @ localhost.$m >
Ryan Haggerty e50d1d
R<@> < $* @ localhost.UUCP >
Ryan Haggerty e50d1d
			$: < ? $&{client_name} > < $1 @ localhost.UUCP >
Ryan Haggerty e50d1d
R<@> $*			$: $1			no localhost as domain
Ryan Haggerty e50d1d
R $*		$: $2			local client: ok
Ryan Haggerty e50d1d
R <$+>		$#error $@ 5.5.4 $: "553 Real domain name required for sender address"
Ryan Haggerty e50d1d
R $*			$: $1
Ryan Haggerty e50d1d
R$*			$:  $>CanonAddr $1		canonify sender address and mark it
Ryan Haggerty e50d1d
R $* < @ $+ . >	 $1 < @ $2 >			strip trailing dots
Ryan Haggerty e50d1d
# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
Ryan Haggerty e50d1d
R $* < @ $* $=P >	$: <OKR> $1 < @ $2 $3 >
Ryan Haggerty e50d1d
R $* < @ $j >	$: <OKR> $1 < @ $j >
Ryan Haggerty e50d1d
R $* < @ $+ >	$: <OKR> $1 < @ $2 >		... unresolvable OK
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# check sender address: user@address, user@, address
Ryan Haggerty e50d1d
R<$+> $+ < @ $* >	$: @<$1> <$2 < @ $3 >> $| <F:$2@$3> <U:$2@> <D:$3>
Ryan Haggerty e50d1d
R<$+> $+		$: @<$1> <$2> $| <U:$2@>
Ryan Haggerty e50d1d
R@ <$+> <$*> $| <$+>	$: <@> <$1> <$2> $| $>SearchList <+ From> $| <$3> <>
Ryan Haggerty e50d1d
R<@> <$+> <$*> $| <$*>	$: <$3> <$1> <$2>		reverse result
Ryan Haggerty e50d1d
# retransform for further use
Ryan Haggerty e50d1d
R <$+> <$*>		$: <$1> $2	no match
Ryan Haggerty e50d1d
R<$+> <$+> <$*>		$: <$1> $3	relevant result, keep it
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# handle case of no @domain on address
Ryan Haggerty e50d1d
R $*			$: $&{daemon_flags} $|  $1
Ryan Haggerty e50d1d
R$* u $* $|  $*	$: <OKR> $3
Ryan Haggerty e50d1d
R$* $| $*		$: $2
Ryan Haggerty e50d1d
R $*			$: < ? $&{client_addr} > $1
Ryan Haggerty e50d1d
R $*			$@ <OKR>			...local unqualed ok
Ryan Haggerty e50d1d
R $*		$#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
Ryan Haggerty e50d1d
							...remote is not
Ryan Haggerty e50d1d
# check results
Ryan Haggerty e50d1d
R $*			$: @ $1		mark address: nothing known about it
Ryan Haggerty e50d1d
R<$={ResOk}> $*		$@ <OKR>	domain ok: stop
Ryan Haggerty e50d1d
R<TEMP> $*		$#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
Ryan Haggerty e50d1d
R<PERM> $*		$#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
Ryan Haggerty e50d1d
R<$={Accept}> $*	$# $1		accept from access map
Ryan Haggerty e50d1d
R<DISCARD> $*		$#discard $: discard
Ryan Haggerty e50d1d
R<QUARANTINE:$+> $*	$#error $@ quarantine $: $1
Ryan Haggerty e50d1d
R<REJECT> $*		$#error $@ 5.7.1 $: "550 Access denied"
Ryan Haggerty e50d1d
R<ERROR:$-.$-.$-:$+> $*		$#error $@ $1.$2.$3 $: $4
Ryan Haggerty e50d1d
R<ERROR:$+> $*		$#error $: $1
Ryan Haggerty e50d1d
R<<TMPF>> $*		$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<$+> $*		$#error $: $1		error from access db
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  check_rcpt -- check SMTP `RCPT TO:' command argument
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SLocal_check_rcpt
Ryan Haggerty e50d1d
Scheck_rcpt
Ryan Haggerty e50d1d
R$*			$: $1 $| $>"Local_check_rcpt" $1
Ryan Haggerty e50d1d
R$* $| $#$*		$#$2
Ryan Haggerty e50d1d
R$* $| $*		$@ $>"Basic_check_rcpt" $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SBasic_check_rcpt
Ryan Haggerty e50d1d
# empty address?
Ryan Haggerty e50d1d
R<>			$#error $@ nouser $: "553 User address required"
Ryan Haggerty e50d1d
R$@			$#error $@ nouser $: "553 User address required"
Ryan Haggerty e50d1d
# check for deferred delivery mode
Ryan Haggerty e50d1d
R$*			$: < $&{deliveryMode} > $1
Ryan Haggerty e50d1d
R< d > $*		$@ deferred
Ryan Haggerty e50d1d
R< $* > $*		$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
R$*			$: $1 $| @ $>"Rcpt_ok" $1
Ryan Haggerty e50d1d
R$* $| @ $#TEMP $+	$: $1 $| T $2
Ryan Haggerty e50d1d
R$* $| @ $#$*		$#$2
Ryan Haggerty e50d1d
R$* $| @ RELAY		$@ RELAY
Ryan Haggerty e50d1d
R$* $| @ $*		$: O $| $>"Relay_ok" $1
Ryan Haggerty e50d1d
R$* $| T $+		$: T $2 $| $>"Relay_ok" $1
Ryan Haggerty e50d1d
R$* $| $#TEMP $+	$#error $2
Ryan Haggerty e50d1d
R$* $| $#$*		$#$2
Ryan Haggerty e50d1d
R$* $| RELAY		$@ RELAY
Ryan Haggerty e50d1d
R T $+ $| $*		$#error $1
Ryan Haggerty e50d1d
# anything else is bogus
Ryan Haggerty e50d1d
R$*			$#error $@ 5.7.1 $: "550 Relaying denied"
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
### Rcpt_ok: is the recipient ok?
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
SRcpt_ok
Ryan Haggerty e50d1d
R$*			$: $>ParseRecipient $1		strip relayable hosts
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# blacklist local users or any host from receiving mail
Ryan Haggerty e50d1d
R$*			$:  $1
Ryan Haggerty e50d1d
R $+ < @ $=w >	$: <> <$1 < @ $2 >> $| <F:$1@$2> <U:$1@> <D:$2>
Ryan Haggerty e50d1d
R $+ < @ $* >	$: <> <$1 < @ $2 >> $| <F:$1@$2> <D:$2>
Ryan Haggerty e50d1d
R $+			$: <> <$1> $| <U:$1@>
Ryan Haggerty e50d1d
R<> <$*> $| <$+>	$: <@> <$1> $| $>SearchList <+ To> $| <$2> <>
Ryan Haggerty e50d1d
R<@> <$*> $| <$*>	$: <$2> <$1>		reverse result
Ryan Haggerty e50d1d
R <$*>		$: @ $1		mark address as no match
Ryan Haggerty e50d1d
R<$={Accept}> <$*>	$: @ $2		mark address as no match
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R<REJECT> $*		$#error $@ 5.2.1 $: "550 Mailbox disabled for this recipient"
Ryan Haggerty e50d1d
R<DISCARD> $*		$#discard $: discard
Ryan Haggerty e50d1d
R<QUARANTINE:$+> $*	$#error $@ quarantine $: $1
Ryan Haggerty e50d1d
R<ERROR:$-.$-.$-:$+> $*		$#error $@ $1.$2.$3 $: $4
Ryan Haggerty e50d1d
R<ERROR:$+> $*		$#error $: $1
Ryan Haggerty e50d1d
R<<TMPF>> $*		$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<$+> $*		$#error $: $1		error from access db
Ryan Haggerty e50d1d
R@ $*			$1		remove mark
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# authenticated via TLS?
Ryan Haggerty e50d1d
R$*			$: $1 $| $>RelayTLS	client authenticated?
Ryan Haggerty e50d1d
R$* $| $# $+		$# $2			error/ok?
Ryan Haggerty e50d1d
R$* $| $*		$: $1			no
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$*			$: $1 $| $>"Local_Relay_Auth" $&{auth_type}
Ryan Haggerty e50d1d
R$* $| $# $*		$# $2
Ryan Haggerty e50d1d
R$* $| NO		$: $1
Ryan Haggerty e50d1d
R$* $| $*		$: $1 $| $&{auth_type}
Ryan Haggerty e50d1d
R$* $|			$: $1
Ryan Haggerty e50d1d
R$* $| $={TrustAuthMech}	$# RELAY
Ryan Haggerty e50d1d
R$* $| $*		$: $1
Ryan Haggerty e50d1d
# anything terminating locally is ok
Ryan Haggerty e50d1d
R$+ < @ $=w >		$@ RELAY
Ryan Haggerty e50d1d
R$+ < @ $* $=R >	$@ RELAY
Ryan Haggerty e50d1d
R$+ < @ $+ >		$: $>D <$2>  <+ To> <$1 < @ $2 >>
Ryan Haggerty e50d1d
R<RELAY> $*		$@ RELAY
Ryan Haggerty e50d1d
R<$* <TMPF>> $*		$#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<$*> <$*>		$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# check for local user (i.e. unqualified address)
Ryan Haggerty e50d1d
R$*			$:  $1
Ryan Haggerty e50d1d
R $* < @ $+ >	$: <REMOTE> $1 < @ $2 >
Ryan Haggerty e50d1d
# local user is ok
Ryan Haggerty e50d1d
R $+			$@ RELAY
Ryan Haggerty e50d1d
R<$+> $*		$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
### Relay_ok: is the relay/sender ok?
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
SRelay_ok
Ryan Haggerty e50d1d
# anything originating locally is ok
Ryan Haggerty e50d1d
# check IP address
Ryan Haggerty e50d1d
R$*			$: $&{client_addr}
Ryan Haggerty e50d1d
R$@			$@ RELAY		originated locally
Ryan Haggerty e50d1d
R0			$@ RELAY		originated locally
Ryan Haggerty e50d1d
R127.0.0.1		$@ RELAY		originated locally
Ryan Haggerty e50d1d
RIPv6:::1		$@ RELAY		originated locally
Ryan Haggerty e50d1d
R$=R $*			$@ RELAY		relayable IP address
Ryan Haggerty e50d1d
R$*			$: $>A <$1>  <+ Connect> <$1>
Ryan Haggerty e50d1d
R<RELAY> $* 		$@ RELAY		relayable IP address
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R<<TMPF>> $*		$#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<$*> <$*>		$: $2
Ryan Haggerty e50d1d
R$*			$: [ $1 ]		put brackets around it...
Ryan Haggerty e50d1d
R$=w			$@ RELAY		... and see if it is local
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# check client name: first: did it resolve?
Ryan Haggerty e50d1d
R$*			$: < $&{client_resolve} >
Ryan Haggerty e50d1d
R<TEMP>			$#TEMP $@ 4.4.0 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
Ryan Haggerty e50d1d
R<FORGED>		$#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
Ryan Haggerty e50d1d
R<FAIL>			$#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
Ryan Haggerty e50d1d
R$*			$: <@> $&{client_name}
Ryan Haggerty e50d1d
# pass to name server to make hostname canonical
Ryan Haggerty e50d1d
R<@> $* $=P 		$:  $1 $2
Ryan Haggerty e50d1d
R<@> $+			$:  $[ $1 $]
Ryan Haggerty e50d1d
R$* .			$1			strip trailing dots
Ryan Haggerty e50d1d
R $=w		$@ RELAY
Ryan Haggerty e50d1d
R $* $=R			$@ RELAY
Ryan Haggerty e50d1d
R $*			$: $>D <$1>  <+ Connect> <$1>
Ryan Haggerty e50d1d
R<RELAY> $*		$@ RELAY
Ryan Haggerty e50d1d
R<$* <TMPF>> $*		$#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<$*> <$*>		$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  F: LookUpFull -- search for an entry in access database
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	lookup of full key (which should be an address) and
Ryan Haggerty e50d1d
###	variations if +detail exists: +* and without +detail
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		<$1> -- key
Ryan Haggerty e50d1d
###		<$2> -- default (what to return if not found in db)
Ryan Haggerty e50d1d
###		<$3> -- mark (must be <(!|+) single-token>)
Ryan Haggerty e50d1d
###			! does lookup only with tag
Ryan Haggerty e50d1d
###			+ does lookup with and without tag
Ryan Haggerty e50d1d
###		<$4> -- passthru (additional data passed unchanged through)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SF
Ryan Haggerty e50d1d
R<$+> <$*> <$- $-> <$*>		$: <$(access $4:$1 $: ? $)> <$1> <$2> <$3 $4> <$5>
Ryan Haggerty e50d1d
R <$+> <$*> <+ $-> <$*>	$: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4>
Ryan Haggerty e50d1d
R <$+ + $* @ $+> <$*> <$- $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $6:$1+*@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7>
Ryan Haggerty e50d1d
R <$+ + $* @ $+> <$*> <+ $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $1+*@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6>
Ryan Haggerty e50d1d
R <$+ + $* @ $+> <$*> <$- $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $6:$1@$3 $: ? $)> <$1+$2@$3> <$4> <$5 $6> <$7>
Ryan Haggerty e50d1d
R <$+ + $* @ $+> <$*> <+ $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $1@$3 $: ? $)> <$1+$2@$3> <$4> <+ $5> <$6>
Ryan Haggerty e50d1d
R <$+> <$*> <$- $-> <$*>	$@ <$2> <$5>
Ryan Haggerty e50d1d
R<$+ <TMPF>> <$*> <$- $-> <$*>	$@ <<TMPF>> <$5>
Ryan Haggerty e50d1d
R<$+> <$*> <$- $-> <$*>		$@ <$1> <$5>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  E: LookUpExact -- search for an entry in access database
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		<$1> -- key
Ryan Haggerty e50d1d
###		<$2> -- default (what to return if not found in db)
Ryan Haggerty e50d1d
###		<$3> -- mark (must be <(!|+) single-token>)
Ryan Haggerty e50d1d
###			! does lookup only with tag
Ryan Haggerty e50d1d
###			+ does lookup with and without tag
Ryan Haggerty e50d1d
###		<$4> -- passthru (additional data passed unchanged through)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SE
Ryan Haggerty e50d1d
R<$*> <$*> <$- $-> <$*>		$: <$(access $4:$1 $: ? $)> <$1> <$2> <$3 $4> <$5>
Ryan Haggerty e50d1d
R <$+> <$*> <+ $-> <$*>	$: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4>
Ryan Haggerty e50d1d
R <$+> <$*> <$- $-> <$*>	$@ <$2> <$5>
Ryan Haggerty e50d1d
R<$+ <TMPF>> <$*> <$- $-> <$*>	$@ <<TMPF>> <$5>
Ryan Haggerty e50d1d
R<$+> <$*> <$- $-> <$*>		$@ <$1> <$5>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  U: LookUpUser -- search for an entry in access database
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	lookup of key (which should be a local part) and
Ryan Haggerty e50d1d
###	variations if +detail exists: +* and without +detail
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		<$1> -- key (user@)
Ryan Haggerty e50d1d
###		<$2> -- default (what to return if not found in db)
Ryan Haggerty e50d1d
###		<$3> -- mark (must be <(!|+) single-token>)
Ryan Haggerty e50d1d
###			! does lookup only with tag
Ryan Haggerty e50d1d
###			+ does lookup with and without tag
Ryan Haggerty e50d1d
###		<$4> -- passthru (additional data passed unchanged through)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SU
Ryan Haggerty e50d1d
R<$+> <$*> <$- $-> <$*>		$: <$(access $4:$1 $: ? $)> <$1> <$2> <$3 $4> <$5>
Ryan Haggerty e50d1d
R <$+> <$*> <+ $-> <$*>	$: <$(access $1 $: ? $)> <$1> <$2> <+ $3> <$4>
Ryan Haggerty e50d1d
R <$+ + $* @> <$*> <$- $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $5:$1+*@ $: ? $)> <$1+$2@> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+ + $* @> <$*> <+ $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $1+*@ $: ? $)> <$1+$2@> <$3> <+ $4> <$5>
Ryan Haggerty e50d1d
R <$+ + $* @> <$*> <$- $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $5:$1@ $: ? $)> <$1+$2@> <$3> <$4 $5> <$6>
Ryan Haggerty e50d1d
R <$+ + $* @> <$*> <+ $-> <$*>
Ryan Haggerty e50d1d
			$: <$(access $1@ $: ? $)> <$1+$2@> <$3> <+ $4> <$5>
Ryan Haggerty e50d1d
R <$+> <$*> <$- $-> <$*>	$@ <$2> <$5>
Ryan Haggerty e50d1d
R<$+ <TMPF>> <$*> <$- $-> <$*>	$@ <<TMPF>> <$5>
Ryan Haggerty e50d1d
R<$+> <$*> <$- $-> <$*>		$@ <$1> <$5>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  SearchList: search a list of items in the access map
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		<exact tag> $| <mark:address> <mark:address> ... <>
Ryan Haggerty e50d1d
###	where "exact" is either "+" or "!":
Ryan Haggerty e50d1d
###	<+ TAG>	lookup with and w/o tag
Ryan Haggerty e50d1d
###		lookup with tag
Ryan Haggerty e50d1d
###	possible values for "mark" are:
Ryan Haggerty e50d1d
###		D: recursive host lookup (LookUpDomain)
Ryan Haggerty e50d1d
###		E: exact lookup, no modifications
Ryan Haggerty e50d1d
###		F: full lookup, try user+ext@domain and user@domain
Ryan Haggerty e50d1d
###		U: user lookup, try user+ext and user (input must have trailing @)
Ryan Haggerty e50d1d
###	return: <RHS of lookup> or  (not found)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# class with valid marks for SearchList
Ryan Haggerty e50d1d
C{Src}E F D U 
Ryan Haggerty e50d1d
SSearchList
Ryan Haggerty e50d1d
# just call the ruleset with the name of the tag... nice trick...
Ryan Haggerty e50d1d
R<$+> $| <$={Src}:$*> <$*>	$: <$1> $| <$4> $| $>$2 <$3>  <$1> <>
Ryan Haggerty e50d1d
R<$+> $| <> $|  <>		$@ 
Ryan Haggerty e50d1d
R<$+> $| <$+> $|  <>		$@ $>SearchList <$1> $| <$2>
Ryan Haggerty e50d1d
R<$+> $| <$*> $| <$+> <>	$@ <$3>
Ryan Haggerty e50d1d
R<$+> $| <$+>			$@ <$2>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  trust_auth: is user trusted to authenticate as someone else?
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		$1: AUTH= parameter from MAIL command
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
SLocal_trust_auth
Ryan Haggerty e50d1d
Strust_auth
Ryan Haggerty e50d1d
R$*			$: $&{auth_type} $| $1
Ryan Haggerty e50d1d
# required by RFC 2554 section 4.
Ryan Haggerty e50d1d
R$@ $| $*		$#error $@ 5.7.1 $: "550 not authenticated"
Ryan Haggerty e50d1d
R$* $| $&{auth_authen}		$@ identical
Ryan Haggerty e50d1d
R$* $| <$&{auth_authen}>	$@ identical
Ryan Haggerty e50d1d
R$* $| $*		$: $1 $| $>"Local_trust_auth" $2
Ryan Haggerty e50d1d
R$* $| $#$*		$#$2
Ryan Haggerty e50d1d
R$*			$#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  Relay_Auth: allow relaying based on authentication?
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		$1: ${auth_type}
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
SLocal_Relay_Auth
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  srv_features: which features to offer to a client?
Ryan Haggerty e50d1d
###	(done in server)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ssrv_features
Ryan Haggerty e50d1d
R$*		$: $>D <$&{client_name}>   <>
Ryan Haggerty e50d1d
R$*		$: $>A <$&{client_addr}>   <>
Ryan Haggerty e50d1d
R$*		$: <$(access "Srv_Features": $: ? $)>
Ryan Haggerty e50d1d
R$*		$@ OK
Ryan Haggerty e50d1d
R<$* <TMPF>>$*	$#temp
Ryan Haggerty e50d1d
R<$+>$*		$# $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  try_tls: try to use STARTTLS?
Ryan Haggerty e50d1d
###	(done in client)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Stry_tls
Ryan Haggerty e50d1d
R$*		$: $>D <$&{server_name}>   <>
Ryan Haggerty e50d1d
R$*		$: $>A <$&{server_addr}>   <>
Ryan Haggerty e50d1d
R$*		$: <$(access "Try_TLS": $: ? $)>
Ryan Haggerty e50d1d
R$*		$@ OK
Ryan Haggerty e50d1d
R<$* <TMPF>>$*	$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R<NO>$*		$#error $@ 5.7.1 $: "550 do not try TLS with " $&{server_name} " ["$&{server_addr}"]"
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  tls_rcpt: is connection with server "good" enough?
Ryan Haggerty e50d1d
###	(done in client, per recipient)
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		$1: recipient
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Stls_rcpt
Ryan Haggerty e50d1d
R$*			$: $(macro {TLS_Name} $@ $&{server_name} $) $1
Ryan Haggerty e50d1d
R$+			$:  $>CanonAddr $1
Ryan Haggerty e50d1d
R $+ < @ $+ . >	 $1 <@ $2 >
Ryan Haggerty e50d1d
R $+ < @ $+ >	$: $1 <@ $2 > $| <F:$1@$2> <U:$1@> <D:$2> <E:>
Ryan Haggerty e50d1d
R $+			$: $1 $| <U:$1@> <E:>
Ryan Haggerty e50d1d
R$* $| $+	$: $1 $| $>SearchList  $| $2 <>
Ryan Haggerty e50d1d
R$* $| 	$@ OK
Ryan Haggerty e50d1d
R$* $| <$* <TMPF>>	$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R$* $| <$+>	$@ $>"TLS_connection" $&{verify} $| <$2>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  tls_client: is connection with client "good" enough?
Ryan Haggerty e50d1d
###	(done in server)
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		${verify} $| (MAIL|STARTTLS)
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Stls_client
Ryan Haggerty e50d1d
R$*		$: $(macro {TLS_Name} $@ $&{server_name} $) $1
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| $>D <$&{client_name}>   <>
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| $>A <$&{client_addr}>   <>
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| <$(access "TLS_Clt": $: ? $)>
Ryan Haggerty e50d1d
R$* $| <$* <TMPF>>	$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R$*		$@ $>"TLS_connection" $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  tls_server: is connection with server "good" enough?
Ryan Haggerty e50d1d
###	(done in client)
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameter:
Ryan Haggerty e50d1d
###		${verify}
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Stls_server
Ryan Haggerty e50d1d
R$*		$: $(macro {TLS_Name} $@ $&{server_name} $) $1
Ryan Haggerty e50d1d
R$*		$: $1 $| $>D <$&{server_name}>   <>
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| $>A <$&{server_addr}>   <>
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| <$(access "TLS_Srv": $: ? $)>
Ryan Haggerty e50d1d
R$* $| <$* <TMPF>>	$#error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
Ryan Haggerty e50d1d
R$*		$@ $>"TLS_connection" $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  TLS_connection: is TLS connection "good" enough?
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		${verify} $| <Requirement> [<>]
Ryan Haggerty e50d1d
###		Requirement: RHS from access map, may be ? for none.
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
STLS_connection
Ryan Haggerty e50d1d
R$* $| <$*>$*			$: $1 $| <$2>
Ryan Haggerty e50d1d
# create the appropriate error codes
Ryan Haggerty e50d1d
R$* $| <PERM + $={Tls} $*>	$: $1 $| <503:5.7.0> <$2 $3>
Ryan Haggerty e50d1d
R$* $| <TEMP + $={Tls} $*>	$: $1 $| <403:4.7.0> <$2 $3>
Ryan Haggerty e50d1d
R$* $| <$={Tls} $*>		$: $1 $| <403:4.7.0> <$2 $3>
Ryan Haggerty e50d1d
# deal with TLS handshake failures: abort
Ryan Haggerty e50d1d
RSOFTWARE $| <$-:$+> $* 	$#error $@ $2 $: $1 " TLS handshake failed."
Ryan Haggerty e50d1d
RSOFTWARE $| $* 		$#error $@ 4.7.0 $: "403 TLS handshake failed."
Ryan Haggerty e50d1d
# deal with TLS protocol errors: abort
Ryan Haggerty e50d1d
RPROTOCOL $| <$-:$+> $* 	$#error $@ $2 $: $1 " STARTTLS failed."
Ryan Haggerty e50d1d
RPROTOCOL $| $* 		$#error $@ 4.7.0 $: "403 STARTTLS failed."
Ryan Haggerty e50d1d
R$* $| <$*> <VERIFY>		$: <$2> <VERIFY> <> $1
Ryan Haggerty e50d1d
R$* $| <$*> <VERIFY + $+>	$: <$2> <VERIFY> <$3> $1
Ryan Haggerty e50d1d
R$* $| <$*> <$={Tls}:$->$*	$: <$2> <$3:$4> <> $1
Ryan Haggerty e50d1d
R$* $| <$*> <$={Tls}:$- + $+>$*	$: <$2> <$3:$4> <$5> $1
Ryan Haggerty e50d1d
R$* $| $*			$@ OK
Ryan Haggerty e50d1d
# authentication required: give appropriate error
Ryan Haggerty e50d1d
# other side did authenticate (via STARTTLS)
Ryan Haggerty e50d1d
R<$*><VERIFY> <> OK		$@ OK
Ryan Haggerty e50d1d
R<$*><VERIFY> <$+> OK		$: <$1> <REQ:0> <$2>
Ryan Haggerty e50d1d
R<$*><VERIFY:$-> <$*> OK	$: <$1> <REQ:$2> <$3>
Ryan Haggerty e50d1d
R<$*><ENCR:$-> <$*> $*		$: <$1> <REQ:$2> <$3>
Ryan Haggerty e50d1d
R<$-:$+><VERIFY $*> <$*>	$#error $@ $2 $: $1 " authentication required"
Ryan Haggerty e50d1d
R<$-:$+><VERIFY $*> <$*> FAIL	$#error $@ $2 $: $1 " authentication failed"
Ryan Haggerty e50d1d
R<$-:$+><VERIFY $*> <$*> NO	$#error $@ $2 $: $1 " not authenticated"
Ryan Haggerty e50d1d
R<$-:$+><VERIFY $*> <$*> NOT	$#error $@ $2 $: $1 " no authentication requested"
Ryan Haggerty e50d1d
R<$-:$+><VERIFY $*> <$*> NONE	$#error $@ $2 $: $1 " other side does not support STARTTLS"
Ryan Haggerty e50d1d
R<$-:$+><VERIFY $*> <$*> $+	$#error $@ $2 $: $1 " authentication failure " $4
Ryan Haggerty e50d1d
R<$*><REQ:$-> <$*>		$: <$1> <REQ:$2> <$3> $>max $&{cipher_bits} : $&{auth_ssf}
Ryan Haggerty e50d1d
R<$*><REQ:$-> <$*> $-		$: <$1> <$2:$4> <$3> $(arith l $@ $4 $@ $2 $)
Ryan Haggerty e50d1d
R<$-:$+><$-:$-> <$*> TRUE	$#error $@ $2 $: $1 " encryption too weak " $4 " less than " $3
Ryan Haggerty e50d1d
R<$-:$+><$-:$-> <$*> $*		$: <$1:$2 ++ $5>
Ryan Haggerty e50d1d
R<$-:$+ ++ >			$@ OK
Ryan Haggerty e50d1d
R<$-:$+ ++ $+ >			$: <$1:$2> <$3>
Ryan Haggerty e50d1d
R<$-:$+> < $+ ++ $+ >		<$1:$2> <$3> <$4>
Ryan Haggerty e50d1d
R<$-:$+> $+			$@ $>"TLS_req" $3 $| <$1:$2>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  TLS_req: check additional TLS requirements
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters: [<list> <of> <req>] $| <$-:$+>
Ryan Haggerty e50d1d
###		$-: SMTP reply code
Ryan Haggerty e50d1d
###		$+: Enhanced Status Code
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
STLS_req
Ryan Haggerty e50d1d
R $| $+		$@ OK
Ryan Haggerty e50d1d
R<CN> $* $| <$+>		$: <CN:$&{TLS_Name}> $1 $| <$2>
Ryan Haggerty e50d1d
R<CN:$&{cn_subject}> $* $| <$+>		$@ $>"TLS_req" $1 $| <$2>
Ryan Haggerty e50d1d
R<CN:$+> $* $| <$-:$+>	$#error $@ $4 $: $3 " CN " $&{cn_subject} " does not match " $1
Ryan Haggerty e50d1d
R<CS:$&{cert_subject}> $* $| <$+>	$@ $>"TLS_req" $1 $| <$2>
Ryan Haggerty e50d1d
R<CS:$+> $* $| <$-:$+>	$#error $@ $4 $: $3 " Cert Subject " $&{cert_subject} " does not match " $1
Ryan Haggerty e50d1d
R<CI:$&{cert_issuer}> $* $| <$+>	$@ $>"TLS_req" $1 $| <$2>
Ryan Haggerty e50d1d
R<CI:$+> $* $| <$-:$+>	$#error $@ $4 $: $3 " Cert Issuer " $&{cert_issuer} " does not match " $1
Ryan Haggerty e50d1d
ROK			$@ OK
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  max: return the maximum of two values separated by :
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters: [$-]:[$-]
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Smax
Ryan Haggerty e50d1d
R:		$: 0
Ryan Haggerty e50d1d
R:$-		$: $1
Ryan Haggerty e50d1d
R$-:		$: $1
Ryan Haggerty e50d1d
R$-:$-		$: $(arith l $@ $1 $@ $2 $) : $1 : $2
Ryan Haggerty e50d1d
RTRUE:$-:$-	$: $2
Ryan Haggerty e50d1d
R$-:$-:$-	$: $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  RelayTLS: allow relaying based on TLS authentication
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		none
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
SRelayTLS
Ryan Haggerty e50d1d
# authenticated?
Ryan Haggerty e50d1d
R$*			$:  $&{verify}
Ryan Haggerty e50d1d
R OK			$: OK		authenticated: continue
Ryan Haggerty e50d1d
R $*			$@ NO		not authenticated
Ryan Haggerty e50d1d
R$*			$: $&{cert_issuer}
Ryan Haggerty e50d1d
R$+			$: $(access CERTISSUER:$1 $)
Ryan Haggerty e50d1d
RRELAY			$# RELAY
Ryan Haggerty e50d1d
RSUBJECT		$: <@> $&{cert_subject}
Ryan Haggerty e50d1d
R<@> $+			$: <@> $(access CERTSUBJECT:$1 $)
Ryan Haggerty e50d1d
R<@> RELAY		$# RELAY
Ryan Haggerty e50d1d
R$*			$: NO
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
###  authinfo: lookup authinfo in the access map
Ryan Haggerty e50d1d
###
Ryan Haggerty e50d1d
###	Parameters:
Ryan Haggerty e50d1d
###		$1: {server_name}
Ryan Haggerty e50d1d
###		$2: {server_addr}
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Sauthinfo
Ryan Haggerty e50d1d
R$*		$: $1 $| $>D <$&{server_name}>   <>
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| $>A <$&{server_addr}>   <>
Ryan Haggerty e50d1d
R$* $| $*	$: $1 $| <$(access AuthInfo: $: ? $)> <>
Ryan Haggerty e50d1d
R$* $| $*	$@ no				no authinfo available
Ryan Haggerty e50d1d
R$* $| <$*> <>	$# $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
#####			MAIL FILTER DEFINITIONS
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
#####			MAILER DEFINITIONS
Ryan Haggerty e50d1d
#####
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
######################################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####################################
Ryan Haggerty e50d1d
###   SMTP Mailer specification   ###
Ryan Haggerty e50d1d
#####################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  common sender and masquerading recipient rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SMasqSMTP
Ryan Haggerty e50d1d
R$* < @ $* > $*		$@ $1 < @ $2 > $3		already fully qualified
Ryan Haggerty e50d1d
R$+			$@ $1 < @ *LOCAL* >		add local qualification
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  convert pseudo-domain addresses to real domain addresses
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SPseudoToReal
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# pass <route-addr>s through
Ryan Haggerty e50d1d
R< @ $+ > $*		$@ < @ $1 > $2			resolve <route-addr>
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# output fake domains as user%fake@relay
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# do UUCP heuristics; note that these are shared with UUCP mailers
Ryan Haggerty e50d1d
R$+ < @ $+ .UUCP. >	$: < $2 ! > $1			convert to UUCP form
Ryan Haggerty e50d1d
R$+ < @ $* > $*		$@ $1 < @ $2 > $3		not UUCP form
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# leave these in .UUCP form to avoid further tampering
Ryan Haggerty e50d1d
R< $&h ! > $- ! $+	$@ $2 < @ $1 .UUCP. >
Ryan Haggerty e50d1d
R< $&h ! > $-.$+ ! $+	$@ $3 < @ $1.$2 >
Ryan Haggerty e50d1d
R< $&h ! > $+		$@ $1 < @ $&h .UUCP. >
Ryan Haggerty e50d1d
R< $+ ! > $+		$: $1 ! $2 < @ $Y >		use UUCP_RELAY
Ryan Haggerty e50d1d
R$+ < @ $~[ $* : $+ >	$@ $1 < @ $4 >			strip mailer: part
Ryan Haggerty e50d1d
R$+ < @ >		$: $1 < @ *LOCAL* >		if no UUCP_RELAY
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  envelope sender rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SEnvFromSMTP
Ryan Haggerty e50d1d
R$+			$: $>PseudoToReal $1		sender/recipient common
Ryan Haggerty e50d1d
R$* :; <@>		$@				list:; special case
Ryan Haggerty e50d1d
R$*			$: $>MasqSMTP $1		qualify unqual'ed names
Ryan Haggerty e50d1d
R$+			$: $>MasqEnv $1			do masquerading
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  envelope recipient rewriting --
Ryan Haggerty e50d1d
#  also header recipient if not masquerading recipients
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SEnvToSMTP
Ryan Haggerty e50d1d
R$+			$: $>PseudoToReal $1		sender/recipient common
Ryan Haggerty e50d1d
R$+			$: $>MasqSMTP $1		qualify unqual'ed names
Ryan Haggerty e50d1d
R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  header sender and masquerading header recipient rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SHdrFromSMTP
Ryan Haggerty e50d1d
R$+			$: $>PseudoToReal $1		sender/recipient common
Ryan Haggerty e50d1d
R:; <@>			$@				list:; special case
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
# do special header rewriting
Ryan Haggerty e50d1d
R$* <@> $*		$@ $1 <@> $2			pass null host through
Ryan Haggerty e50d1d
R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
Ryan Haggerty e50d1d
R$*			$: $>MasqSMTP $1		qualify unqual'ed names
Ryan Haggerty e50d1d
R$+			$: $>MasqHdr $1			do masquerading
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  relay mailer header masquerading recipient rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SMasqRelay
Ryan Haggerty e50d1d
R$+			$: $>MasqSMTP $1
Ryan Haggerty e50d1d
R$+			$: $>MasqHdr $1
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Msmtp,		P=[IPC], F=mDFMuX, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
Ryan Haggerty e50d1d
		T=DNS/RFC822/SMTP,
Ryan Haggerty e50d1d
		A=TCP $h
Ryan Haggerty e50d1d
Mesmtp,		P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
Ryan Haggerty e50d1d
		T=DNS/RFC822/SMTP,
Ryan Haggerty e50d1d
		A=TCP $h
Ryan Haggerty e50d1d
Msmtp8,		P=[IPC], F=mDFMuX8, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
Ryan Haggerty e50d1d
		T=DNS/RFC822/SMTP,
Ryan Haggerty e50d1d
		A=TCP $h
Ryan Haggerty e50d1d
Mdsmtp,		P=[IPC], F=mDFMuXa%, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
Ryan Haggerty e50d1d
		T=DNS/RFC822/SMTP,
Ryan Haggerty e50d1d
		A=TCP $h
Ryan Haggerty e50d1d
Mrelay,		P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
Ryan Haggerty e50d1d
		T=DNS/RFC822/SMTP,
Ryan Haggerty e50d1d
		A=TCP $h
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
######################*****##############
Ryan Haggerty e50d1d
###   PROCMAIL Mailer specification   ###
Ryan Haggerty e50d1d
##################*****##################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: procmail.m4,v 8.22 2001/11/12 23:11:34 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Mprocmail,	P=/usr/bin/procmail, F=DFMSPhnu9, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP,
Ryan Haggerty e50d1d
		T=DNS/RFC822/X-Unix,
Ryan Haggerty e50d1d
		A=procmail -Y -m $h $f $u
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
##################################################
Ryan Haggerty e50d1d
###   Local and Program Mailer specification   ###
Ryan Haggerty e50d1d
##################################################
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#####  $Id: local.m4,v 8.59 2004/11/23 00:37:25 ca Exp $  #####
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Envelope sender rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SEnvFromL
Ryan Haggerty e50d1d
R<@>			$n			errors to mailer-daemon
Ryan Haggerty e50d1d
R@ <@ $*>		$n			temporarily bypass Sun bogosity
Ryan Haggerty e50d1d
R$+			$: $>AddDomain $1	add local domain if needed
Ryan Haggerty e50d1d
R$*			$: $>MasqEnv $1		do masquerading
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Envelope recipient rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SEnvToL
Ryan Haggerty e50d1d
R$+ < @ $* >		$: $1			strip host part
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Header sender rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SHdrFromL
Ryan Haggerty e50d1d
R<@>			$n			errors to mailer-daemon
Ryan Haggerty e50d1d
R@ <@ $*>		$n			temporarily bypass Sun bogosity
Ryan Haggerty e50d1d
R$+			$: $>AddDomain $1	add local domain if needed
Ryan Haggerty e50d1d
R$*			$: $>MasqHdr $1		do masquerading
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Header recipient rewriting
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SHdrToL
Ryan Haggerty e50d1d
R$+			$: $>AddDomain $1	add local domain if needed
Ryan Haggerty e50d1d
R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
#  Common code to add local domain name (only if always-add-domain)
Ryan Haggerty e50d1d
#
Ryan Haggerty e50d1d
SAddDomain
Ryan Haggerty e50d1d
R$* < @ $* > $* 	$@ $1 < @ $2 > $3	already fully qualified
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
R$+			$@ $1 < @ *LOCAL* >	add local qualification
Ryan Haggerty e50d1d
Ryan Haggerty e50d1d
Mlocal,		P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
Ryan Haggerty e50d1d
		T=DNS/RFC822/X-Unix,
Ryan Haggerty e50d1d
		A=procmail -t -Y -a $h -d $u
Ryan Haggerty e50d1d
Mprog,		P=/usr/sbin/smrsh, F=lsDFMoqeu9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
Ryan Haggerty e50d1d
		T=X-Unix/X-Unix/X-Unix,
Ryan Haggerty e50d1d
		A=smrsh -c $u
Ryan Haggerty e50d1d