summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.sbin/sendmail/cf/cf/Build29
-rw-r--r--gnu/usr.sbin/sendmail/cf/cf/generic-solaris.cf1371
-rw-r--r--gnu/usr.sbin/sendmail/cf/cf/submit.cf1369
-rw-r--r--gnu/usr.sbin/sendmail/cf/feature/rbl.m418
-rw-r--r--gnu/usr.sbin/sendmail/cf/ostype/aix2.m421
-rw-r--r--gnu/usr.sbin/sendmail/cf/ostype/aux.m421
-rw-r--r--gnu/usr.sbin/sendmail/devtools/M4/UNIX/sm-test.m427
-rw-r--r--gnu/usr.sbin/sendmail/devtools/OS/OSF1.V5.x14
-rw-r--r--gnu/usr.sbin/sendmail/devtools/OS/OpenUNIX.5.i38616
-rw-r--r--gnu/usr.sbin/sendmail/editmap/Build13
-rw-r--r--gnu/usr.sbin/sendmail/editmap/Makefile.m422
-rw-r--r--gnu/usr.sbin/sendmail/include/sendmail/cdefs.h103
-rw-r--r--gnu/usr.sbin/sendmail/include/sendmail/errstring.h73
-rw-r--r--gnu/usr.sbin/sendmail/include/sendmail/useful.h63
-rw-r--r--gnu/usr.sbin/sendmail/libsm/Build13
-rw-r--r--gnu/usr.sbin/sendmail/libsm/Makefile.m435
-rw-r--r--gnu/usr.sbin/sendmail/libsmutil/errstring.c206
-rw-r--r--gnu/usr.sbin/sendmail/libsmutil/strl.c91
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/bf_portable.c525
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/bf_portable.h46
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/bf_torek.c831
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/bf_torek.h42
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/clock.c513
23 files changed, 0 insertions, 5462 deletions
diff --git a/gnu/usr.sbin/sendmail/cf/cf/Build b/gnu/usr.sbin/sendmail/cf/cf/Build
deleted file mode 100644
index 0b3ac9144dc..00000000000
--- a/gnu/usr.sbin/sendmail/cf/cf/Build
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-# $Sendmail: Build,v 8.7 1999/03/02 02:37:12 peterh Exp $
-#
-
-#
-# A quick-and-dirty script to create cf files.
-#
-
-SMROOT=${SMROOT-../..}
-BUILDTOOLS=${BUILDTOOLS-$SMROOT/devtools}
-
-M4=`sh $BUILDTOOLS/bin/find_m4.sh`
-ret=$?
-if [ $ret -ne 0 ]
-then
- exit $ret
-fi
-echo "Using M4=$M4"
-
-eval exec ${MAKE-make} M4=$M4 $*
diff --git a/gnu/usr.sbin/sendmail/cf/cf/generic-solaris.cf b/gnu/usr.sbin/sendmail/cf/cf/generic-solaris.cf
deleted file mode 100644
index 2f9c52cf5d3..00000000000
--- a/gnu/usr.sbin/sendmail/cf/cf/generic-solaris.cf
+++ /dev/null
@@ -1,1371 +0,0 @@
-#
-# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by ca@wiz.smi.sendmail.com on Fri Sep 7 18:32:12 PDT 2001
-##### in /extra/home/ca/sm-8.12.0/OpenSource/sendmail-8.12.0/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-#####
-##### DO NOT EDIT THIS FILE! Only edit the source .mc file.
-#####
-######################################################################
-######################################################################
-
-##### $Id: cfhead.m4,v 8.107 2001/07/22 03:25:37 ca Exp $ #####
-##### $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $ #####
-##### $Id: generic-solaris.mc,v 8.13 2001/06/27 21:46:30 gshapiro Exp $ #####
-
-##### $Id: solaris2.m4,v 8.22 1999/09/24 21:43:53 ca Exp $ #####
-
-##### $Id: generic.m4,v 8.15 1999/04/04 00:51:09 ca Exp $ #####
-
-##### $Id: redirect.m4,v 8.15 1999/08/06 01:47:36 gshapiro Exp $ #####
-
-##### $Id: use_cw_file.m4,v 8.11 2001/08/26 20:58:57 gshapiro Exp $ #####
-
-
-
-##### $Id: proto.m4,v 8.620 2001/08/20 00:55:08 ca Exp $ #####
-
-# level 10 config file format
-V10/Berkeley
-
-# override file safeties - setting this option compromises system security,
-# addressing the actual file configuration problem is preferred
-# need to set this before any file actions are encountered in the cf file
-#O DontBlameSendmail=safe
-
-# default LDAP map specification
-# need to set this now before any LDAP maps are defined
-#O LDAPDefaultSpec=-h localhost
-
-##################
-# local info #
-##################
-
-# my LDAP cluster
-# need to set this before any LDAP lookups are done (including classes)
-#D{sendmailMTACluster}$m
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/mail/local-host-names
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OKR> -T<TEMP>
-C{ResOk}OKR
-
-
-# Hosts for which relaying is permitted ($=R)
-FR-o /etc/mail/relay-domains
-
-# arithmetic map
-Karith arith
-
-
-
-
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-# class N: domains that should not be converted to $M
-#CL root
-C{E}root
-
-
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.12.0
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-#O EightBitMode=pass8
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/etc/mail/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# error message header/file
-#O ErrorHeader=/etc/mail/error-header
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine=False
-
-# queue file mode (qf files)
-#O QueueFileMode=0600
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS=False
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/etc/mail/helpfile
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots=False
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery=False
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo=True
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-O DaemonPortOptions=Name=MTA
-O DaemonPortOptions=Port=587, Name=MSA, M=E
-
-# SMTP client options
-#O ClientPortOptions=Family=inet, Address=0.0.0.0
-
-# Modifiers to define {daemon_flags} for direct submissions
-#O DirectSubmissionModifiers
-
-# Use as mail submission program? See sendmail/SECURITY
-#O UseMSP
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostmasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# limit on number of concurrent queue runners
-#O MaxQueueChildren
-
-# maximum number of queue-runners per queue-grouping with multiple queues
-#O MaxRunnersPerQueue=1
-
-# priority of queue runners (nice(3))
-#O NiceQueueRun
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# perform initial split of envelope without checking MX records
-#O FastSplit=1
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# key for shared memory; 0 to turn off
-#O SharedMemoryKey=0
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.aconnect=0s
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=5s
-#O Timeout.fileopen=60s
-#O Timeout.control=2m
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-#O Timeout.resolver.retrans=5s
-#O Timeout.resolver.retrans.first=5s
-#O Timeout.resolver.retrans.normal=5s
-#O Timeout.resolver.retry=4
-#O Timeout.resolver.retry.first=4
-#O Timeout.resolver.retry.normal=4
-#O Timeout.lhlo=2m
-#O Timeout.auth=10m
-#O Timeout.starttls=1h
-
-# time for DeliverBy; extension disabled if less than 0
-#O DeliverByMin=0
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes=False
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/etc/mail/statistics
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/mail/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList=False
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# load average at which we delay connections; 0 means no limit
-#O DelayLA=0
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=0
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob=False
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/mail/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr=True
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames=False
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups=False
-
-# are group-writable :include: and .forward files (un)trustworthy?
-# True (the default) means they are not trustworthy.
-#O UnsafeGroupWrites=True
-
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# where to save bounces if all else fails
-#O DeadLetterDrop=/var/tmp/dead.letter
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# limit the rate recipients per SMTP envelope are accepted
-# once the threshold number of recipients have been rejected
-#O BadRcptThrottle=20
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces=False
-
-# Return-Receipt-To: header implies DSN request
-#O RrtImpliesDsn=False
-
-# override connection address (for testing)
-#O ConnectOnlyTo=0.0.0.0
-
-# Trusted user for file ownership and starting the daemon
-#O TrustedUser=root
-
-# Control socket for daemon management
-#O ControlSocketName=/var/spool/mqueue/.control
-
-# Maximum MIME header length to protect MUAs
-#O MaxMimeHeaderLength=0/0
-
-# Maximum length of the sum of all headers
-O MaxHeadersLength=32768
-
-# Maximum depth of alias recursion
-#O MaxAliasRecursion=10
-
-# location of pid file
-#O PidFile=/var/run/sendmail.pid
-
-# Prefix string for the process title shown on 'ps' listings
-#O ProcessTitlePrefix=prefix
-
-# Data file (df) memory-buffer file maximum size
-#O DataFileBufferSize=4096
-
-# Transcript file (xf) memory-buffer file maximum size
-#O XscriptFileBufferSize=4096
-
-# lookup type to find information about local mailboxes
-#O MailboxDatabase=pw
-
-# list of authentication mechanisms
-#O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
-
-# default authentication information for outgoing connections
-#O DefaultAuthInfo=/etc/mail/default-auth-info
-
-# SMTP AUTH flags
-#O AuthOptions
-
-# SMTP AUTH maximum encryption strength
-#O AuthMaxBits
-
-# SMTP STARTTLS server options
-#O TLSSrvOptions
-
-# Input mail filters
-#O InputMailFilters
-
-
-
-# CA directory
-#O CACERTPath
-# CA file
-#O CACERTFile
-# Server Cert
-#O ServerCertFile
-# Server private key
-#O ServerKeyFile
-# Client Cert
-#O ClientCertFile
-# Client private key
-#O ClientKeyFile
-# DHParameters (only required if DSA/DH is used)
-#O DHParameters
-# Random data source (required for systems without /dev/urandom under OpenSSL)
-#O RandFile
-
-############################
-# QUEUE GROUP DEFINITIONS #
-############################
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/mail/trusted-users
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
- $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
- (version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-
-#
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-Scanonify=3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $+ :; > $* $@ $2 :; <@> catch <list:;>
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# strip route address <@a,@b,@c:user@d> -> <user@d>
-R@ $+ , $+ $2
-R@ [ $* ] : $+ $2
-R@ $+ : $+ $2
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical
-
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>Canonify2 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-SCanonify2=96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-
-# check for IPv4/IPv6 domain literal
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# hostnames ending in class P are always canonical
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4
-R$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6
-R$* CC $* $| $* $: $3
-# pass to name server to make hostname canonical
-R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4
-R$* $| $* $: $2
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-Sfinal=4
-
-R$+ :; <@> $@ $1 : handle <list:;>
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-SRecurse=97
-R$* $: $>canonify $1
-R$* $@ $>parse $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-Sparse=0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>ParseLocal $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
-R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "553 User address required"
-R$+ <@> $#error $@ 5.1.3 $: "553 Hostname required"
-R$* $: <> $1
-R<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4
-R<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4
-R<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "553 Invalid address"
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
-R$* < @ $* @ > $* $#error $@ 5.1.2 $: "553 Invalid route address"
-R$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "553 Invalid route address"
-R$* , $~O $* $#error $@ 5.1.3 $: "553 Invalid route address"
-
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "553 User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "553 User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $1 < @ [ $2 ] : $S > $3 Add smart host to path
-R$* < @ [ $+ ] : > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send
-R$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer
-R$* < @ [ $+ ] : $+ > $* $#esmtp $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer
-
-
-# short circuit local delivery so forwarded email works
-
-
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-SLocal_localaddr
-Slocaladdr=5
-R$+ $: $1 $| $>"Local_localaddr" $1
-R$+ $| $#ok $@ $1 no change
-R$+ $| $#$* $#$2
-R$+ $| $* $: $1
-
-
-
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-
-R< > $+ $: < > < $1 <> $&h > nope, restore +detail
-
-R< > < $+ <> + $* > $: < > < $1 + $2 > check whether +detail
-R< > < $+ <> $* > $: < > < $1 > else discard
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extension
-R< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extension
-
-R< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
-
-R< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-SMailerToTriple=95
-R< > $* $@ $1 strip off null relay
-R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>Recurse $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-SMasqHdr=93
-
-
-# do not masquerade anything in class N
-R$* < @ $* $=N . > $@ $1 < @ $2 $3 . >
-
-R$* < @ *LOCAL* > $@ $1 < @ $j . >
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-SMasqEnv=94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-SParseLocal=98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $#error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>canonify $1 make domain canonical
-
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$+> $* $@ $2
-
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-# authenticated?
-R$* $: $1 $| $>"tls_client" $&{verify} $| MAIL
-R$* $| $#$+ $#$2
-R$* $| $* $: $1
-
-R<> $@ <OK> we MUST accept <> (RFC 1123)
-R$+ $: <?> $1
-R<?><$+> $: <@> <$1>
-R<?>$+ $: <@> <$1>
-R$* $: $&{daemon_flags} $| $1
-R$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 >
-R$* u $* $| <@> < $* > $: <?> < $3 >
-R$* $| $* $: $2
-# handle case of @localhost on address
-R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
-R<@> < $* @ [127.0.0.1] >
- $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
-R<@> < $* @ localhost.$m >
- $: < ? $&{client_name} > < $1 @ localhost.$m >
-R<@> < $* @ localhost.UUCP >
- $: < ? $&{client_name} > < $1 @ localhost.UUCP >
-R<@> $* $: $1 no localhost as domain
-R<? $=w> $* $: $2 local client: ok
-R<? $+> <$+> $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
-R<?> $* $: $1
-R$* $: <?> $>CanonAddr $1 canonify sender address and mark it
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < @ $* $=P > $: <OK> $1 < @ $2 $3 >
-R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
-R<? $* <$->> $* < @ $+ >
- $: <$2> $3 < @ $4 >
-
-
-# handle case of no @domain on address
-R<?> $* $: $&{daemon_flags} $| <?> $1
-R$* u $* $| <?> $* $: <OKR> $3
-R$* $| $* $: $2
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
- ...remote is not
-# check results
-R<?> $* $: @ $1 mark address: nothing known about it
-R<$={ResOk}> $* $@ <OKR> domain ok: stop
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# empty address?
-R<> $#error $@ nouser $: "553 User address required"
-R$@ $#error $@ nouser $: "553 User address required"
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-######################################################################
-R$* $: $1 $| @ $>"Rcpt_ok" $1
-R$* $| @ $#TEMP $+ $: $1 $| T $2
-R$* $| @ $#$* $#$2
-R$* $| @ RELAY $@ RELAY
-R$* $| @ $* $: O $| $>"Relay_ok" $1
-R$* $| T $+ $: T $2 $| $>"Relay_ok" $1
-R$* $| $#TEMP $+ $#error $2
-R$* $| $#$* $#$2
-R$* $| RELAY $@ RELAY
-R T $+ $| $* $#error $1
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-
-######################################################################
-### Rcpt_ok: is the recipient ok?
-######################################################################
-SRcpt_ok
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# authenticated via TLS?
-R$* $: $1 $| $>RelayTLS client authenticated?
-R$* $| $# $+ $# $2 error/ok?
-R$* $| $* $: $1 no
-
-R$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
-R$* $| $# $* $# $2
-R$* $| NO $: $1
-R$* $| $* $: $1 $| $&{auth_type}
-R$* $| $: $1
-R$* $| $={TrustAuthMech} $# RELAY
-R$* $| $* $: $1
-# anything terminating locally is ok
-R$+ < @ $=w > $@ RELAY
-R$+ < @ $* $=R > $@ RELAY
-
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ RELAY
-R<$+> $* $: $2
-
-######################################################################
-### Relay_ok: is the relay/sender ok?
-######################################################################
-SRelay_ok
-# anything originating locally is ok
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ RELAY originated locally
-R0 $@ RELAY originated locally
-R$=R $* $@ RELAY relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ RELAY ... and see if it is local
-
-
-# check client name: first: did it resolve?
-R$* $: < $&{client_resolve} >
-R<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
-R<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
-R<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
-R$* $: <@> $&{client_name}
-R<@> $@ RELAY
-# pass to name server to make hostname canonical
-R<@> $* $=P $:<?> $1 $2
-R<@> $+ $:<?> $[ $1 $]
-R$* . $1 strip trailing dots
-R<?> $=w $@ RELAY
-R<?> $* $=R $@ RELAY
-
-
-
-
-######################################################################
-### trust_auth: is user trusted to authenticate as someone else?
-###
-### Parameters:
-### $1: AUTH= parameter from MAIL command
-######################################################################
-
-SLocal_trust_auth
-Strust_auth
-R$* $: $&{auth_type} $| $1
-# required by RFC 2554 section 4.
-R$@ $| $* $#error $@ 5.7.1 $: "550 not authenticated"
-R$* $| $&{auth_authen} $@ identical
-R$* $| <$&{auth_authen}> $@ identical
-R$* $| $* $: $1 $| $>"Local_trust_auth" $1
-R$* $| $#$* $#$2
-R$* $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
-
-######################################################################
-### Relay_Auth: allow relaying based on authentication?
-###
-### Parameters:
-### $1: ${auth_type}
-######################################################################
-SLocal_Relay_Auth
-
-
-
-######################################################################
-### tls_client: is connection with client "good" enough?
-### (done in server)
-###
-### Parameters:
-### ${verify} $| (MAIL|STARTTLS)
-######################################################################
-Stls_client
-R$* $| $* $@ $>"TLS_connection" $1
-
-######################################################################
-### tls_server: is connection with server "good" enough?
-### (done in client)
-###
-### Parameter:
-### ${verify}
-######################################################################
-Stls_server
-R$* $@ $>"TLS_connection" $1
-
-######################################################################
-### TLS_connection: is TLS connection "good" enough?
-###
-### Parameters:
-### ${verify}
-### Requirement: RHS from access map, may be ? for none.
-######################################################################
-STLS_connection
-RSOFTWARE $#error $@ 4.7.0 $: "403 TLS handshake."
-
-
-######################################################################
-### RelayTLS: allow relaying based on TLS authentication
-###
-### Parameters:
-### none
-######################################################################
-SRelayTLS
-# authenticated?
-
-######################################################################
-### authinfo: lookup authinfo in the access map
-###
-### Parameters:
-### $1: {server_name}
-### $2: {server_addr}
-######################################################################
-Sauthinfo
-
-#
-######################################################################
-######################################################################
-#####
-##### MAIL FILTER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-#
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### $Id: local.m4,v 8.58 2000/10/26 01:58:29 ca Exp $ #####
-
-#
-# Envelope sender rewriting
-#
-SEnvFromL
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>AddDomain $1 add local domain if needed
-R$* $: $>MasqEnv $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-SEnvToL
-R$+ < @ $* > $: $1 strip host part
-R$+ + $* $: < $&{addr_type} > $1 + $2 mark with addr type
-R<e s> $+ + $* $: $1 remove +detail for sender
-R< $* > $+ $: $2 else remove mark
-
-#
-# Header sender rewriting
-#
-SHdrFromL
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>AddDomain $1 add local domain if needed
-R$* $: $>MasqHdr $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-SHdrToL
-R$+ $: $>AddDomain $1 add local domain if needed
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-SAddDomain
-
-Mlocal, P=/usr/lib/mail.local, F=lsDFMAw5:/|@qfSmn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
- T=DNS/RFC822/X-Unix,
- A=mail.local -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
- T=X-Unix/X-Unix/X-Unix,
- A=sh -c $u
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### $Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $ #####
-
-#
-# common sender and masquerading recipient rewriting
-#
-SMasqSMTP
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-SPseudoToReal
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $~[ $* : $+ > $@ $1 < @ $4 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# envelope sender rewriting
-#
-SEnvFromSMTP
-R$+ $: $>PseudoToReal $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>MasqSMTP $1 qualify unqual'ed names
-R$+ $: $>MasqEnv $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-SEnvToSMTP
-R$+ $: $>PseudoToReal $1 sender/recipient common
-R$+ $: $>MasqSMTP $1 qualify unqual'ed names
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-#
-# header sender and masquerading header recipient rewriting
-#
-SHdrFromSMTP
-R$+ $: $>PseudoToReal $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>MasqSMTP $1 qualify unqual'ed names
-R$+ $: $>MasqHdr $1 do masquerading
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-SMasqRelay
-R$+ $: $>MasqSMTP $1
-R$+ $: $>MasqHdr $1
-
-Msmtp, P=[IPC], F=mDFMuX, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mdsmtp, P=[IPC], F=mDFMuXa%, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-
diff --git a/gnu/usr.sbin/sendmail/cf/cf/submit.cf b/gnu/usr.sbin/sendmail/cf/cf/submit.cf
deleted file mode 100644
index 33eb29d790b..00000000000
--- a/gnu/usr.sbin/sendmail/cf/cf/submit.cf
+++ /dev/null
@@ -1,1369 +0,0 @@
-#
-# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-#####
-######################################################################
-#####
-##### DO NOT EDIT THIS FILE! Only edit the source .mc file.
-#####
-######################################################################
-######################################################################
-
-##### $Id: cfhead.m4,v 8.107 2001/07/22 03:25:37 ca Exp $ #####
-##### $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $ #####
-##### $Id: submit.mc,v 8.5 2001/09/08 01:20:53 gshapiro Exp $ #####
-##### $Id: msp.m4,v 1.27 2001/08/16 16:31:29 ca Exp $ #####
-
-##### $Id: no_default_msa.m4,v 8.2 2001/02/14 05:03:22 gshapiro Exp $ #####
-
-
-##### $Id: proto.m4,v 8.620 2001/08/20 00:55:08 ca Exp $ #####
-
-# level 10 config file format
-V10/Berkeley
-
-# override file safeties - setting this option compromises system security,
-# addressing the actual file configuration problem is preferred
-# need to set this before any file actions are encountered in the cf file
-#O DontBlameSendmail=safe
-
-# default LDAP map specification
-# need to set this now before any LDAP maps are defined
-#O LDAPDefaultSpec=-h localhost
-
-##################
-# local info #
-##################
-
-# my LDAP cluster
-# need to set this before any LDAP lookups are done (including classes)
-#D{sendmailMTACluster}$m
-
-Cwlocalhost
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OKR> -T<TEMP>
-C{ResOk}OKR
-
-
-# Hosts for which relaying is permitted ($=R)
-FR-o /etc/mail/relay-domains
-
-# arithmetic map
-Karith arith
-
-
-
-
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-# class N: domains that should not be converted to $M
-#CL root
-
-
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-D{MTAHost}localhost
-
-
-# Configuration version number
-DZ8.12.0/Submit
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-#O EightBitMode=pass8
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=i
-
-# error message header/file
-#O ErrorHeader=/etc/mail/error-header
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine=False
-
-# queue file mode (qf files)
-O QueueFileMode=0660
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS=False
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/etc/mail/helpfile
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots=False
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery=False
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo=True
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-
-O DaemonPortOptions=Name=NoMTA, Addr=127.0.0.1, M=E
-
-# SMTP client options
-#O ClientPortOptions=Family=inet, Address=0.0.0.0
-
-# Modifiers to define {daemon_flags} for direct submissions
-#O DirectSubmissionModifiers
-
-# Use as mail submission program? See sendmail/SECURITY
-O UseMSP=True
-
-# privacy flags
-O PrivacyOptions=goaway,noetrn
-
-# who (if anyone) should get extra copies of error messages
-#O PostmasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# limit on number of concurrent queue runners
-#O MaxQueueChildren
-
-# maximum number of queue-runners per queue-grouping with multiple queues
-#O MaxRunnersPerQueue=1
-
-# priority of queue runners (nice(3))
-#O NiceQueueRun
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# perform initial split of envelope without checking MX records
-#O FastSplit=1
-
-# queue directory
-O QueueDirectory=/var/spool/clientmqueue
-
-# key for shared memory; 0 to turn off
-#O SharedMemoryKey=0
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.aconnect=0s
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=5s
-#O Timeout.fileopen=60s
-#O Timeout.control=2m
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-#O Timeout.resolver.retrans=5s
-#O Timeout.resolver.retrans.first=5s
-#O Timeout.resolver.retrans.normal=5s
-#O Timeout.resolver.retry=4
-#O Timeout.resolver.retry.first=4
-#O Timeout.resolver.retry.normal=4
-#O Timeout.lhlo=2m
-#O Timeout.auth=10m
-#O Timeout.starttls=1h
-
-# time for DeliverBy; extension disabled if less than 0
-#O DeliverByMin=0
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes=False
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/var/spool/clientmqueue/sm-client.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/mail/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList=False
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# load average at which we delay connections; 0 means no limit
-#O DelayLA=0
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=0
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob=False
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/mail/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr=True
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames=False
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups=False
-
-# are group-writable :include: and .forward files (un)trustworthy?
-# True (the default) means they are not trustworthy.
-#O UnsafeGroupWrites=True
-
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# where to save bounces if all else fails
-#O DeadLetterDrop=/var/tmp/dead.letter
-
-# what user id do we assume for the majority of the processing?
-O RunAsUser=smmsp
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# limit the rate recipients per SMTP envelope are accepted
-# once the threshold number of recipients have been rejected
-#O BadRcptThrottle=20
-
-# shall we get local names from our installed interfaces?
-O DontProbeInterfaces=True
-
-# Return-Receipt-To: header implies DSN request
-#O RrtImpliesDsn=False
-
-# override connection address (for testing)
-#O ConnectOnlyTo=0.0.0.0
-
-# Trusted user for file ownership and starting the daemon
-O TrustedUser=smmsp
-
-# Control socket for daemon management
-#O ControlSocketName=/var/spool/mqueue/.control
-
-# Maximum MIME header length to protect MUAs
-#O MaxMimeHeaderLength=0/0
-
-# Maximum length of the sum of all headers
-#O MaxHeadersLength=32768
-
-# Maximum depth of alias recursion
-#O MaxAliasRecursion=10
-
-# location of pid file
-O PidFile=/var/spool/clientmqueue/sm-client.pid
-
-# Prefix string for the process title shown on 'ps' listings
-#O ProcessTitlePrefix=prefix
-
-# Data file (df) memory-buffer file maximum size
-#O DataFileBufferSize=4096
-
-# Transcript file (xf) memory-buffer file maximum size
-#O XscriptFileBufferSize=4096
-
-# lookup type to find information about local mailboxes
-#O MailboxDatabase=pw
-
-# list of authentication mechanisms
-#O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
-
-# default authentication information for outgoing connections
-#O DefaultAuthInfo=/etc/mail/default-auth-info
-
-# SMTP AUTH flags
-#O AuthOptions
-
-# SMTP AUTH maximum encryption strength
-#O AuthMaxBits
-
-# SMTP STARTTLS server options
-#O TLSSrvOptions
-
-# Input mail filters
-#O InputMailFilters
-
-
-
-# CA directory
-#O CACERTPath
-# CA file
-#O CACERTFile
-# Server Cert
-#O ServerCertFile
-# Server private key
-#O ServerKeyFile
-# Client Cert
-#O ClientCertFile
-# Client private key
-#O ClientKeyFile
-# DHParameters (only required if DSA/DH is used)
-#O DHParameters
-# Random data source (required for systems without /dev/urandom under OpenSSL)
-#O RandFile
-
-############################
-# QUEUE GROUP DEFINITIONS #
-############################
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/mail/trusted-users
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
- $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
- (version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-
-#
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-Scanonify=3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $+ :; > $* $@ $2 :; <@> catch <list:;>
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# strip route address <@a,@b,@c:user@d> -> <user@d>
-R@ $+ , $+ $2
-R@ [ $* ] : $+ $2
-R@ $+ : $+ $2
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>Canonify2 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>Canonify2 $1 < @ $2 > already canonical
-
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>Canonify2 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>Canonify2 $2 < @ $1 .UUCP > uucp subdomains
-
-# convert node::user addresses into a domain-based address
-R$- :: $+ $@ $>Canonify2 $2 < @ $1 .DECNET > resolve DECnet names
-R$- . $- :: $+ $@ $>Canonify2 $3 < @ $1.$2 .DECNET > numeric DECnet addr
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>Canonify2 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>Canonify2 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-SCanonify2=96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-
-# check for IPv4/IPv6 domain literal
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [addr]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# hostnames ending in class P are always canonical
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* $~P > $* $: $&{daemon_flags} $| $1 < @ $2 $3 > $4
-R$* CC $* $| $* < @ $+.$+ > $* $: $3 < @ $4.$5 . > $6
-R$* CC $* $| $* $: $3
-# pass to name server to make hostname canonical
-R$* $| $* < @ $* > $* $: $2 < @ $[ $3 $] > $4
-R$* $| $* $: $2
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-Sfinal=4
-
-R$+ :; <@> $@ $1 : handle <list:;>
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# put DECnet back in :: form
-R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-SRecurse=97
-R$* $: $>canonify $1
-R$* $@ $>parse $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-Sparse=0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>ParseLocal $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
-R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "553 User address required"
-R$+ <@> $#error $@ 5.1.3 $: "553 Hostname required"
-R$* $: <> $1
-R<> $* < @ [ $* ] : $+ > $* $1 < @ [ $2 ] : $3 > $4
-R<> $* < @ [ $* ] , $+ > $* $1 < @ [ $2 ] , $3 > $4
-R<> $* < @ [ $* ] $+ > $* $#error $@ 5.1.2 $: "553 Invalid address"
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "553 Invalid host name"
-R$* < @ $* @ > $* $#error $@ 5.1.2 $: "553 Invalid route address"
-R$* @ $* < @ $* > $* $#error $@ 5.1.3 $: "553 Invalid route address"
-R$* , $~O $* $#error $@ 5.1.3 $: "553 Invalid route address"
-
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>canonify $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>canonify $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "553 User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "553 User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>ParseLocal $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $1 < @ [ $2 ] : $S > $3 Add smart host to path
-R$* < @ [ $+ ] : > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 no smarthost: send
-R$* < @ [ $+ ] : $- : $*> $* $#$3 $@ $4 $: $1 < @ [$2] > $5 smarthost with mailer
-R$* < @ [ $+ ] : $+ > $* $#esmtp $@ $3 $: $1 < @ [$2] > $4 smarthost without mailer
-
-
-# short circuit local delivery so forwarded email works
-
-
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>MailerToTriple < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-SLocal_localaddr
-Slocaladdr=5
-R$+ $: $1 $| $>"Local_localaddr" $1
-R$+ $| $#ok $@ $1 no change
-R$+ $| $#$* $#$2
-R$+ $| $* $: $1
-
-
-
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-
-R< > $+ $: < > < $1 <> $&h > nope, restore +detail
-
-R< > < $+ <> + $* > $: < > < $1 + $2 > check whether +detail
-R< > < $+ <> $* > $: < > < $1 > else discard
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>MailerToTriple < local : $1 > $2 no host extension
-R< error : $* > $* $: $>MailerToTriple < error : $1 > $2 no host extension
-
-R< $~[ : $+ > $+ $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
-
-R< $+ > $+ $@ $>MailerToTriple < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-SMailerToTriple=95
-R< > $* $@ $1 strip off null relay
-R< error : $-.$-.$- : $+ > $* $#error $@ $1.$2.$3 $: $4
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>Recurse $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>Recurse $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-SMasqHdr=93
-
-
-# do not masquerade anything in class N
-R$* < @ $* $=N . > $@ $1 < @ $2 $3 . >
-
-R$* < @ *LOCAL* > $@ $1 < @ $j . >
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-SMasqEnv=94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-SParseLocal=98
-
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>canonify $1 make domain canonical
-
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$+> $* $@ $2
-
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-# authenticated?
-R$* $: $1 $| $>"tls_client" $&{verify} $| MAIL
-R$* $| $#$+ $#$2
-R$* $| $* $: $1
-
-R<> $@ <OK> we MUST accept <> (RFC 1123)
-R$+ $: <?> $1
-R<?><$+> $: <@> <$1>
-R<?>$+ $: <@> <$1>
-R$* $: $&{daemon_flags} $| $1
-R$* f $* $| <@> < $* @ $- > $: < ? $&{client_name} > < $3 @ $4 >
-R$* u $* $| <@> < $* > $: <?> < $3 >
-R$* $| $* $: $2
-# handle case of @localhost on address
-R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
-R<@> < $* @ [127.0.0.1] >
- $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
-R<@> < $* @ localhost.$m >
- $: < ? $&{client_name} > < $1 @ localhost.$m >
-R<@> < $* @ localhost.UUCP >
- $: < ? $&{client_name} > < $1 @ localhost.UUCP >
-R<@> $* $: $1 no localhost as domain
-R<? $=w> $* $: $2 local client: ok
-R<? $+> <$+> $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
-R<?> $* $: $1
-R$* $: <?> $>CanonAddr $1 canonify sender address and mark it
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < @ $* $=P > $: <OK> $1 < @ $2 $3 >
-R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
-R<? $* <$->> $* < @ $+ >
- $: <$2> $3 < @ $4 >
-
-
-# handle case of no @domain on address
-R<?> $* $: $&{daemon_flags} $| <?> $1
-R$* u $* $| <?> $* $: <OKR> $3
-R$* $| $* $: $2
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
- ...remote is not
-# check results
-R<?> $* $: @ $1 mark address: nothing known about it
-R<$={ResOk}> $* $@ <OKR> domain ok: stop
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# empty address?
-R<> $#error $@ nouser $: "553 User address required"
-R$@ $#error $@ nouser $: "553 User address required"
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-######################################################################
-R$* $: $1 $| @ $>"Rcpt_ok" $1
-R$* $| @ $#TEMP $+ $: $1 $| T $2
-R$* $| @ $#$* $#$2
-R$* $| @ RELAY $@ RELAY
-R$* $| @ $* $: O $| $>"Relay_ok" $1
-R$* $| T $+ $: T $2 $| $>"Relay_ok" $1
-R$* $| $#TEMP $+ $#error $2
-R$* $| $#$* $#$2
-R$* $| RELAY $@ RELAY
-R T $+ $| $* $#error $1
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-
-######################################################################
-### Rcpt_ok: is the recipient ok?
-######################################################################
-SRcpt_ok
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# authenticated via TLS?
-R$* $: $1 $| $>RelayTLS client authenticated?
-R$* $| $# $+ $# $2 error/ok?
-R$* $| $* $: $1 no
-
-R$* $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
-R$* $| $# $* $# $2
-R$* $| NO $: $1
-R$* $| $* $: $1 $| $&{auth_type}
-R$* $| $: $1
-R$* $| $={TrustAuthMech} $# RELAY
-R$* $| $* $: $1
-# anything terminating locally is ok
-R$+ < @ $=w > $@ RELAY
-R$+ < @ $* $=R > $@ RELAY
-
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ RELAY
-R<$+> $* $: $2
-
-######################################################################
-### Relay_ok: is the relay/sender ok?
-######################################################################
-SRelay_ok
-# anything originating locally is ok
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ RELAY originated locally
-R0 $@ RELAY originated locally
-R$=R $* $@ RELAY relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ RELAY ... and see if it is local
-
-
-# check client name: first: did it resolve?
-R$* $: < $&{client_resolve} >
-R<TEMP> $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
-R<FORGED> $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
-R<FAIL> $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
-R$* $: <@> $&{client_name}
-R<@> $@ RELAY
-# pass to name server to make hostname canonical
-R<@> $* $=P $:<?> $1 $2
-R<@> $+ $:<?> $[ $1 $]
-R$* . $1 strip trailing dots
-R<?> $=w $@ RELAY
-R<?> $* $=R $@ RELAY
-
-
-
-
-######################################################################
-### trust_auth: is user trusted to authenticate as someone else?
-###
-### Parameters:
-### $1: AUTH= parameter from MAIL command
-######################################################################
-
-SLocal_trust_auth
-Strust_auth
-R$* $: $&{auth_type} $| $1
-# required by RFC 2554 section 4.
-R$@ $| $* $#error $@ 5.7.1 $: "550 not authenticated"
-R$* $| $&{auth_authen} $@ identical
-R$* $| <$&{auth_authen}> $@ identical
-R$* $| $* $: $1 $| $>"Local_trust_auth" $1
-R$* $| $#$* $#$2
-R$* $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
-
-######################################################################
-### Relay_Auth: allow relaying based on authentication?
-###
-### Parameters:
-### $1: ${auth_type}
-######################################################################
-SLocal_Relay_Auth
-
-
-
-######################################################################
-### tls_client: is connection with client "good" enough?
-### (done in server)
-###
-### Parameters:
-### ${verify} $| (MAIL|STARTTLS)
-######################################################################
-Stls_client
-R$* $| $* $@ $>"TLS_connection" $1
-
-######################################################################
-### tls_server: is connection with server "good" enough?
-### (done in client)
-###
-### Parameter:
-### ${verify}
-######################################################################
-Stls_server
-R$* $@ $>"TLS_connection" $1
-
-######################################################################
-### TLS_connection: is TLS connection "good" enough?
-###
-### Parameters:
-### ${verify}
-### Requirement: RHS from access map, may be ? for none.
-######################################################################
-STLS_connection
-RSOFTWARE $#error $@ 4.7.0 $: "403 TLS handshake."
-
-
-######################################################################
-### RelayTLS: allow relaying based on TLS authentication
-###
-### Parameters:
-### none
-######################################################################
-SRelayTLS
-# authenticated?
-
-######################################################################
-### authinfo: lookup authinfo in the access map
-###
-### Parameters:
-### $1: {server_name}
-### $2: {server_addr}
-######################################################################
-Sauthinfo
-
-
-
-
-SLocal_localaddr
-R$+ $: $>ParseRecipient $1
-R$* < @ $+ > $* $#relay $@ ${MTAHost} $: $1 < @ $2 > $3
-# DECnet
-R$+ :: $+ $#relay $@ ${MTAHost} $: $1 :: $2
-R$* $#relay $@ ${MTAHost} $: $1 < @ $j >
-#
-######################################################################
-######################################################################
-#####
-##### MAIL FILTER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-#
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### $Id: local.m4,v 8.58 2000/10/26 01:58:29 ca Exp $ #####
-
-#
-# Envelope sender rewriting
-#
-SEnvFromL
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>AddDomain $1 add local domain if needed
-R$* $: $>MasqEnv $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-SEnvToL
-R$+ < @ $* > $: $1 strip host part
-R$+ + $* $: < $&{addr_type} > $1 + $2 mark with addr type
-R<e s> $+ + $* $: $1 remove +detail for sender
-R< $* > $+ $: $2 else remove mark
-
-#
-# Header sender rewriting
-#
-SHdrFromL
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>AddDomain $1 add local domain if needed
-R$* $: $>MasqHdr $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-SHdrToL
-R$+ $: $>AddDomain $1 add local domain if needed
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-SAddDomain
-
-Mlocal, P=[IPC], F=lmDFMuXkw5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mprog, P=[IPC], F=lmDFMuXk5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
- T=X-Unix/X-Unix/X-Unix,
- A=TCP $h
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### $Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $ #####
-
-#
-# common sender and masquerading recipient rewriting
-#
-SMasqSMTP
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-SPseudoToReal
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $~[ $* : $+ > $@ $1 < @ $4 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# envelope sender rewriting
-#
-SEnvFromSMTP
-R$+ $: $>PseudoToReal $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>MasqSMTP $1 qualify unqual'ed names
-R$+ $: $>MasqEnv $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-SEnvToSMTP
-R$+ $: $>PseudoToReal $1 sender/recipient common
-R$+ $: $>MasqSMTP $1 qualify unqual'ed names
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-#
-# header sender and masquerading header recipient rewriting
-#
-SHdrFromSMTP
-R$+ $: $>PseudoToReal $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>MasqSMTP $1 qualify unqual'ed names
-R$+ $: $>MasqHdr $1 do masquerading
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-SMasqRelay
-R$+ $: $>MasqSMTP $1
-R$+ $: $>MasqHdr $1
-
-Msmtp, P=[IPC], F=mDFMuXk05, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mesmtp, P=[IPC], F=mDFMuXak05, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Msmtp8, P=[IPC], F=mDFMuX8k05, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mdsmtp, P=[IPC], F=mDFMuXa%k05, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-Mrelay, P=[IPC], F=mDFMuXa8k0, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=TCP $h
-
diff --git a/gnu/usr.sbin/sendmail/cf/feature/rbl.m4 b/gnu/usr.sbin/sendmail/cf/feature/rbl.m4
deleted file mode 100644
index e169a778d37..00000000000
--- a/gnu/usr.sbin/sendmail/cf/feature/rbl.m4
+++ /dev/null
@@ -1,18 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-
-divert(0)
-VERSIONID(`$Sendmail: rbl.m4,v 8.17 1999/04/04 00:51:12 ca Exp $')
-divert(-1)
-
-define(`_RBL_', ifelse(defn(`_ARG_'), `', `rbl.maps.vix.com', `_ARG_'))dnl
-ifelse(defn(`_ARG_'), `', `', `
-errprint(`Warning: FEATURE(`rbl') is deprecated, use FEATURE(`dnsbl') instead
-')')dnl
diff --git a/gnu/usr.sbin/sendmail/cf/ostype/aix2.m4 b/gnu/usr.sbin/sendmail/cf/ostype/aix2.m4
deleted file mode 100644
index 5b994fb2479..00000000000
--- a/gnu/usr.sbin/sendmail/cf/ostype/aix2.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-# Copyright (c) 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-
-divert(0)
-VERSIONID(`$Sendmail: aix2.m4,v 8.12 1999/04/12 17:34:36 ca Exp $')
-define(`LOCAL_MAILER_PATH', /bin/bellmail)dnl
-define(`LOCAL_MAILER_ARGS', mail $u)dnl
-_DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
diff --git a/gnu/usr.sbin/sendmail/cf/ostype/aux.m4 b/gnu/usr.sbin/sendmail/cf/ostype/aux.m4
deleted file mode 100644
index 945ea4f8f24..00000000000
--- a/gnu/usr.sbin/sendmail/cf/ostype/aux.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-
-divert(0)
-VERSIONID(`$Sendmail: a-ux.m4,v 8.1 2001/04/12 22:29:58 gshapiro Exp $')
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
-_DEFIFNOT(`LOCAL_MAILER_FLAGS', `mn9')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d -r $f $u')')dnl
-define(`confEBINDIR', `/usr/lib')dnl
diff --git a/gnu/usr.sbin/sendmail/devtools/M4/UNIX/sm-test.m4 b/gnu/usr.sbin/sendmail/devtools/M4/UNIX/sm-test.m4
deleted file mode 100644
index 04e688debad..00000000000
--- a/gnu/usr.sbin/sendmail/devtools/M4/UNIX/sm-test.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 2001 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-# Compile/run a test program for libsm.
-#
-# $Sendmail: sm-test.m4,v 1.4 2001/01/18 04:15:04 ca Exp $
-#
-define(`smtest',
-`bldPUSH_TARGET($1)dnl
-bldLIST_PUSH_ITEM(`bldC_PRODUCTS', $1)dnl
-bldPUSH_CLEAN_TARGET($1`-clean')dnl
-divert(bldTARGETS_SECTION)
-$1: ${BEFORE} $1.o libsm.a
- ${CC} -o $1 ${LDOPTS} ${LIBDIRS} $1.o libsm.a ${LIBS}
-ifelse(len(X`'$2), `1', `', `
- @echo ============================================================
- ./$1
- @echo ============================================================')
-$1-clean:
- rm -f $1 $1.o
-divert(0)')
diff --git a/gnu/usr.sbin/sendmail/devtools/OS/OSF1.V5.x b/gnu/usr.sbin/sendmail/devtools/OS/OSF1.V5.x
deleted file mode 100644
index be93e555ded..00000000000
--- a/gnu/usr.sbin/sendmail/devtools/OS/OSF1.V5.x
+++ /dev/null
@@ -1,14 +0,0 @@
-# $Sendmail: OSF1.V5.x,v 8.3 2001/08/15 08:55:54 guenther Exp $
-define(`confCC', `cc -std1 -Olimit 1000')
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `')
-define(`confLIBS', `-ldbm')
-define(`confSM_OS_HEADER', `sm_os_osf1')
-define(`confSTDIR', `/var/adm/sendmail')
-define(`confINSTALL', `installbsd')
-define(`confEBINDIR', `/usr/lbin')
-define(`confUBINDIR', `${BINDIR}')
-define(`confDEPEND_TYPE', `CC-M')
-
-define(`confMTCCOPTS', `-D_REENTRANT')
-define(`confMTLDOPTS', `-lpthread')
diff --git a/gnu/usr.sbin/sendmail/devtools/OS/OpenUNIX.5.i386 b/gnu/usr.sbin/sendmail/devtools/OS/OpenUNIX.5.i386
deleted file mode 100644
index e9bae85e2db..00000000000
--- a/gnu/usr.sbin/sendmail/devtools/OS/OpenUNIX.5.i386
+++ /dev/null
@@ -1,16 +0,0 @@
-# $Sendmail: OpenUNIX.5.i386,v 1.1 2001/08/22 17:23:08 ca Exp $
-#
-# System V Rel 5.x (a.k.a OpenUNIX)
-#
-define(`confSM_OS_HEADER', `sm_os_openunix')
-define(`confCC', `/usr/ccs/bin/cc')
-define(`confMAPDEF', `-DNDBM -DMAP_REGEX')
-define(`confENVDEF', `-D__svr5__')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confSHELL', `/usr/bin/sh')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/etc/mail')
-define(`confUBINDIR', `/etc/mail')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `mail')
-define(`confINSTALL', `/usr/ucb/install')
diff --git a/gnu/usr.sbin/sendmail/editmap/Build b/gnu/usr.sbin/sendmail/editmap/Build
deleted file mode 100644
index 2f051e5d997..00000000000
--- a/gnu/usr.sbin/sendmail/editmap/Build
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-# $Sendmail: Build,v 1.2 2000/09/17 17:30:02 gshapiro Exp $
-
-exec ../devtools/bin/Build $*
diff --git a/gnu/usr.sbin/sendmail/editmap/Makefile.m4 b/gnu/usr.sbin/sendmail/editmap/Makefile.m4
deleted file mode 100644
index 906e198766c..00000000000
--- a/gnu/usr.sbin/sendmail/editmap/Makefile.m4
+++ /dev/null
@@ -1,22 +0,0 @@
-include(confBUILDTOOLSDIR`/M4/switch.m4')
-
-define(`confREQUIRE_LIBSM', `true')
-# sendmail dir
-SMSRCDIR= ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
-PREPENDDEF(`confENVDEF', `confMAPDEF')
-PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
-
-bldPRODUCT_START(`executable', `editmap')
-define(`bldSOURCES', `editmap.c ')
-define(`bldINSTALL_DIR', `S')
-bldPUSH_SMLIB(`sm')
-bldPUSH_SMLIB(`smutil')
-bldPUSH_SMLIB(`smdb')
-APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL')
-bldPRODUCT_END
-
-bldPRODUCT_START(`manpage', `editmap')
-define(`bldSOURCES', `editmap.8')
-bldPRODUCT_END
-
-bldFINISH
diff --git a/gnu/usr.sbin/sendmail/include/sendmail/cdefs.h b/gnu/usr.sbin/sendmail/include/sendmail/cdefs.h
deleted file mode 100644
index 3b4691c6924..00000000000
--- a/gnu/usr.sbin/sendmail/include/sendmail/cdefs.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- * $Sendmail: cdefs.h,v 8.5 1999/06/02 22:32:17 gshapiro Exp $
- * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
- */
-
-#ifndef _CDEFS_H_
-# define _CDEFS_H_
-
-# if defined(__cplusplus)
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS };
-# else /* defined(__cplusplus) */
-# define __BEGIN_DECLS
-# define __END_DECLS
-# endif /* defined(__cplusplus) */
-
-/*
- * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
- * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
- * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
- * in between its arguments. __CONCAT can also concatenate double-quoted
- * strings produced by the __STRING macro, but this only works with ANSI C.
- */
-# if defined(__STDC__) || defined(__cplusplus)
-# define __P(protos) protos /* full-blown ANSI C */
-# ifndef __CONCAT
-# define __CONCAT(x,y) x ## y
-# endif /* ! __CONCAT */
-# define __STRING(x) #x
-
-# ifndef __const
-# define __const const /* define reserved names to standard */
-# endif /* ! __const */
-# define __signed signed
-# define __volatile volatile
-# if defined(__cplusplus)
-# define __inline inline /* convert to C++ keyword */
-# else /* defined(__cplusplus) */
-# ifndef __GNUC__
-# define __inline /* delete GCC keyword */
-# endif /* ! __GNUC__ */
-# endif /* defined(__cplusplus) */
-
-# else /* defined(__STDC__) || defined(__cplusplus) */
-# define __P(protos) () /* traditional C preprocessor */
-# ifndef __CONCAT
-# define __CONCAT(x,y) x/**/y
-# endif /* ! __CONCAT */
-# define __STRING(x) "x"
-
-# ifndef __GNUC__
-# define __const /* delete pseudo-ANSI C keywords */
-# define __inline
-# define __signed
-# define __volatile
-/*
- * In non-ANSI C environments, new programs will want ANSI-only C keywords
- * deleted from the program and old programs will want them left alone.
- * When using a compiler other than gcc, programs using the ANSI C keywords
- * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
- * When using "gcc -traditional", we assume that this is the intent; if
- * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
- */
-# ifndef NO_ANSI_KEYWORDS
-# define const /* delete ANSI C keywords */
-# define inline
-# define signed
-# define volatile
-# endif /* ! NO_ANSI_KEYWORDS */
-# endif /* ! __GNUC__ */
-# endif /* defined(__STDC__) || defined(__cplusplus) */
-
-/*
- * GCC1 and some versions of GCC2 declare dead (non-returning) and
- * pure (no side effects) functions using "volatile" and "const";
- * unfortunately, these then cause warnings under "-ansi -pedantic".
- * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
- * these work for GNU C++ (modulo a slight glitch in the C++ grammar
- * in the distribution version of 2.5.5).
- */
-# if !defined(__GNUC__) || __GNUC__ < 2 || \
- (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
-# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-# define __dead __volatile
-# define __pure __const
-# endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) */
-# endif /* !defined(__GNUC__) || __GNUC__ < 2 || \ */
-
-/* Delete pseudo-keywords wherever they are not available or needed. */
-# ifndef __dead
-# define __dead
-# define __pure
-# endif /* ! __dead */
-
-#endif /* ! _CDEFS_H_ */
diff --git a/gnu/usr.sbin/sendmail/include/sendmail/errstring.h b/gnu/usr.sbin/sendmail/include/sendmail/errstring.h
deleted file mode 100644
index 9cc40e9b7e5..00000000000
--- a/gnu/usr.sbin/sendmail/include/sendmail/errstring.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- *
- * $Sendmail: errstring.h,v 8.6.4.1 2000/05/26 18:24:13 geir Exp $
- */
-
-/*
-** ERRSTRING.H -- Error codes.
-*/
-
-#include <errno.h>
-
-extern int errno;
-
-/*
-** These are used in a few cases where we need some special
-** error codes, but where the system doesn't provide something
-** reasonable. They are printed in errstring.
-*/
-
-#ifndef E_PSEUDOBASE
-# define E_PSEUDOBASE 256
-#endif /* ! E_PSEUDOBASE */
-
-#define E_SM_OPENTIMEOUT (E_PSEUDOBASE + 0) /* Timeout on file open */
-#define E_SM_NOSLINK (E_PSEUDOBASE + 1) /* Symbolic links not allowed */
-#define E_SM_NOHLINK (E_PSEUDOBASE + 2) /* Hard links not allowed */
-#define E_SM_REGONLY (E_PSEUDOBASE + 3) /* Regular files only */
-#define E_SM_ISEXEC (E_PSEUDOBASE + 4) /* Executable files not allowed */
-#define E_SM_WWDIR (E_PSEUDOBASE + 5) /* World writable directory */
-#define E_SM_GWDIR (E_PSEUDOBASE + 6) /* Group writable directory */
-#define E_SM_FILECHANGE (E_PSEUDOBASE + 7) /* File changed after open */
-#define E_SM_WWFILE (E_PSEUDOBASE + 8) /* World writable file */
-#define E_SM_GWFILE (E_PSEUDOBASE + 9) /* Group writable file */
-#define E_SM_GRFILE (E_PSEUDOBASE + 10) /* g readable file */
-#define E_SM_WRFILE (E_PSEUDOBASE + 11) /* o readable file */
-#define E_DNSBASE (E_PSEUDOBASE + 20) /* base for DNS h_errno */
-#define E_SMDBBASE (E_PSEUDOBASE + 40) /* base for libsmdb errors */
-#define E_LDAPBASE (E_PSEUDOBASE + 70) /* base for LDAP errors */
-
-/* libsmdb */
-#define SMDBE_OK 0
-#define SMDBE_MALLOC (E_SMDBBASE + 1)
-#define SMDBE_GDBM_IS_BAD (E_SMDBBASE + 2)
-#define SMDBE_UNSUPPORTED (E_SMDBBASE + 3)
-#define SMDBE_DUPLICATE (E_SMDBBASE + 4)
-#define SMDBE_BAD_OPEN (E_SMDBBASE + 5)
-#define SMDBE_NOT_FOUND (E_SMDBBASE + 6)
-#define SMDBE_UNKNOWN_DB_TYPE (E_SMDBBASE + 7)
-#define SMDBE_UNSUPPORTED_DB_TYPE (E_SMDBBASE + 8)
-#define SMDBE_INCOMPLETE (E_SMDBBASE + 9)
-#define SMDBE_KEY_EMPTY (E_SMDBBASE + 10)
-#define SMDBE_KEY_EXIST (E_SMDBBASE + 11)
-#define SMDBE_LOCK_DEADLOCK (E_SMDBBASE + 12)
-#define SMDBE_LOCK_NOT_GRANTED (E_SMDBBASE + 13)
-#define SMDBE_LOCK_NOT_HELD (E_SMDBBASE + 14)
-#define SMDBE_RUN_RECOVERY (E_SMDBBASE + 15)
-#define SMDBE_IO_ERROR (E_SMDBBASE + 16)
-#define SMDBE_READ_ONLY (E_SMDBBASE + 17)
-#define SMDBE_DB_NAME_TOO_LONG (E_SMDBBASE + 18)
-#define SMDBE_INVALID_PARAMETER (E_SMDBBASE + 19)
-#define SMDBE_ONLY_SUPPORTS_ONE_CURSOR (E_SMDBBASE + 20)
-#define SMDBE_NOT_A_VALID_CURSOR (E_SMDBBASE + 21)
-#define SMDBE_LAST_ENTRY (E_SMDBBASE + 22)
-#define SMDBE_OLD_VERSION (E_SMDBBASE + 23)
-
-extern const char *errstring __P((int));
diff --git a/gnu/usr.sbin/sendmail/include/sendmail/useful.h b/gnu/usr.sbin/sendmail/include/sendmail/useful.h
deleted file mode 100644
index 10f35a12707..00000000000
--- a/gnu/usr.sbin/sendmail/include/sendmail/useful.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- * Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- *
- * $Sendmail: useful.h,v 8.18 1999/07/13 15:05:57 ca Exp $
- */
-
-#ifndef _USEFUL_H
-# define _USEFUL_H
-
-# include <sys/types.h>
-
-/* support for bool type */
-typedef int bool;
-# ifndef TRUE
-# define TRUE 1
-# define FALSE 0
-# endif /* ! TRUE */
-
-# ifndef NULL
-# define NULL 0
-# endif /* ! NULL */
-
-/* bit hacking */
-# define bitset(bit, word) (((word) & (bit)) != 0)
-
-/* some simple functions */
-# ifndef max
-# define max(a, b) ((a) > (b) ? (a) : (b))
-# define min(a, b) ((a) < (b) ? (a) : (b))
-# endif /* ! max */
-
-/* assertions */
-# ifndef NASSERT
-# define ASSERT(expr, msg, parm)\
- if (!(expr))\
- {\
- fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\
- fprintf(stderr, msg, parm);\
- }
-# else /* ! NASSERT */
-# define ASSERT(expr, msg, parm)
-# endif /* ! NASSERT */
-
-/* sccs id's */
-# ifndef lint
-# ifdef __STDC__
-# define SCCSID(arg) static char SccsId[] = #arg;
-# else /* __STDC__ */
-# define SCCSID(arg) static char SccsId[] = "arg";
-# endif /* __STDC__ */
-# else /* ! lint */
-# define SCCSID(arg)
-# endif /* ! lint */
-#endif /* ! _USEFUL_H */
diff --git a/gnu/usr.sbin/sendmail/libsm/Build b/gnu/usr.sbin/sendmail/libsm/Build
deleted file mode 100644
index 79cd9be1bbb..00000000000
--- a/gnu/usr.sbin/sendmail/libsm/Build
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
-# All rights reserved.
-#
-# By using this file, you agree to the terms and conditions set
-# forth in the LICENSE file which can be found at the top level of
-# the sendmail distribution.
-#
-#
-# $Sendmail: Build,v 1.4 2001/02/14 04:39:46 gshapiro Exp $
-
-exec sh ../devtools/bin/Build $*
diff --git a/gnu/usr.sbin/sendmail/libsm/Makefile.m4 b/gnu/usr.sbin/sendmail/libsm/Makefile.m4
deleted file mode 100644
index f0f89cbf92b..00000000000
--- a/gnu/usr.sbin/sendmail/libsm/Makefile.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-define(`confREQUIRE_LIBUNIX')
-include(confBUILDTOOLSDIR`/M4/switch.m4')
-
-define(`confREQUIRE_LIBSM', `true')
-PREPENDDEF(`confENVDEF', `confMAPDEF')
-bldPRODUCT_START(`library', `libsm')
-define(`bldSOURCES', ` assert.c debug.c errstring.c exc.c heap.c match.c rpool.c strdup.c strerror.c strl.c clrerr.c fclose.c feof.c ferror.c fflush.c fget.c fpos.c findfp.c flags.c fopen.c fprintf.c fpurge.c fput.c fread.c fscanf.c fseek.c fvwrite.c fwalk.c fwrite.c get.c makebuf.c put.c refill.c rewind.c setvbuf.c smstdio.c snprintf.c sscanf.c stdio.c strio.c ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c vsnprintf.c vsprintf.c vsscanf.c wbuf.c wsetup.c string.c stringf.c xtrap.c strto.c test.c path.c strcasecmp.c strrevcmp.c signal.c clock.c config.c shm.c mbdb.c strexit.c cf.c ldap.c niprop.c ')
-bldPRODUCT_END
-dnl sem.c msg.c
-dnl syslogio.c
-
-include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/sm-test.m4')
-smtest(`t-event', `run')
-smtest(`t-exc', `run')
-smtest(`t-rpool', `run')
-smtest(`t-string', `run')
-smtest(`t-smstdio', `run')
-smtest(`t-match', `run')
-smtest(`t-strio', `run')
-smtest(`t-heap', `run')
-smtest(`t-fopen', `run')
-smtest(`t-strl', `run')
-smtest(`t-strrevcmp', `run')
-smtest(`t-types', `run')
-smtest(`t-path', `run')
-smtest(`t-float', `run')
-smtest(`t-scanf', `run')
-smtest(`t-shm', `run')
-dnl smtest(`t-sem', `run')
-dnl smtest(`t-msg', `run')
-smtest(`t-cf')
-smtest(`b-strcmp')
-smtest(`b-strl')
-
-bldFINISH
diff --git a/gnu/usr.sbin/sendmail/libsmutil/errstring.c b/gnu/usr.sbin/sendmail/libsmutil/errstring.c
deleted file mode 100644
index a41631396d0..00000000000
--- a/gnu/usr.sbin/sendmail/libsmutil/errstring.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- */
-
-#ifndef lint
-static char id[] = "@(#)$Sendmail: errstring.c,v 8.8.4.1 2000/05/26 18:16:28 geir Exp $";
-#endif /* ! lint */
-
-#include <sendmail.h>
-
-/*
-** ERRSTRING -- return string description of error code
-**
-** Parameters:
-** errnum -- the error number to translate
-**
-** Returns:
-** A string description of errnum.
-**
-** Side Effects:
-** none.
-*/
-
-const char *
-errstring(errnum)
- int errnum;
-{
-#if !HASSTRERROR && !defined(ERRLIST_PREDEFINED)
- extern char *sys_errlist[];
- extern int sys_nerr;
-#endif /* !HASSTRERROR && !defined(ERRLIST_PREDEFINED) */
-
- /*
- ** Handle special network error codes.
- **
- ** These are 4.2/4.3bsd specific; they should be in daemon.c.
- */
-
- switch (errnum)
- {
- case EPERM:
- /* SunOS gives "Not owner" -- this is the POSIX message */
- return "Operation not permitted";
-
- /*
- ** Error messages used internally in sendmail.
- */
-
- case E_SM_OPENTIMEOUT:
- return "Timeout on file open";
-
- case E_SM_NOSLINK:
- return "Symbolic links not allowed";
-
- case E_SM_NOHLINK:
- return "Hard links not allowed";
-
- case E_SM_REGONLY:
- return "Regular files only";
-
- case E_SM_ISEXEC:
- return "Executable files not allowed";
-
- case E_SM_WWDIR:
- return "World writable directory";
-
- case E_SM_GWDIR:
- return "Group writable directory";
-
- case E_SM_FILECHANGE:
- return "File changed after open";
-
- case E_SM_WWFILE:
- return "World writable file";
-
- case E_SM_GWFILE:
- return "Group writable file";
-
- case E_SM_GRFILE:
- return "Group readable file";
-
- case E_SM_WRFILE:
- return "World readable file";
-
- /*
- ** DNS error messages.
- */
-
-#if NAMED_BIND
- case HOST_NOT_FOUND + E_DNSBASE:
- return "Name server: host not found";
-
- case TRY_AGAIN + E_DNSBASE:
- return "Name server: host name lookup failure";
-
- case NO_RECOVERY + E_DNSBASE:
- return "Name server: non-recoverable error";
-
- case NO_DATA + E_DNSBASE:
- return "Name server: no data known";
-#endif /* NAMED_BIND */
-
- /*
- ** libsmdb error messages.
- */
-
- case SMDBE_MALLOC:
- return "Memory allocation failed";
-
- case SMDBE_GDBM_IS_BAD:
- return "GDBM is not supported";
-
- case SMDBE_UNSUPPORTED:
- return "Unsupported action";
-
- case SMDBE_DUPLICATE:
- return "Key already exists";
-
- case SMDBE_BAD_OPEN:
- return "Database open failed";
-
- case SMDBE_NOT_FOUND:
- return "Key not found";
-
- case SMDBE_UNKNOWN_DB_TYPE:
- return "Unknown database type";
-
- case SMDBE_UNSUPPORTED_DB_TYPE:
- return "Support for database type not compiled into this program";
-
- case SMDBE_INCOMPLETE:
- return "DB sync did not finish";
-
- case SMDBE_KEY_EMPTY:
- return "Key is empty";
-
- case SMDBE_KEY_EXIST:
- return "Key already exists";
-
- case SMDBE_LOCK_DEADLOCK:
- return "Locker killed to resolve deadlock";
-
- case SMDBE_LOCK_NOT_GRANTED:
- return "Lock unavailable";
-
- case SMDBE_LOCK_NOT_HELD:
- return "Lock not held by locker";
-
- case SMDBE_RUN_RECOVERY:
- return "Database panic, run recovery";
-
- case SMDBE_IO_ERROR:
- return "I/O error";
-
- case SMDBE_READ_ONLY:
- return "Database opened read-only";
-
- case SMDBE_DB_NAME_TOO_LONG:
- return "Name too long";
-
- case SMDBE_INVALID_PARAMETER:
- return "Invalid parameter";
-
- case SMDBE_ONLY_SUPPORTS_ONE_CURSOR:
- return "Only one cursor allowed";
-
- case SMDBE_NOT_A_VALID_CURSOR:
- return "Invalid cursor";
-
- case SMDBE_OLD_VERSION:
- return "Berkeley DB file is an old version, recreate it";
- }
-
- /*
- ** LDAP error messages.
- */
-
-#ifdef LDAPMAP
- if (errnum >= E_LDAPBASE)
- return ldap_err2string(errnum - E_LDAPBASE);
-#endif /* LDAPMAP */
-
-#if HASSTRERROR
- return strerror(errnum);
-#else /* HASSTRERROR */
- if (errnum > 0 && errnum < sys_nerr)
- return sys_errlist[errnum];
- else
- {
- static char buf[MAXLINE];
-
- (void) snprintf(buf, sizeof buf, "Error %d", errnum);
- return buf;
- }
-#endif /* HASSTRERROR */
-}
-
diff --git a/gnu/usr.sbin/sendmail/libsmutil/strl.c b/gnu/usr.sbin/sendmail/libsmutil/strl.c
deleted file mode 100644
index aa24ee0f77c..00000000000
--- a/gnu/usr.sbin/sendmail/libsmutil/strl.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- */
-
-#ifndef lint
-static char id[] = "@(#)$Sendmail: strl.c,v 8.5.14.2 2000/09/17 17:04:24 gshapiro Exp $";
-#endif /* ! lint */
-
-#include <sendmail.h>
-
-#if !HASSTRL
- /*
-** strlcpy -- copy string obeying length and '\0' terminate it
-**
-** terminates with '\0' if len > 0
-**
-** Parameters:
-** dst -- "destination" string.
-** src -- "from" string.
-** len -- length of space available in "destination" string.
-**
-** Returns:
-** total length of the string tried to create (=strlen(src))
-** if this is greater than len then an overflow would have
-** occurred.
-*/
-
-size_t
-strlcpy(dst, src, len)
- register char *dst;
- register const char *src;
- size_t len;
-{
- register size_t i;
-
- if (len-- <= 0)
- return strlen(src);
- for (i = 0; i < len && (dst[i] = src[i]) != 0; i++)
- continue;
- dst[i] = '\0';
- if (src[i] == '\0')
- return i;
- else
- return i + strlen(src + i);
-}
- /*
-** strlcat -- catenate strings obeying length and '\0' terminate it
-**
-** strlcat will append at most len - strlen(dst) - 1 chars.
-** terminates with '\0' if len > 0
-**
-** Parameters:
-** dst -- "destination" string.
-** src -- "from" string.
-** len -- max. length of "destination" string.
-**
-** Returns:
-** total length of the string tried to create
-** (= initial length of dst + length of src)
-** if this is greater than len then an overflow would have
-** occurred.
-*/
-
-size_t
-strlcat(dst, src, len)
- register char *dst;
- register const char *src;
- size_t len;
-{
- register size_t i, j, o;
-
- o = strlen(dst);
- if (len < o + 1)
- return o + strlen(src);
- len -= o + 1;
- for (i = 0, j = o; i < len && (dst[j] = src[i]) != 0; i++, j++)
- continue;
- dst[j] = '\0';
- if (src[i] == '\0')
- return j;
- else
- return j + strlen(src + i);
-}
-
-#endif /* !HASSTRL */
diff --git a/gnu/usr.sbin/sendmail/sendmail/bf_portable.c b/gnu/usr.sbin/sendmail/sendmail/bf_portable.c
deleted file mode 100644
index 6ed3f10e68b..00000000000
--- a/gnu/usr.sbin/sendmail/sendmail/bf_portable.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- * Contributed by Exactis.com, Inc.
- *
- */
-
-#ifndef lint
-static char id[] = "@(#)$Sendmail: bf_portable.c,v 8.25.4.6 2001/05/03 17:24:01 gshapiro Exp $";
-#endif /* ! lint */
-
-#if SFIO
-# include <sfio/stdio.h>
-#endif /* SFIO */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/uio.h>
-#include <errno.h>
-#if !SFIO
-# include <stdio.h>
-#endif /* !SFIO */
-#ifdef BF_STANDALONE
-# define sm_free free
-# define xalloc malloc
-#else /* BF_STANDALONE */
-# include "sendmail.h"
-#endif /* BF_STANDALONE */
-#include "bf_portable.h"
-#include "bf.h"
-
- /*
-** BFOPEN -- create a new buffered file
-**
-** Parameters:
-** filename -- the file's name
-** fmode -- what mode the file should be created as
-** bsize -- amount of buffer space to allocate (may be 0)
-** flags -- if running under sendmail, passed directly to safeopen
-**
-** Returns:
-** a FILE * which may then be used with stdio functions, or NULL
-** on failure. FILE * is opened for writing (mode "w+").
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** ENOMEM -- out of memory
-** ENOENT -- illegal empty filename specified
-** any value of errno specified by open()
-** any value of errno specified by fdopen()
-** any value of errno specified by funopen()
-*/
-
-#ifdef BF_STANDALONE
-# define OPEN(fn, omode, cmode, sff) open(fn, omode, cmode)
-#else /* BF_STANDALONE */
-# define OPEN(fn, omode, cmode, sff) safeopen(fn, omode, cmode, sff)
-#endif /* BF_STANDALONE */
-
-/* List of currently-open buffered files */
-struct bf *bflist = NULL;
-
-FILE *
-bfopen(filename, fmode, bsize, flags)
- char *filename;
- int fmode;
- size_t bsize;
- long flags;
-{
- struct bf *bfp;
- FILE *retval;
- int fd, l;
-
- fd = OPEN(filename, O_RDWR | O_CREAT | O_TRUNC, fmode, flags);
- if (fd == -1)
- {
- /* errno is set implicitly by open */
- return NULL;
- }
-
- retval = fdopen(fd, "w+");
-
- /* If failure, return immediately */
- if (retval == NULL)
- {
- /* errno is set implicitly by fdopen */
- return NULL;
- }
-
- /* Allocate memory */
- bfp = (struct bf *)xalloc(sizeof(struct bf));
- if (bfp == NULL)
- {
- (void) fclose(retval);
-
- /* don't care about errors */
- (void) unlink(filename);
- errno = ENOMEM;
- return NULL;
- }
- if (tTd(58, 8))
- dprintf("bfopen(%s): malloced %ld\n",
- filename, (long) sizeof(struct bf));
-
- l = strlen(filename) + 1;
- bfp->bf_filename = (char *)xalloc(l);
- if (bfp->bf_filename == NULL)
- {
- sm_free(bfp);
- (void) fclose(retval);
-
- /* don't care about errors */
- (void) unlink(filename);
- errno = ENOMEM;
- return NULL;
- }
- (void) strlcpy(bfp->bf_filename, filename, l);
-
- /* Fill in the other fields, then add it to the list */
- bfp->bf_key = retval;
- bfp->bf_committed = FALSE;
- bfp->bf_refcount = 1;
-
- bfinsert(bfp);
-
- /* Whew. Nothing bad happened. We're okay. */
- return retval;
-}
- /*
-** BFDUP -- increase refcount on buffered file
-**
-** Parameters:
-** fp -- FILE * to "duplicate"
-**
-** Returns:
-** fp with increased refcount
-*/
-
-FILE *
-bfdup(fp)
- FILE *fp;
-{
- struct bf *bfp;
-
- /* Get associated bf structure */
- bfp = bflookup(fp);
-
- if (bfp == NULL)
- return NULL;
-
- /* Increase the refcount */
- bfp->bf_refcount++;
-
- return fp;
-}
-
- /*
-** BFCOMMIT -- "commits" the buffered file
-**
-** Parameters:
-** fp -- FILE * to commit to disk
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Side Effects:
-** Forces the given FILE * to be written to disk if it is not
-** already, and ensures that it will be kept after closing. If
-** fp is not a buffered file, this is a no-op.
-**
-** Sets errno:
-** any value of errno specified by open()
-** any value of errno specified by write()
-** any value of errno specified by lseek()
-*/
-
-int
-bfcommit(fp)
- FILE *fp;
-{
- struct bf *bfp;
-
- /* Get associated bf structure */
- bfp = bflookup(fp);
-
- /* If called on a normal FILE *, noop */
- if (bfp != NULL)
- bfp->bf_committed = TRUE;
-
- return 0;
-}
-
- /*
-** BFREWIND -- rewinds the FILE *
-**
-** Parameters:
-** fp -- FILE * to rewind
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Side Effects:
-** rewinds the FILE * and puts it into read mode. Normally one
-** would bfopen() a file, write to it, then bfrewind() and
-** fread(). If fp is not a buffered file, this is equivalent to
-** rewind().
-**
-** Sets errno:
-** any value of errno specified by fseek()
-*/
-
-int
-bfrewind(fp)
- FILE *fp;
-{
- int err;
-
- /* check to see if there is an error on the stream */
- err = ferror(fp);
- (void) fflush(fp);
-
- /*
- ** Clear error if tried to fflush()
- ** a read-only file pointer and
- ** there wasn't a previous error.
- */
-
- if (err == 0)
- clearerr(fp);
-
- /* errno is set implicitly by fseek() before return */
- return fseek(fp, 0, SEEK_SET);
-}
-
- /*
-** BFTRUNCATE -- rewinds and truncates the FILE *
-**
-** Parameters:
-** fp -- FILE * to truncate
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Side Effects:
-** rewinds the FILE *, truncates it to zero length, and puts it
-** into write mode. If fp is not a buffered file, this is
-** equivalent to a rewind() and then an ftruncate(fileno(fp), 0).
-**
-** Sets errno:
-** any value of errno specified by fseek()
-** any value of errno specified by ftruncate()
-*/
-
-int
-bftruncate(fp)
- FILE *fp;
-{
- int ret;
-
- if (bfrewind(fp) == -1)
- {
- /* errno is set implicitly by bfrewind() */
- return -1;
- }
-
-#if NOFTRUNCATE
- /* XXX */
- errno = EINVAL;
- ret = -1;
-#else /* NOFTRUNCATE */
- /* errno is set implicitly by ftruncate() before return */
- ret = ftruncate(fileno(fp), 0);
-#endif /* NOFTRUNCATE */
- return ret;
-}
-
- /*
-** BFFSYNC -- fsync the fd associated with the FILE *
-**
-** Parameters:
-** fp -- FILE * to fsync
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Sets errno:
-** EINVAL if FILE * not bfcommitted yet.
-** any value of errno specified by fsync()
-*/
-
-int
-bffsync(fp)
- FILE *fp;
-{
- int fd;
- struct bf *bfp;
-
- /* Get associated bf structure */
- bfp = bflookup(fp);
-
- /* If called on a normal FILE *, noop */
- if (bfp != NULL && !bfp->bf_committed)
- fd = -1;
- else
- fd = fileno(fp);
-
- if (tTd(58, 10))
- dprintf("bffsync: fd = %d\n", fd);
-
- if (fd < 0)
- {
- errno = EINVAL;
- return -1;
- }
- return fsync(fd);
-}
-
- /*
-** BFCLOSE -- close a buffered file
-**
-** Parameters:
-** fp -- FILE * to close
-**
-** Returns:
-** 0 on success, EOF on failure
-**
-** Side Effects:
-** Closes fp. If fp is a buffered file, unlink it if it has not
-** already been committed. If fp is not a buffered file, this is
-** equivalent to fclose().
-**
-** Sets errno:
-** any value of errno specified by fclose()
-*/
-
-int
-bfclose(fp)
- FILE *fp;
-{
- int retval;
- struct bf *bfp = NULL;
-
- /* Get associated bf structure */
- bfp = bflookup(fp);
-
- /* Decrement and check refcount */
- if (bfp != NULL && --bfp->bf_refcount > 0)
- return 0;
-
- /* If bf, get bf structure and remove from list */
- if (bfp != NULL)
- bfp = bfdelete(fp);
-
- if (fclose(fp) == EOF)
- {
- if (tTd(58, 8))
- dprintf("bfclose: fclose failed\n");
- /* errno is set implicitly by fclose() */
- return -1;
- }
-
- if (bfp == NULL)
- return 0;
-
- /* Success unless we determine otherwise in next block */
- retval = 0;
-
- if (bfp != NULL)
- {
- /* Might have to unlink; certainly will have to deallocate */
- if (!bfp->bf_committed)
- retval = unlink(bfp->bf_filename);
-
- sm_free(bfp->bf_filename);
- sm_free(bfp);
- if (tTd(58, 8))
- dprintf("bfclose: freed %ld\n",
- (long) sizeof(struct bf));
- }
- else
- {
- if (tTd(58, 8))
- dprintf("bfclose: bfp was NULL\n");
- }
-
- return retval;
-}
-
- /*
-** BFTEST -- test if a FILE * is a buffered file
-**
-** Parameters:
-** fp -- FILE * to test
-**
-** Returns:
-** TRUE if fp is a buffered file, FALSE otherwise.
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** never.
-*/
-
-bool
-bftest(fp)
- FILE *fp;
-{
- return (bflookup(fp) != NULL);
-}
-
- /*
-** BFINSERT -- insert item in linking list
-**
-** Parameters:
-** datum -- item to insert
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** never.
-*/
-
-void
-bfinsert(datum)
- struct bf *datum;
-{
- datum->bf_cdr = bflist;
- bflist = datum;
-}
-
- /*
-** BFLOOKUP -- lookup FILE * in list
-**
-** Parameters:
-** fp -- FILE * to lookup
-**
-** Returns:
-** bf struct for the FILE *, NULL if not found
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** never.
-*/
-
-struct bf *
-bflookup(key)
- FILE *key;
-{
- struct bf *t;
-
- for (t = bflist; t != NULL; t = t->bf_cdr)
- {
- if (t->bf_key == key)
- {
- return t;
- }
- }
-
- /* If we got this far, we didn't find it */
- return NULL;
-}
-
- /*
-** BFDELETE -- delete a FILE * in list
-**
-** Parameters:
-** fp -- FILE * to delete
-**
-** Returns:
-** bf struct for deleted FILE *, NULL if not found,
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** never.
-*/
-
-struct bf *
-bfdelete(key)
- FILE *key;
-{
- struct bf *t, *u;
-
- if (bflist == NULL)
- return NULL;
-
- /* if first element, special case */
- if (bflist->bf_key == key)
- {
- u = bflist;
- bflist = bflist->bf_cdr;
- return u;
- }
-
- for (t = bflist; t->bf_cdr != NULL; t = t->bf_cdr)
- {
- if (t->bf_cdr->bf_key == key)
- {
- u = t->bf_cdr;
- t->bf_cdr = u->bf_cdr;
- return u;
- }
- }
-
- /* If we got this far, we didn't find it */
- return NULL;
-}
diff --git a/gnu/usr.sbin/sendmail/sendmail/bf_portable.h b/gnu/usr.sbin/sendmail/sendmail/bf_portable.h
deleted file mode 100644
index d1b7b1cace1..00000000000
--- a/gnu/usr.sbin/sendmail/sendmail/bf_portable.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- * $Sendmail: bf_portable.h,v 8.6 1999/11/04 19:31:25 ca Exp $
- *
- * Contributed by Exactis.com, Inc.
- *
- */
-
-#ifndef BF_PORTABLE_H
-#define BF_PORTABLE_H 1
-/*
-** This implementation will behave differently from the Torek-based code in
-** the following major ways:
-** - The buffer size argument to bfopen() will be sent in, sent back,
-** queried, lost, found, subjected to public inquiry, lost again, and
-** finally buried in soft peat and recycled as firelighters.
-** - Errors in creating the file (but not necessarily writing to it) will
-** always be detected and reported synchronously with the bfopen()
-*/
-
-/* Linked structure for storing information about each buffered file */
-struct bf
-{
- FILE *bf_key; /* Unused except as a key for lookup */
- bool bf_committed; /* buffered file is on disk */
- char *bf_filename; /* Name of disk file */
- int bf_refcount; /* Reference count */
- struct bf *bf_cdr;
-};
-
-/*
-** Access routines for looking up bf structures
-**
-** maybe replace with a faster data structure later
-*/
-
-extern void bfinsert __P((struct bf *));
-extern struct bf *bflookup __P((FILE *));
-extern struct bf *bfdelete __P((FILE *));
-#endif /* BF_PORTABLE_H */
diff --git a/gnu/usr.sbin/sendmail/sendmail/bf_torek.c b/gnu/usr.sbin/sendmail/sendmail/bf_torek.c
deleted file mode 100644
index 308df128470..00000000000
--- a/gnu/usr.sbin/sendmail/sendmail/bf_torek.c
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- * Contributed by Exactis.com, Inc.
- *
- */
-
-#ifndef lint
-static char id[] = "@(#)$Sendmail: bf_torek.c,v 8.19.18.6 2001/05/08 06:52:19 gshapiro Exp $";
-#endif /* ! lint */
-
-#if SFIO
- ERROR README: Can not use bf_torek.c with SFIO.
-#endif /* SFIO */
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#ifdef BF_STANDALONE
-# define sm_free free
-# define xalloc malloc
-#else /* BF_STANDALONE */
-# include "sendmail.h"
-#endif /* BF_STANDALONE */
-#include "bf_torek.h"
-#include "bf.h"
-
- /*
-** BFOPEN -- create a new buffered file
-**
-** Parameters:
-** filename -- the file's name
-** fmode -- what mode the file should be created as
-** bsize -- amount of buffer space to allocate (may be 0)
-** flags -- if running under sendmail, passed directly to safeopen
-**
-** Returns:
-** a FILE * which may then be used with stdio functions, or NULL
-** on failure. FILE * is opened for writing (mode "w+").
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** ENOMEM -- out of memory
-** ENOENT -- illegal empty filename specified
-** any value of errno specified by open()
-** any value of errno specified by fdopen()
-** any value of errno specified by funopen()
-*/
-
-#ifdef BF_STANDALONE
-# define OPEN(fn, omode, cmode, sff) open(fn, omode, cmode)
-#else /* BF_STANDALONE */
-# define OPEN(fn, omode, cmode, sff) safeopen(fn, omode, cmode, sff)
-#endif /* BF_STANDALONE */
-
-FILE *
-bfopen(filename, fmode, bsize, flags)
- char *filename;
- int fmode;
- size_t bsize;
- long flags;
-{
- struct bf *bfp;
- FILE *retval;
- int save_errno, l;
- struct stat st;
-
- /* Sanity checks */
- /* Empty filename string */
- if (*filename == '\0')
- {
- errno = ENOENT;
- return NULL;
- }
-
- if (stat(filename, &st) == 0)
- {
- /* file already exists on disk */
- errno = EEXIST;
- return NULL;
- }
-
- /* Allocate memory */
- bfp = (struct bf *)xalloc(sizeof(struct bf));
- if (bfp == NULL)
- {
- errno = ENOMEM;
- return NULL;
- }
-
- /* A zero bsize is valid, just don't allocate memory */
- if (bsize > 0)
- {
- bfp->bf_buf = (char *)xalloc(bsize);
- if (bfp->bf_buf == NULL)
- {
- sm_free(bfp);
- errno = ENOMEM;
- return NULL;
- }
- }
- else
- bfp->bf_buf = NULL;
-
- /* Nearly home free, just set all the parameters now */
- bfp->bf_committed = FALSE;
- bfp->bf_ondisk = FALSE;
- bfp->bf_refcount = 1;
- bfp->bf_flags = flags;
- bfp->bf_bufsize = bsize;
- bfp->bf_buffilled = 0;
- l = strlen(filename) + 1;
- bfp->bf_filename = (char *)xalloc(l);
- if (bfp->bf_filename == NULL)
- {
- if (bfp->bf_buf != NULL)
- sm_free(bfp->bf_buf);
- sm_free(bfp);
- errno = ENOMEM;
- return NULL;
- }
- (void) strlcpy(bfp->bf_filename, filename, l);
- bfp->bf_filemode = fmode;
- bfp->bf_offset = 0;
- bfp->bf_size = 0;
-
- if (tTd(58, 8))
- dprintf("bfopen(%s, %d)\n", filename, bsize);
-
- /* The big test: will funopen accept it? */
- retval = funopen((void *)bfp, _bfread, _bfwrite, _bfseek, _bfclose);
- if (retval == NULL)
- {
- /* Just in case free() sets errno */
- save_errno = errno;
- sm_free(bfp->bf_filename);
- if (bfp->bf_buf != NULL)
- sm_free(bfp->bf_buf);
- sm_free(bfp);
- errno = save_errno;
- return NULL;
- }
- else
- {
- /* Success */
- return retval;
- }
-}
- /*
-** BFDUP -- increase refcount on buffered file
-**
-** Parameters:
-** fp -- FILE * to "duplicate"
-**
-** Returns:
-** If file is memory buffered, fp with increased refcount
-** If file is on disk, NULL (need to use link())
-*/
-
-FILE *
-bfdup(fp)
- FILE *fp;
-{
- struct bf *bfp;
-
- /* If called on a normal FILE *, noop */
- if (!bftest(fp))
- return NULL;
-
- /* Get associated bf structure */
- bfp = (struct bf *)fp->_cookie;
-
- /* Increase ref count */
- bfp->bf_refcount++;
-
- return fp;
-}
-
- /*
-** BFCOMMIT -- "commits" the buffered file
-**
-** Parameters:
-** fp -- FILE * to commit to disk
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Side Effects:
-** Forces the given FILE * to be written to disk if it is not
-** already, and ensures that it will be kept after closing. If
-** fp is not a buffered file, this is a no-op.
-**
-** Sets errno:
-** any value of errno specified by open()
-** any value of errno specified by write()
-** any value of errno specified by lseek()
-*/
-
-int
-bfcommit(fp)
- FILE *fp;
-{
- struct bf *bfp;
- int retval;
- int byteswritten;
-
- /* If called on a normal FILE *, noop */
- if (!bftest(fp))
- return 0;
-
- /* Get associated bf structure */
- bfp = (struct bf *)fp->_cookie;
-
- /* If already committed, noop */
- if (bfp->bf_committed)
- return 0;
-
- /* Do we need to open a file? */
- if (!bfp->bf_ondisk)
- {
- struct stat st;
-
- if (tTd(58, 8))
- dprintf("bfcommit(%s): to disk\n", bfp->bf_filename);
-
- if (stat(bfp->bf_filename, &st) == 0)
- {
- errno = EEXIST;
- return -1;
- }
-
- retval = OPEN(bfp->bf_filename, O_RDWR | O_CREAT | O_TRUNC,
- bfp->bf_filemode, bfp->bf_flags);
-
- /* Couldn't create file: failure */
- if (retval < 0)
- {
- /* errno is set implicitly by open() */
- return -1;
- }
-
- bfp->bf_disk_fd = retval;
- bfp->bf_ondisk = TRUE;
- }
-
- /* Write out the contents of our buffer, if we have any */
- if (bfp->bf_buffilled > 0)
- {
- byteswritten = 0;
-
- if (lseek(bfp->bf_disk_fd, 0, SEEK_SET) < 0)
- {
- /* errno is set implicitly by lseek() */
- return -1;
- }
-
- while (byteswritten < bfp->bf_buffilled)
- {
- retval = write(bfp->bf_disk_fd,
- bfp->bf_buf + byteswritten,
- bfp->bf_buffilled - byteswritten);
- if (retval < 0)
- {
- /* errno is set implicitly by write() */
- return -1;
- }
- else
- byteswritten += retval;
- }
- }
- bfp->bf_committed = TRUE;
-
- /* Invalidate buf; all goes to file now */
- bfp->bf_buffilled = 0;
- if (bfp->bf_bufsize > 0)
- {
- /* Don't need buffer anymore; free it */
- bfp->bf_bufsize = 0;
- sm_free(bfp->bf_buf);
- }
- return 0;
-}
-
- /*
-** BFREWIND -- rewinds the FILE *
-**
-** Parameters:
-** fp -- FILE * to rewind
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Side Effects:
-** rewinds the FILE * and puts it into read mode. Normally one
-** would bfopen() a file, write to it, then bfrewind() and
-** fread(). If fp is not a buffered file, this is equivalent to
-** rewind().
-**
-** Sets errno:
-** any value of errno specified by fseek()
-*/
-
-int
-bfrewind(fp)
- FILE *fp;
-{
- int err;
-
- /* check to see if there is an error on the stream */
- err = ferror(fp);
- (void) fflush(fp);
-
- /*
- ** Clear error if tried to fflush()
- ** a read-only file pointer and
- ** there wasn't a previous error.
- */
-
- if (err == 0)
- clearerr(fp);
-
- /* errno is set implicitly by fseek() before return */
- return fseek(fp, 0, SEEK_SET);
-}
-
- /*
-** BFTRUNCATE -- rewinds and truncates the FILE *
-**
-** Parameters:
-** fp -- FILE * to truncate
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Side Effects:
-** rewinds the FILE *, truncates it to zero length, and puts it
-** into write mode. If fp is not a buffered file, this is
-** equivalent to a rewind() and then an ftruncate(fileno(fp), 0).
-**
-** Sets errno:
-** any value of errno specified by fseek()
-** any value of errno specified by ftruncate()
-*/
-
-int
-bftruncate(fp)
- FILE *fp;
-{
- struct bf *bfp;
-
- if (bfrewind(fp) < 0)
- return -1;
-
- if (bftest(fp))
- {
- /* Get bf structure */
- bfp = (struct bf *)fp->_cookie;
- bfp->bf_buffilled = 0;
- bfp->bf_size = 0;
-
- /* Need to zero the buffer */
- if (bfp->bf_bufsize > 0)
- memset(bfp->bf_buf, '\0', bfp->bf_bufsize);
- if (bfp->bf_ondisk)
- return ftruncate(bfp->bf_disk_fd, 0);
- else
- return 0;
- }
- else
- return ftruncate(fileno(fp), 0);
-}
-
- /*
-** BFFSYNC -- fsync the fd associated with the FILE *
-**
-** Parameters:
-** fp -- FILE * to fsync
-**
-** Returns:
-** 0 on success, -1 on error
-**
-** Sets errno:
-** EINVAL if FILE * not bfcommitted yet.
-** any value of errno specified by fsync()
-*/
-
-int
-bffsync(fp)
- FILE *fp;
-{
- int fd;
- struct bf *bfp;
-
- if (bftest(fp))
- {
- /* Get bf structure */
- bfp = (struct bf *)fp->_cookie;
-
- if (bfp->bf_ondisk && bfp->bf_committed)
- fd = bfp->bf_disk_fd;
- else
- fd = -1;
- }
- else
- fd = fileno(fp);
-
- if (tTd(58, 10))
- dprintf("bffsync: fd = %d\n", fd);
-
- if (fd < 0)
- {
- errno = EINVAL;
- return -1;
- }
- return fsync(fd);
-}
-
- /*
-** BFCLOSE -- close a buffered file
-**
-** Parameters:
-** fp -- FILE * to close
-**
-** Returns:
-** 0 on success, EOF on failure
-**
-** Side Effects:
-** Closes fp. If fp is a buffered file, unlink it if it has not
-** already been committed. If fp is not a buffered file, this is
-** equivalent to fclose().
-**
-** Sets errno:
-** any value of errno specified by fclose()
-*/
-
-int
-bfclose(fp)
- FILE *fp;
-{
- struct bf *bfp;
-
- /* If called on a normal FILE *, call fclose() on it */
- if (!bftest(fp))
- return fclose(fp);
-
- /* Cast cookie back to correct type */
- bfp = (struct bf *)fp->_cookie;
-
- /* Check reference count to see if we actually want to close */
- if (bfp != NULL && --bfp->bf_refcount > 0)
- return 0;
-
- /*
- ** In this implementation, just call fclose--the _bfclose
- ** routine will be called by that
- */
-
- return fclose(fp);
-}
-
- /*
-** BFTEST -- test if a FILE * is a buffered file
-**
-** Parameters:
-** fp -- FILE * to test
-**
-** Returns:
-** TRUE if fp is a buffered file, FALSE otherwise.
-**
-** Side Effects:
-** none.
-**
-** Sets errno:
-** never.
-*/
-
-bool
-bftest(fp)
- FILE *fp;
-{
- /*
- ** Check to see if our special I/O routines are installed
- ** in this file structure
- */
-
- return ((fp->_close == _bfclose) &&
- (fp->_read == _bfread) &&
- (fp->_seek == _bfseek) &&
- (fp->_write == _bfwrite));
-}
-
- /*
-** _BFCLOSE -- close a buffered file
-**
-** Parameters:
-** cookie -- cookie of file to close
-**
-** Returns:
-** 0 to indicate success
-**
-** Side Effects:
-** deletes backing file, frees memory.
-**
-** Sets errno:
-** never.
-*/
-
-int
-_bfclose(cookie)
- void *cookie;
-{
- struct bf *bfp;
-
- /* Cast cookie back to correct type */
- bfp = (struct bf *)cookie;
-
- /* Need to clean up the file */
- if (bfp->bf_ondisk && !bfp->bf_committed)
- unlink(bfp->bf_filename);
-
- /* Need to free the buffer */
- if (bfp->bf_bufsize > 0)
- sm_free(bfp->bf_buf);
-
- /* Finally, free the structure */
- sm_free(bfp);
-
- return 0;
-}
-
- /*
-** _BFREAD -- read a buffered file
-**
-** Parameters:
-** cookie -- cookie of file to read
-** buf -- buffer to fill
-** nbytes -- how many bytes to read
-**
-** Returns:
-** number of bytes read or -1 indicate failure
-**
-** Side Effects:
-** none.
-**
-*/
-
-int
-_bfread(cookie, buf, nbytes)
- void *cookie;
- char *buf;
- int nbytes;
-{
- struct bf *bfp;
- int count = 0; /* Number of bytes put in buf so far */
- int retval;
-
- /* Cast cookie back to correct type */
- bfp = (struct bf *)cookie;
-
- if (bfp->bf_offset < bfp->bf_buffilled)
- {
- /* Need to grab some from buffer */
- count = nbytes;
- if ((bfp->bf_offset + count) > bfp->bf_buffilled)
- count = bfp->bf_buffilled - bfp->bf_offset;
-
- memcpy(buf, bfp->bf_buf + bfp->bf_offset, count);
- }
-
- if ((bfp->bf_offset + nbytes) > bfp->bf_buffilled)
- {
- /* Need to grab some from file */
-
- if (!bfp->bf_ondisk)
- {
- /* Oops, the file doesn't exist. EOF. */
- goto finished;
- }
-
- /* Catch a read() on an earlier failed write to disk */
- if (bfp->bf_disk_fd < 0)
- {
- errno = EIO;
- return -1;
- }
-
- if (lseek(bfp->bf_disk_fd,
- bfp->bf_offset + count, SEEK_SET) < 0)
- {
- if ((errno == EINVAL) || (errno == ESPIPE))
- {
- /*
- ** stdio won't be expecting these
- ** errnos from read()! Change them
- ** into something it can understand.
- */
-
- errno = EIO;
- }
- return -1;
- }
-
- while (count < nbytes)
- {
- retval = read(bfp->bf_disk_fd,
- buf + count,
- nbytes - count);
- if (retval < 0)
- {
- /* errno is set implicitly by read() */
- return -1;
- }
- else if (retval == 0)
- goto finished;
- else
- count += retval;
- }
- }
-
-finished:
- bfp->bf_offset += count;
- return count;
-}
-
- /*
-** _BFSEEK -- seek to a position in a buffered file
-**
-** Parameters:
-** cookie -- cookie of file to seek
-** offset -- position to seek to
-** whence -- how to seek
-**
-** Returns:
-** new file offset or -1 indicate failure
-**
-** Side Effects:
-** none.
-**
-*/
-
-fpos_t
-_bfseek(cookie, offset, whence)
- void *cookie;
- fpos_t offset;
- int whence;
-
-{
- struct bf *bfp;
-
- /* Cast cookie back to correct type */
- bfp = (struct bf *)cookie;
-
- switch (whence)
- {
- case SEEK_SET:
- bfp->bf_offset = offset;
- break;
-
- case SEEK_CUR:
- bfp->bf_offset += offset;
- break;
-
- case SEEK_END:
- bfp->bf_offset = bfp->bf_size + offset;
- break;
-
- default:
- errno = EINVAL;
- return -1;
- }
- return bfp->bf_offset;
-}
-
- /*
-** _BFWRITE -- write to a buffered file
-**
-** Parameters:
-** cookie -- cookie of file to write
-** buf -- data buffer
-** nbytes -- how many bytes to write
-**
-** Returns:
-** number of bytes written or -1 indicate failure
-**
-** Side Effects:
-** may create backing file if over memory limit for file.
-**
-*/
-
-int
-_bfwrite(cookie, buf, nbytes)
- void *cookie;
- const char *buf;
- int nbytes;
-{
- struct bf *bfp;
- int count = 0; /* Number of bytes written so far */
- int retval;
-
- /* Cast cookie back to correct type */
- bfp = (struct bf *)cookie;
-
- /* If committed, go straight to disk */
- if (bfp->bf_committed)
- {
- if (lseek(bfp->bf_disk_fd, bfp->bf_offset, SEEK_SET) < 0)
- {
- if ((errno == EINVAL) || (errno == ESPIPE))
- {
- /*
- ** stdio won't be expecting these
- ** errnos from write()! Change them
- ** into something it can understand.
- */
-
- errno = EIO;
- }
- return -1;
- }
-
- count = write(bfp->bf_disk_fd, buf, nbytes);
- if (count < 0)
- {
- /* errno is set implicitly by write() */
- return -1;
- }
- goto finished;
- }
-
- if (bfp->bf_offset < bfp->bf_bufsize)
- {
- /* Need to put some in buffer */
- count = nbytes;
- if ((bfp->bf_offset + count) > bfp->bf_bufsize)
- count = bfp->bf_bufsize - bfp->bf_offset;
-
- memcpy(bfp->bf_buf + bfp->bf_offset, buf, count);
- if ((bfp->bf_offset + count) > bfp->bf_buffilled)
- bfp->bf_buffilled = bfp->bf_offset + count;
- }
-
- if ((bfp->bf_offset + nbytes) > bfp->bf_bufsize)
- {
- /* Need to put some in file */
- if (!bfp->bf_ondisk)
- {
- /* Oops, the file doesn't exist. */
- if (tTd(58, 8))
- dprintf("_bfwrite(%s): to disk\n",
- bfp->bf_filename);
-
- retval = OPEN(bfp->bf_filename,
- O_RDWR | O_CREAT | O_TRUNC,
- bfp->bf_filemode, bfp->bf_flags);
-
- /* Couldn't create file: failure */
- if (retval < 0)
- {
- /*
- ** stdio may not be expecting these
- ** errnos from write()! Change to
- ** something which it can understand.
- ** Note that ENOSPC and EDQUOT are saved
- ** because they are actually valid for
- ** write().
- */
-
- if (!((errno == ENOSPC) || (errno == EDQUOT)))
- errno = EIO;
-
- return -1;
- }
- bfp->bf_disk_fd = retval;
- bfp->bf_ondisk = TRUE;
- }
-
- /* Catch a write() on an earlier failed write to disk */
- if (bfp->bf_ondisk && bfp->bf_disk_fd < 0)
- {
- errno = EIO;
- return -1;
- }
-
- if (lseek(bfp->bf_disk_fd,
- bfp->bf_offset + count, SEEK_SET) < 0)
- {
- if ((errno == EINVAL) || (errno == ESPIPE))
- {
- /*
- ** stdio won't be expecting these
- ** errnos from write()! Change them into
- ** something which it can understand.
- */
-
- errno = EIO;
- }
- return -1;
- }
-
- while (count < nbytes)
- {
- retval = write(bfp->bf_disk_fd, buf + count,
- nbytes - count);
- if (retval < 0)
- {
- /* errno is set implicitly by write() */
- return -1;
- }
- else
- count += retval;
- }
- }
-
-finished:
- bfp->bf_offset += count;
- if (bfp->bf_offset > bfp->bf_size)
- bfp->bf_size = bfp->bf_offset;
- return count;
-}
diff --git a/gnu/usr.sbin/sendmail/sendmail/bf_torek.h b/gnu/usr.sbin/sendmail/sendmail/bf_torek.h
deleted file mode 100644
index cfd65bcaf7e..00000000000
--- a/gnu/usr.sbin/sendmail/sendmail/bf_torek.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- * $Sendmail: bf_torek.h,v 8.6 1999/11/04 19:31:25 ca Exp $
- *
- * Contributed by Exactis.com, Inc.
- *
- */
-
-#ifndef BF_TOREK_H
-#define BF_TOREK_H 1
-/*
-** Data structure for storing information about each buffered file
-*/
-
-struct bf
-{
- bool bf_committed; /* Has this buffered file been committed? */
- bool bf_ondisk; /* On disk: committed or buffer overflow */
- int bf_flags;
- int bf_disk_fd; /* If on disk, associated file descriptor */
- char *bf_buf; /* Memory buffer */
- int bf_bufsize; /* Length of above buffer */
- int bf_buffilled; /* Bytes of buffer actually filled */
- char *bf_filename; /* Name of buffered file, if ever committed */
- mode_t bf_filemode; /* Mode of buffered file, if ever committed */
- fpos_t bf_offset; /* Currect file offset */
- int bf_size; /* Total current size of file */
- int bf_refcount; /* Reference count */
-};
-
-/* Our lower-level I/O routines */
-extern int _bfclose __P((void *));
-extern int _bfread __P((void *, char *, int));
-extern fpos_t _bfseek __P((void *, fpos_t, int));
-extern int _bfwrite __P((void *, const char *, int));
-#endif /* BF_TOREK_H */
diff --git a/gnu/usr.sbin/sendmail/sendmail/clock.c b/gnu/usr.sbin/sendmail/sendmail/clock.c
deleted file mode 100644
index fef2352bf5b..00000000000
--- a/gnu/usr.sbin/sendmail/sendmail/clock.c
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- */
-
-#ifndef lint
-static char id[] = "@(#)$Sendmail: clock.c,v 8.52.18.18 2001/08/14 16:07:04 ca Exp $";
-#endif /* ! lint */
-
-#include <sendmail.h>
-
-#ifndef sigmask
-# define sigmask(s) (1 << ((s) - 1))
-#endif /* ! sigmask */
-
-static SIGFUNC_DECL sm_tick __P((int));
-static void endsleep __P((void));
-
-
-/*
-** SETEVENT -- set an event to happen at a specific time.
-**
-** Events are stored in a sorted list for fast processing.
-** An event only applies to the process that set it.
-**
-** Parameters:
-** intvl -- intvl until next event occurs.
-** func -- function to call on event.
-** arg -- argument to func on event.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-static EVENT *volatile EventQueue; /* head of event queue */
-static EVENT *volatile FreeEventList; /* list of free events */
-
-EVENT *
-setevent(intvl, func, arg)
- time_t intvl;
- void (*func)();
- int arg;
-{
- register EVENT *ev;
-
- if (intvl <= 0)
- {
- syserr("554 5.3.0 setevent: intvl=%ld\n", intvl);
- return NULL;
- }
-
- ENTER_CRITICAL();
- if (FreeEventList == NULL)
- {
- FreeEventList = (EVENT *) xalloc(sizeof *FreeEventList);
- FreeEventList->ev_link = NULL;
- }
- LEAVE_CRITICAL();
-
- ev = sigsafe_setevent(intvl, func, arg);
-
- if (tTd(5, 5))
- dprintf("setevent: intvl=%ld, for=%ld, func=%lx, arg=%d, ev=%lx\n",
- (long) intvl, (long) (curtime() + intvl),
- (u_long) func, arg,
- ev == NULL ? 0 : (u_long) ev);
-
- return ev;
-}
-
-/*
-**
-** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
-** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
-** DOING.
-*/
-
-EVENT *
-sigsafe_setevent(intvl, func, arg)
- time_t intvl;
- void (*func)();
- int arg;
-{
- register EVENT **evp;
- register EVENT *ev;
- auto time_t now;
- int wasblocked;
-
- if (intvl <= 0)
- return NULL;
-
- wasblocked = blocksignal(SIGALRM);
- now = curtime();
-
- /* search event queue for correct position */
- for (evp = (EVENT **) (&EventQueue);
- (ev = *evp) != NULL;
- evp = &ev->ev_link)
- {
- if (ev->ev_time >= now + intvl)
- break;
- }
-
- ENTER_CRITICAL();
- if (FreeEventList == NULL)
- {
- /*
- ** This shouldn't happen. If called from setevent(),
- ** we have just malloced a FreeEventList entry. If
- ** called from a signal handler, it should have been
- ** from an existing event which sm_tick() just added to the
- ** FreeEventList.
- */
-
- LEAVE_CRITICAL();
- return NULL;
- }
- else
- {
- ev = FreeEventList;
- FreeEventList = ev->ev_link;
- }
- LEAVE_CRITICAL();
-
- /* insert new event */
- ev->ev_time = now + intvl;
- ev->ev_func = func;
- ev->ev_arg = arg;
- ev->ev_pid = getpid();
- ENTER_CRITICAL();
- ev->ev_link = *evp;
- *evp = ev;
- LEAVE_CRITICAL();
-
- (void) setsignal(SIGALRM, sm_tick);
- intvl = EventQueue->ev_time - now;
- (void) alarm((unsigned) intvl < 1 ? 1 : intvl);
- if (wasblocked == 0)
- (void) releasesignal(SIGALRM);
- return ev;
-}
- /*
-** CLREVENT -- remove an event from the event queue.
-**
-** Parameters:
-** ev -- pointer to event to remove.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** arranges for event ev to not happen.
-*/
-
-void
-clrevent(ev)
- register EVENT *ev;
-{
- register EVENT **evp;
- int wasblocked;
-
- if (tTd(5, 5))
- dprintf("clrevent: ev=%lx\n", (u_long) ev);
- if (ev == NULL)
- return;
-
- /* find the parent event */
- wasblocked = blocksignal(SIGALRM);
- for (evp = (EVENT **) (&EventQueue);
- *evp != NULL;
- evp = &(*evp)->ev_link)
- {
- if (*evp == ev)
- break;
- }
-
- /* now remove it */
- if (*evp != NULL)
- {
- ENTER_CRITICAL();
- *evp = ev->ev_link;
- ev->ev_link = FreeEventList;
- FreeEventList = ev;
- LEAVE_CRITICAL();
- }
-
- /* restore clocks and pick up anything spare */
- if (wasblocked == 0)
- (void) releasesignal(SIGALRM);
- if (EventQueue != NULL)
- (void) kill(getpid(), SIGALRM);
- else
- {
- /* nothing left in event queue, no need for an alarm */
- (void) alarm(0);
- }
-}
- /*
-** CLEAR_EVENTS -- remove all events from the event queue.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-*/
-
-void
-clear_events()
-{
- register EVENT *ev;
- int wasblocked;
-
- if (tTd(5, 5))
- dprintf("clear_events: EventQueue=%lx\n", (u_long) EventQueue);
-
- if (EventQueue == NULL)
- return;
-
- /* nothing will be left in event queue, no need for an alarm */
- (void) alarm(0);
- wasblocked = blocksignal(SIGALRM);
-
- /* find the end of the EventQueue */
- for (ev = EventQueue; ev->ev_link != NULL; ev = ev->ev_link)
- continue;
-
- ENTER_CRITICAL();
- ev->ev_link = FreeEventList;
- FreeEventList = EventQueue;
- EventQueue = NULL;
- LEAVE_CRITICAL();
-
- /* restore clocks and pick up anything spare */
- if (wasblocked == 0)
- (void) releasesignal(SIGALRM);
-}
- /*
-** SM_TICK -- take a clock sm_tick
-**
-** Called by the alarm clock. This routine runs events as needed.
-** Always called as a signal handler, so we assume that SIGALRM
-** has been blocked.
-**
-** Parameters:
-** One that is ignored; for compatibility with signal handlers.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** calls the next function in EventQueue.
-**
-** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
-** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
-** DOING.
-*/
-
-/* ARGSUSED */
-static SIGFUNC_DECL
-sm_tick(sig)
- int sig;
-{
- register time_t now;
- register EVENT *ev;
- pid_t mypid;
- int save_errno = errno;
-
- (void) alarm(0);
-
- FIX_SYSV_SIGNAL(sig, sm_tick);
-
- errno = save_errno;
- CHECK_CRITICAL(sig);
-
- mypid = getpid();
- while (PendingSignal != 0)
- {
- int sigbit = 0;
- int sig = 0;
-
- if (bitset(PEND_SIGHUP, PendingSignal))
- {
- sigbit = PEND_SIGHUP;
- sig = SIGHUP;
- }
- else if (bitset(PEND_SIGINT, PendingSignal))
- {
- sigbit = PEND_SIGINT;
- sig = SIGINT;
- }
- else if (bitset(PEND_SIGTERM, PendingSignal))
- {
- sigbit = PEND_SIGTERM;
- sig = SIGTERM;
- }
- else if (bitset(PEND_SIGUSR1, PendingSignal))
- {
- sigbit = PEND_SIGUSR1;
- sig = SIGUSR1;
- }
- else
- {
- /* If we get here, we are in trouble */
- abort();
- }
- PendingSignal &= ~sigbit;
- kill(mypid, sig);
- }
-
- now = curtime();
- if (tTd(5, 4))
- dprintf("sm_tick: now=%ld\n", (long) now);
-
- while ((ev = EventQueue) != NULL &&
- (ev->ev_time <= now || ev->ev_pid != mypid))
- {
- void (*f)();
- int arg;
- pid_t pid;
-
- /* process the event on the top of the queue */
- ENTER_CRITICAL();
- ev = EventQueue;
- EventQueue = EventQueue->ev_link;
- LEAVE_CRITICAL();
- if (tTd(5, 6))
- dprintf("sm_tick: ev=%lx, func=%lx, arg=%d, pid=%d\n",
- (u_long) ev, (u_long) ev->ev_func,
- ev->ev_arg, ev->ev_pid);
-
- /* we must be careful in here because ev_func may not return */
- f = ev->ev_func;
- arg = ev->ev_arg;
- pid = ev->ev_pid;
- ENTER_CRITICAL();
- ev->ev_link = FreeEventList;
- FreeEventList = ev;
- LEAVE_CRITICAL();
- if (pid != mypid)
- continue;
- if (EventQueue != NULL)
- {
- if (EventQueue->ev_time > now)
- (void) alarm((unsigned) (EventQueue->ev_time - now));
- else
- (void) alarm(3);
- }
-
- /* call ev_func */
- errno = save_errno;
- (*f)(arg);
- (void) alarm(0);
- now = curtime();
- }
- if (EventQueue != NULL)
- (void) alarm((unsigned) (EventQueue->ev_time - now));
- errno = save_errno;
- return SIGFUNC_RETURN;
-}
- /*
-** PEND_SIGNAL -- Add a signal to the pending signal list
-**
-** Parameters:
-** sig -- signal to add
-**
-** Returns:
-** none.
-**
-** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
-** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
-** DOING.
-*/
-
-void
-pend_signal(sig)
- int sig;
-{
- int sigbit;
- int save_errno = errno;
-
- /*
- ** Don't want to interrupt something critical, hence delay
- ** the alarm for one second. Hopefully, by then we
- ** will be out of the critical section. If not, then
- ** we will just delay again. The events to be run will
- ** still all be run, maybe just a little bit late.
- */
-
- switch (sig)
- {
- case SIGHUP:
- sigbit = PEND_SIGHUP;
- break;
-
- case SIGINT:
- sigbit = PEND_SIGINT;
- break;
-
- case SIGTERM:
- sigbit = PEND_SIGTERM;
- break;
-
- case SIGUSR1:
- sigbit = PEND_SIGUSR1;
- break;
-
- case SIGALRM:
- /* don't have to pend these */
- sigbit = 0;
- break;
-
- default:
- /* If we get here, we are in trouble */
- abort();
-
- /* NOTREACHED */
- /* shut up stupid compiler warning on HP-UX 11 */
- sigbit = 0;
- break;
- }
-
- if (sigbit != 0)
- PendingSignal |= sigbit;
- (void) setsignal(SIGALRM, sm_tick);
- (void) alarm(1);
- errno = save_errno;
-}
- /*
-** SM_SIGNAL_NOOP -- A signal no-op function
-**
-** Parameters:
-** sig -- signal received
-**
-** Returns:
-** SIGFUNC_RETURN
-*/
-
-/* ARGSUSED */
-SIGFUNC_DECL
-sm_signal_noop(sig)
- int sig;
-{
- int save_errno = errno;
-
- FIX_SYSV_SIGNAL(sig, sm_signal_noop);
- errno = save_errno;
- return SIGFUNC_RETURN;
-}
- /*
-** SLEEP -- a version of sleep that works with this stuff
-**
-** Because sleep uses the alarm facility, I must reimplement
-** it here.
-**
-** Parameters:
-** intvl -- time to sleep.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** waits for intvl time. However, other events can
-** be run during that interval.
-*/
-
-
-static bool volatile SleepDone;
-
-#ifndef SLEEP_T
-# define SLEEP_T unsigned int
-#endif /* ! SLEEP_T */
-
-SLEEP_T
-sleep(intvl)
- unsigned int intvl;
-{
- int was_held;
-
- if (intvl == 0)
- return (SLEEP_T) 0;
- SleepDone = FALSE;
- (void) setevent((time_t) intvl, endsleep, 0);
- was_held = releasesignal(SIGALRM);
- while (!SleepDone)
- (void) pause();
- if (was_held > 0)
- (void) blocksignal(SIGALRM);
- return (SLEEP_T) 0;
-}
-
-static void
-endsleep()
-{
- /*
- ** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
- ** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
- ** DOING.
- */
-
- SleepDone = TRUE;
-}