summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Neil Shapiro <gshapiro@FreeBSD.org>2001-02-28 00:19:57 +0000
committerGregory Neil Shapiro <gshapiro@FreeBSD.org>2001-02-28 00:19:57 +0000
commit602a2b1b1d5877cb573baf0407540810a490b0cf (patch)
treef7a64a70968946b03a6d79fcded22b5a31689f6d
parent193538b7dabbb9c165660ca97d2704eea0642fa1 (diff)
downloadsrc-test2-602a2b1b1d5877cb573baf0407540810a490b0cf.tar.gz
src-test2-602a2b1b1d5877cb573baf0407540810a490b0cf.zip
Notes
-rw-r--r--contrib/sendmail/LICENSE4
-rw-r--r--contrib/sendmail/RELEASE_NOTES81
-rw-r--r--contrib/sendmail/cf/README42
-rw-r--r--contrib/sendmail/cf/cf/knecht.mc16
-rw-r--r--contrib/sendmail/cf/m4/cfhead.m426
-rw-r--r--contrib/sendmail/cf/m4/version.m46
-rwxr-xr-xcontrib/sendmail/contrib/buildvirtuser29
-rw-r--r--contrib/sendmail/doc/op/Makefile26
-rw-r--r--contrib/sendmail/doc/op/op.me52
-rw-r--r--contrib/sendmail/libmilter/Makefile.m44
-rw-r--r--contrib/sendmail/libmilter/README7
-rw-r--r--contrib/sendmail/libmilter/engine.c6
-rw-r--r--contrib/sendmail/libmilter/listener.c92
-rw-r--r--contrib/sendmail/libmilter/sm_gethost.c8
-rw-r--r--contrib/sendmail/libsmdb/smdb2.c9
-rw-r--r--contrib/sendmail/mail.local/mail.local.c374
-rw-r--r--contrib/sendmail/mailstats/mailstats.c2
-rw-r--r--contrib/sendmail/praliases/praliases.c21
-rw-r--r--contrib/sendmail/rmail/rmail.c8
-rw-r--r--contrib/sendmail/smrsh/smrsh.c10
-rw-r--r--contrib/sendmail/src/README38
-rw-r--r--contrib/sendmail/src/bf.h5
-rw-r--r--contrib/sendmail/src/bf_portable.c45
-rw-r--r--contrib/sendmail/src/bf_torek.c49
-rw-r--r--contrib/sendmail/src/collect.c37
-rw-r--r--contrib/sendmail/src/conf.c91
-rw-r--r--contrib/sendmail/src/conf.h21
-rw-r--r--contrib/sendmail/src/control.c4
-rw-r--r--contrib/sendmail/src/daemon.c82
-rw-r--r--contrib/sendmail/src/deliver.c75
-rw-r--r--contrib/sendmail/src/domain.c40
-rw-r--r--contrib/sendmail/src/headers.c8
-rw-r--r--contrib/sendmail/src/macro.c6
-rw-r--r--contrib/sendmail/src/main.c26
-rw-r--r--contrib/sendmail/src/map.c60
-rw-r--r--contrib/sendmail/src/milter.c34
-rw-r--r--contrib/sendmail/src/parseaddr.c10
-rw-r--r--contrib/sendmail/src/queue.c11
-rw-r--r--contrib/sendmail/src/readcf.c19
-rw-r--r--contrib/sendmail/src/recipient.c4
-rw-r--r--contrib/sendmail/src/savemail.c7
-rw-r--r--contrib/sendmail/src/sendmail.h13
-rw-r--r--contrib/sendmail/src/srvrsmtp.c8
-rw-r--r--contrib/sendmail/src/stats.c4
-rw-r--r--contrib/sendmail/src/udb.c10
-rw-r--r--contrib/sendmail/src/usersmtp.c36
-rw-r--r--contrib/sendmail/src/util.c17
-rw-r--r--contrib/sendmail/src/version.c6
-rw-r--r--contrib/sendmail/vacation/vacation.c4
49 files changed, 1080 insertions, 513 deletions
diff --git a/contrib/sendmail/LICENSE b/contrib/sendmail/LICENSE
index f7078650adca..0101f4843699 100644
--- a/contrib/sendmail/LICENSE
+++ b/contrib/sendmail/LICENSE
@@ -33,7 +33,7 @@ each of the following conditions is met:
forth as paragraph 6 below, in the documentation and/or other materials
provided with the distribution. For the purposes of binary distribution
the "Copyright Notice" refers to the following language:
- "Copyright (c) 1998-2000 Sendmail, Inc. All rights reserved."
+ "Copyright (c) 1998-2001 Sendmail, Inc. All rights reserved."
4. Neither the name of Sendmail, Inc. nor the University of California nor
the names of their contributors may be used to endorse or promote
@@ -76,4 +76,4 @@ each of the following conditions is met:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-$Revision: 8.9 $, Last updated $Date: 2000/03/03 19:24:11 $
+$Revision: 8.9.4.1 $, Last updated $Date: 2001/02/14 04:07:19 $
diff --git a/contrib/sendmail/RELEASE_NOTES b/contrib/sendmail/RELEASE_NOTES
index 08751503e86c..77f0e08193dc 100644
--- a/contrib/sendmail/RELEASE_NOTES
+++ b/contrib/sendmail/RELEASE_NOTES
@@ -1,11 +1,86 @@
SENDMAIL RELEASE NOTES
- $Id: RELEASE_NOTES,v 8.561.2.5.2.181 2000/12/28 23:56:46 gshapiro Exp $
+ $Id: RELEASE_NOTES,v 8.561.2.5.2.208 2001/02/26 21:24:54 gshapiro Exp $
This listing shows the version of the sendmail binary, the version
of the sendmail configuration files, the date of release, and a
summary of the changes in that release.
+8.11.3/8.11.3 2001/02/27
+ Prevent a segmentation fault when a bogus value was used in the
+ LDAPDefaultSpec option's -r, -s, or -M flags and if a bogus
+ option was used. Problem noted by Allan E Johannesen of
+ Worcester Polytechnic Institute.
+ Prevent "token too long" message by shortening {currHeader} which
+ could be too long if the last copied character was a quote.
+ Problem detected by Jan Krueger of digitalanswers
+ communications consulting gmbh.
+ Additional IPv6 check for unspecified addresses. Patch from
+ Jun-ichiro itojun Hagino of the KAME Project.
+ Do not ignore the ClientPortOptions setting if DaemonPortOptions
+ Modifier=b (bind to same interface) is set and the
+ connection came in from the command line.
+ Do not bind to the loopback address if DaemonPortOptions
+ Modifier=b (bind to same interface) is set. Patch from
+ John Beck of Sun Microsystems.
+ Properly deal with open failures on non-optional maps used in
+ check_* rulesets by returning a temporary failure.
+ Buffered file I/O files were not being properly fsync'ed to disk
+ when they were committed.
+ Properly encode '=' for the AUTH= parameter of the MAIL command.
+ Problem noted by Hadmut Danisch.
+ Under certain circumstances the macro {server_name} could be set
+ to the wrong hostname (of a previous connection), which may
+ cause some rulesets to return wrong results. This would
+ usually cause mail to be queued up and delivered later on.
+ Ignore F=z (LMTP) mailer flag if $u is given in the mailer A=
+ equate. Problem noted by Motonori Nakamura of Kyoto
+ University.
+ Work around broken accept() implementations which only partially
+ fill in the peer address if the socket is closed before
+ accept() completes.
+ Return an SMTP "421" temporary failure if the data file can't be
+ opened where the "354" reply would normally be given.
+ Prevent a CPU loop in trying to expand a macro which doesn't exist
+ in a queue run. Problem noted by Gordon Lack of Glaxo
+ Wellcome.
+ If delivering via a program and that program exits with EX_TEMPFAIL,
+ note that fact for the mailq display instead of just showing
+ "Deferred". Problem noted by Motonori Nakamura of Kyoto
+ University.
+ If doing canonification via /etc/hosts, try both the fully
+ qualified hostname as well as the first portion of the
+ hostname. Problem noted by David Bremner of the
+ University of New Brunswick.
+ Portability:
+ Fix a compilation problem for mail.local and rmail if SFIO
+ is in use. Problem noted by Auteria Wally
+ Winzer Jr. of Champion Nutrition.
+ IPv6 changes for platforms using KAME. Patch from
+ Jun-ichiro itojun Hagino of the KAME Project.
+ OpenBSD 2.7 and higher has srandomdev(3). OpenBSD 2.8 and
+ higher has BSDI-style login classes. Patch from
+ Todd C. Miller of Courtesan Consulting.
+ Unixware 7.1.1 doesn't allow h_errno to be set directly if
+ sendmail is being compiled with -kthread. Problem
+ noted by Orion Poplawski of CQG, Inc.
+ CONTRIB: buildvirtuser: Substitute current domain for $DOMAIN and
+ current left hand side for $LHS in virtuser files.
+ DEVTOOLS: Do not pass make targets to recursive Build invocations.
+ Problem noted by Jeff Bronson of J.D. Bronson, Inc.
+ MAIL.LOCAL: In LMTP mode, do not return errors regarding problems
+ storing the temporary message file until after the remote
+ side has sent the final DATA termination dot. Problem
+ noted by Allan E Johannesen of Worcester Polytechnic
+ Institute.
+ MAIL.LOCAL: If LMTP mode is set, give a temporary error if users
+ are also specified on the command line. Patch from
+ Motonori Nakamura of Kyoto University.
+ PRALIASES: Skip over AliasFile specifications which aren't based on
+ database files (i.e., only show dbm, hash, and btree).
+ Renamed Files:
+ devtools/OS/OSF1.V5.0 => devtools/OS/OSF1.V5.x
+
8.11.2/8.11.2 2000/12/29
Prevent a segmentation fault when trying to set a class in
address test mode due to a negative array index. Audit
@@ -89,7 +164,7 @@ summary of the changes in that release.
is used. Problem noted by Phil Homewood of Asia Online,
patch from Neil Rickert of Northern Illinois University.
CONFIG: Change the default DNS based blacklist server for
- FEATURE(`dnsbl') to blackholes.mail-abuse.org.
+ FEATURE(`dnsbl') to blackholes.mail-abuse.org.
CONFIG: Deal correctly with the 'C' flag in {daemon_flags}, i.e.,
implicitly assume canonical host names.
CONFIG: Deal with "::" in IPv6 addresses for access_db. Based on
@@ -107,7 +182,7 @@ summary of the changes in that release.
Roth of the University of Illinois at Urbana-Champaign.
DEVTOOLS: Change the internal devtools OS, REL, and ARCH m4
variables into bldOS, bldREL, and bldARCH to prevent
- namespace collisions. Problem noted by Motonori Nakamura
+ namespace collisions. Problem noted by Motonori Nakamura
of Kyoto University.
RMAIL: Undo the 8.11.1 change to use -G when calling sendmail. It
causes some changes in behavior and may break rmail for
diff --git a/contrib/sendmail/cf/README b/contrib/sendmail/cf/README
index c8ad901bbb2a..1ac790792992 100644
--- a/contrib/sendmail/cf/README
+++ b/contrib/sendmail/cf/README
@@ -54,7 +54,7 @@ Let's examine a typical .mc file:
divert(-1)
#
- # Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ # Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
@@ -254,12 +254,13 @@ HELP_FILE [/etc/mail/helpfile] The name of the file
QUEUE_DIR [/var/spool/mqueue] The directory containing
queue files. To use multiple queues, supply
a value ending with an asterisk. For
- example, /var/spool/mqueue/q* will use all of the
+ example, /var/spool/mqueue/qd* will use all of the
directories or symbolic links to directories
- beginning with 'q' in /var/spool/mqueue as queue
+ beginning with 'qd' in /var/spool/mqueue as queue
directories. The names 'qf', 'df', and 'xf' are
- used as specific subdirectories for the corresponding
- queue file types.
+ reserved as specific subdirectories for the
+ corresponding queue file types as explained in
+ doc/op/op.me.
STATUS_FILE [/etc/mail/statistics] The file containing status
information.
LOCAL_MAILER_PATH [/bin/mail] The program used to deliver local mail.
@@ -665,7 +666,7 @@ stickyhost This feature is sometimes used with LOCAL_RELAY,
although it can be used for a different effect with
MAIL_HUB.
- When used with without MAIL_HUB, email sent to
+ When used without MAIL_HUB, email sent to
"user@local.host" are marked as "sticky" -- that
is, the local addresses aren't matched against UDB,
don't go through ruleset 5, and are not forwarded to
@@ -1860,8 +1861,8 @@ for your purposes. There is now the option to tag entries in the
access map according to their type. Three tags are available:
Connect: connection information (${client_addr}, ${client_name})
- From: sender
- To: recipient
+ From: envelope sender
+ To: envelope recipient
If the required item is looked up in a map, it will be tried first
with the corresponding tag in front, then (as fallback to enable
@@ -1913,7 +1914,7 @@ avoid this problem you have to use tagged entries:
Connect:my.domain RELAY
if you need those entries at all (class {R} may take care of them).
-
+
FEATURE(`delay_checks') can take an optional argument:
FEATURE(`delay_checks', `friend')
@@ -1966,6 +1967,11 @@ defined for them can be given by:
H*: $>CheckHdr
+Notice: All rules act on tokens as explained in doc/op/op.{me,ps,txt}.
+That may cause problems with simple header checks due to the
+tokenization. It might be simpler to use a regex map and apply it
+to $&{currHeader}.
+
After all of the headers are read, the check_eoh ruleset will be called for
any final header-related checks. The ruleset is called with the number of
headers and the size of all of the headers in bytes separated by $|. One
@@ -2113,6 +2119,20 @@ should only be accepted if they have been authenticated.
TLS_Srv:secure.example.com ENCR:112
TLS_Clt:laptop.example.com PERM+VERIFY:112
+Notice: requiring that e-mail is sent to a server only encrypted,
+e.g., via
+
+TLS_Srv:secure.domain ENCR:112
+
+doesn't necessarily mean that e-mail sent to that domain is encrypted.
+If the domain has multiple MX servers, e.g.,
+
+secure.domain. IN MX 10 mail.secure.domain.
+secure.domain. IN MX 50 mail.other.domain.
+
+then mail to user@secure.domain may go unencrypted to mail.other.domain.
+
+
Received: Header
The Received: header reveals whether STARTTLS has been used. It contains an
@@ -2979,7 +2999,7 @@ confAUTH_MECHANISMS AuthMechanisms [GSSAPI KERBEROS_V4 DIGEST-MD5
intersection of this list and the list
of available mechanisms as determined
by the CYRUS SASL library.
-confDEF_AUTH_INFO DefaultAuthInfo [undefined] Filename that contains
+confDEF_AUTH_INFO DefaultAuthInfo [undefined] Name of file that contains
authentication information for
outgoing connections. This file
must contain the user id, the
@@ -3257,4 +3277,4 @@ M4 DIVERSIONS
8 DNS based blacklists
9 special local rulesets (1 and 2)
-$Revision: 8.383.2.1.2.35 $, Last updated $Date: 2000/12/17 17:19:11 $
+$Revision: 8.383.2.1.2.42 $, Last updated $Date: 2001/02/15 23:40:10 $
diff --git a/contrib/sendmail/cf/cf/knecht.mc b/contrib/sendmail/cf/cf/knecht.mc
index cd467f65ce6a..89f9c5344328 100644
--- a/contrib/sendmail/cf/cf/knecht.mc
+++ b/contrib/sendmail/cf/cf/knecht.mc
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+# Copyright (c) 1998, 1999, 2001 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
@@ -17,8 +17,8 @@ divert(-1)
#
divert(0)dnl
-VERSIONID(`$Id: knecht.mc,v 8.37 1999/11/19 05:18:12 gshapiro Exp $')
-OSTYPE(bsdi)dnl
+VERSIONID(`$Id: knecht.mc,v 8.37.16.3 2001/02/22 22:38:39 ca Exp $')
+OSTYPE(bsd4.4)dnl
DOMAIN(generic)dnl
define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward+$h:$z/.forward')dnl
define(`confDEF_USER_ID', `mailnull')dnl
@@ -28,10 +28,16 @@ define(`confCOPY_ERRORS_TO', `Postmaster')dnl
define(`confTO_QUEUEWARN', `8h')dnl
define(`confTRUSTED_USERS', `www')dnl
define(`confPRIVACY_FLAGS', ``authwarnings,noexpn,novrfy'')dnl
+define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')dnl
+define(`confCACERT_PATH', `CERT_DIR')dnl
+define(`confCACERT', `CERT_DIR/CAcert.pem')dnl
+define(`confSERVER_CERT', `CERT_DIR/MYcert.pem')dnl
+define(`confSERVER_KEY', `CERT_DIR/MYkey.pem')dnl
+define(`confCLIENT_CERT', `CERT_DIR/MYcert.pem')dnl
+define(`confCLIENT_KEY', `CERT_DIR/MYkey.pem')dnl
FEATURE(virtusertable)dnl
FEATURE(access_db)dnl
FEATURE(local_lmtp)dnl
-MODIFY_MAILER_FLAGS(`LOCAL', `+P')dnl
MAILER(local)dnl
MAILER(smtp)dnl
@@ -61,7 +67,7 @@ HMessage-Id: $>CheckMessageId
SCheckMessageId
R< $+ @ $+ > $@ OK
-R$* $#error $: "553 Header error"
+R$* $#error $: "554 Header error"
LOCAL_RULESETS
SLocal_check_mail
diff --git a/contrib/sendmail/cf/m4/cfhead.m4 b/contrib/sendmail/cf/m4/cfhead.m4
index c79117cd48bb..3a1e18173e0b 100644
--- a/contrib/sendmail/cf/m4/cfhead.m4
+++ b/contrib/sendmail/cf/m4/cfhead.m4
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+# 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
@@ -154,28 +154,28 @@ define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
CONCAT(CY, $'1`),
CONCAT(C, $3, $'1`))')
sinclude(_CF_DIR_`'siteconfig/$1.m4)')
-define(`EXPOSED_USER', `PUSHDIVERT(5)CE$1
+define(`EXPOSED_USER', `PUSHDIVERT(5)C{E}$1
POPDIVERT`'dnl`'')
-ifdef(`_FFR_EXPOSED_USER_FILE', `define(`EXPOSED_USER_FILE', `PUSHDIVERT(5)FE$1
+ifdef(`_FFR_EXPOSED_USER_FILE', `define(`EXPOSED_USER_FILE', `PUSHDIVERT(5)F{E}$1
POPDIVERT`'dnl`'')', `dnl')
-define(`LOCAL_USER', `PUSHDIVERT(5)CL$1
+define(`LOCAL_USER', `PUSHDIVERT(5)C{L}$1
POPDIVERT`'dnl`'')
define(`MASQUERADE_AS', `define(`MASQUERADE_NAME', $1)')
-define(`MASQUERADE_DOMAIN', `PUSHDIVERT(5)CM$1
+define(`MASQUERADE_DOMAIN', `PUSHDIVERT(5)C{M}$1
POPDIVERT`'dnl`'')
-define(`MASQUERADE_EXCEPTION', `PUSHDIVERT(5)CN$1
+define(`MASQUERADE_EXCEPTION', `PUSHDIVERT(5)C{N}$1
POPDIVERT`'dnl`'')
-define(`MASQUERADE_DOMAIN_FILE', `PUSHDIVERT(5)FM$1
+define(`MASQUERADE_DOMAIN_FILE', `PUSHDIVERT(5)F{M}$1
POPDIVERT`'dnl`'')
-define(`LOCAL_DOMAIN', `PUSHDIVERT(5)Cw$1
+define(`LOCAL_DOMAIN', `PUSHDIVERT(5)C{w}$1
POPDIVERT`'dnl`'')
define(`CANONIFY_DOMAIN', `PUSHDIVERT(5)C{Canonify}$1
POPDIVERT`'dnl`'')
define(`CANONIFY_DOMAIN_FILE', `PUSHDIVERT(5)F{Canonify}$1
POPDIVERT`'dnl`'')
-define(`GENERICS_DOMAIN', `PUSHDIVERT(5)CG$1
+define(`GENERICS_DOMAIN', `PUSHDIVERT(5)C{G}$1
POPDIVERT`'dnl`'')
-define(`GENERICS_DOMAIN_FILE', `PUSHDIVERT(5)FG$1
+define(`GENERICS_DOMAIN_FILE', `PUSHDIVERT(5)F{G}$1
POPDIVERT`'dnl`'')
define(`LDAPROUTE_DOMAIN', `PUSHDIVERT(5)C{LDAPRoute}$1
POPDIVERT`'dnl`'')
@@ -187,9 +187,9 @@ POPDIVERT`'dnl`'')
define(`VIRTUSER_DOMAIN_FILE', `PUSHDIVERT(5)F{VirtHost}$1
define(`_VIRTHOSTS_')
POPDIVERT`'dnl`'')
-define(`RELAY_DOMAIN', `PUSHDIVERT(5)CR$1
+define(`RELAY_DOMAIN', `PUSHDIVERT(5)C{R}$1
POPDIVERT`'dnl`'')
-define(`RELAY_DOMAIN_FILE', `PUSHDIVERT(5)FR$1
+define(`RELAY_DOMAIN_FILE', `PUSHDIVERT(5)F{R}$1
POPDIVERT`'dnl`'')
define(`TRUST_AUTH_MECH', `PUSHDIVERT(5)C{TrustAuthMech}$1
POPDIVERT`'dnl`'')
@@ -252,4 +252,4 @@ define(`confMILTER_MACROS_ENVRCPT', ``{rcpt_mailer}, {rcpt_host}, {rcpt_addr}'')
divert(0)dnl
-VERSIONID(`$Id: cfhead.m4,v 8.76.4.13 2000/08/24 17:09:50 gshapiro Exp $')
+VERSIONID(`$Id: cfhead.m4,v 8.76.4.15 2001/02/14 04:07:20 gshapiro Exp $')
diff --git a/contrib/sendmail/cf/m4/version.m4 b/contrib/sendmail/cf/m4/version.m4
index a98a7e63fea7..05f275b01365 100644
--- a/contrib/sendmail/cf/m4/version.m4
+++ b/contrib/sendmail/cf/m4/version.m4
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
@@ -11,8 +11,8 @@ divert(-1)
# the sendmail distribution.
#
#
-VERSIONID(`$Id: version.m4,v 8.39.4.21 2000/12/29 18:22:15 gshapiro Exp $')
+VERSIONID(`$Id: version.m4,v 8.39.4.26 2001/02/27 19:22:29 gshapiro Exp $')
#
divert(0)
# Configuration version number
-DZ8.11.2`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.11.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/contrib/sendmail/contrib/buildvirtuser b/contrib/sendmail/contrib/buildvirtuser
index e5448289d7b0..3ea2d660461c 100755
--- a/contrib/sendmail/contrib/buildvirtuser
+++ b/contrib/sendmail/contrib/buildvirtuser
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
-# Copyright (c) 1999-2000 Gregory Neil Shapiro. All Rights Reserved.
+# Copyright (c) 1999-2001 Gregory Neil Shapiro. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-# $Id: buildvirtuser,v 1.1.2.1 2000/10/26 22:51:03 gshapiro Exp $
+# $Id: buildvirtuser,v 1.1.2.3 2001/02/12 02:57:13 gshapiro Exp $
=head1 NAME
@@ -45,7 +45,10 @@ directory should contain one file per virtual domain with the filename
matching the virtual domain name and the contents containing a list of
usernames on the left and the actual address for that username on the
right. An empty left column translates to the default for that domain.
-Blank lines and lines beginning with '#' are ignored.
+Blank lines and lines beginning with '#' are ignored. Occurrences of
+$DOMAIN in the file are replaced by the current domain being processed.
+Occurrences of $LHS in the right hand side are replaced by the address on
+the left hand side.
=head1 CONFIGURATION
@@ -66,21 +69,21 @@ Here are some example files from the /etc/mail/virtusers/ directory:
=head2 /etc/mail/virtusers/bsdunix.org:
# Services
- MAILER-DAEMON gshapiro+MAILER-DAEMON.bsdunix.org@gshapiro.net
- postmaster gshapiro+postmaster.bsdunix.org@gshapiro.net
- webmaster gshapiro+webmaster.bsdunix.org@gshapiro.net
+ MAILER-DAEMON gshapiro+bounce.$DOMAIN@gshapiro.net
+ postmaster gshapiro+$LHS.$DOMAIN@gshapiro.net
+ webmaster gshapiro+$LHS.$DOMAIN@gshapiro.net
# Defaults
error:nouser No such user
# Users
- gshapiro gshapiro+bsdunix.org@gshapiro.net
+ gshapiro gshapiro+$DOMAIN@gshapiro.net
bob robert@smtp.org
=head2 /etc/mail/virtusers/smtp.org:
# Defaults
- gshapiro+smtp.org@gshapiro.net
+ gshapiro+$DOMAIN@gshapiro.net
# Users
john john@wookie.org
@@ -92,6 +95,8 @@ Gregory Neil Shapiro E<lt>F<gshapiro@gshapiro.net>E<gt>
=cut
+use strict;
+
my $makemap = "/usr/sbin/makemap";
my $dbtype = "hash";
my $maildir = "/etc/mail";
@@ -102,6 +107,7 @@ my $newvirt = "$maildir/virtusertable.new.db";
my $virt = "$maildir/virtusertable.db";
my %virt = ();
my $newest = 0;
+my ($lhs, $domain, $key, $value);
opendir(VIRTS, $virts) || die "Could not open directory $virts: $!\n";
my @virts = grep { -f "$virts/$_" } readdir(VIRTS);
@@ -126,10 +132,12 @@ LINE: while (<DOMAIN>)
{
if (defined($1))
{
+ $lhs = "$1";
$key = "$1\@$domain";
}
else
{
+ $lhs = "";
$key = "\@$domain";
}
$value = $2;
@@ -138,6 +146,11 @@ LINE: while (<DOMAIN>)
{
die "Bogus line $line in $virts/$domain\n";
}
+
+ # Variable subsitution
+ $key =~ s/\$DOMAIN/$domain/g;
+ $value =~ s/\$DOMAIN/$domain/g;
+ $value =~ s/\$LHS/$lhs/g;
$virt{$key} = $value;
}
close(DOMAIN) || die "Could not close $virts/$domain: $!\n";
diff --git a/contrib/sendmail/doc/op/Makefile b/contrib/sendmail/doc/op/Makefile
index 3819f188f458..4b3644d2b8e1 100644
--- a/contrib/sendmail/doc/op/Makefile
+++ b/contrib/sendmail/doc/op/Makefile
@@ -1,23 +1,29 @@
-# $Id: Makefile,v 8.7 2000/02/01 08:21:47 gshapiro Exp $
+# $Id: Makefile,v 8.7.8.1 2001/01/04 18:55:46 gshapiro Exp $
-DIR= smm/08.sendmailop
-SRCS= op.me
-OBJS= op.ps
-MACROS= -me
+DIR= smm/08.sendmailop
+SRCS= op.me
+OBJS= op.ps
+MACROS= -me
ROFF_CMD= groff
PIC_CMD= pic
EQN_CMD= eqn
PIC= ${PIC_CMD} -C
-EQN= ${EQN_CMD} -C -Tps
-ROFF= ${ROFF_CMD} -Tps -mps ${MACROS}
+EQNASCII= ${EQN_CMD} -C -Tascii
+EQNPS= ${EQN_CMD} -C -Tps
+ROFFASCII= ${ROFF_CMD} -Tascii ${MACROS}
+ROFFPS= ${ROFF_CMD} -Tps -mps ${MACROS}
all: ${OBJS}
-${OBJS}: ${SRCS}
+op.ps: ${SRCS}
rm -f $@
- ${PIC} ${SRCS} | ${EQN} | ${ROFF} > $@
+ ${PIC} ${SRCS} | ${EQNPS} | ${ROFFPS} > $@
+
+op.txt: ${SRCS}
+ rm -f $@
+ ${PIC} ${SRCS} | ${EQNASCII} | ${ROFFASCII} > $@
clean:
- rm -f ${OBJS}
+ rm -f op.ps op.txt
install: ${OBJS}
diff --git a/contrib/sendmail/doc/op/op.me b/contrib/sendmail/doc/op/op.me
index 68fe3793b635..3c27ebda39a5 100644
--- a/contrib/sendmail/doc/op/op.me
+++ b/contrib/sendmail/doc/op/op.me
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1983, 1993
@@ -9,7 +9,7 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: op.me,v 8.317.4.47 2000/12/17 00:54:56 gshapiro Exp $
+.\" $Id: op.me,v 8.317.4.56 2001/02/15 23:38:16 ca Exp $
.\"
.\" eqn op.me | pic | troff -me
.eh 'SMM:08-%''Sendmail Installation and Operation Guide'
@@ -53,7 +53,7 @@ eric@Sendmail.COM
.de Ve
Version \\$2
..
-.Ve $Revision: 8.317.4.47 $
+.Ve $Revision: 8.317.4.56 $
.rm Ve
.sp
For Sendmail Version 8.11
@@ -99,7 +99,7 @@ RFC1652 (SMTP 8BITMIME Extension),
RFC1870 (SMTP SIZE Extension),
RFC1891 (SMTP Delivery Status Notifications),
RFC1892 (Multipart/Report),
-RFC1893 (Mail System Status Codes),
+RFC1893 (Enhanced Mail System Status Codes),
RFC1894 (Delivery Status Notifications),
RFC1985 (SMTP Service Extension for Remote Message Queue Starting),
RFC2033 (Local Message Transmission Protocol),
@@ -624,7 +624,7 @@ option is set.
.pp
This command is also a link to
.i sendmail .
-It flushes all information that is stored in the
+It flushes expired (Timeout.hoststatus) information that is stored in the
.b HostStatusDirectory
tree.
.sh 3 "/var/spool/mqueue"
@@ -644,9 +644,9 @@ file.
To use multiple queues,
supply a value ending with an asterisk.
For example,
-.i /var/spool/mqueue/q*
+.i /var/spool/mqueue/qd*
will use all of the directories or symbolic links to directories
-beginning with `q' in
+beginning with `qd' in
.i /var/spool/mqueue
as queue directories.
Do not change the queue directory structure
@@ -1141,6 +1141,9 @@ Removing this directory and its subdirectories has an effect similar to
the
.i purgestat
command and is completely safe.
+However,
+.i purgestat
+only removes expired (Timeout.hoststatus) data.
The information in these directories can
be perused with the
.i hoststat
@@ -1158,7 +1161,7 @@ the
.b Timeout.hoststatus
option.
.pp
-The connection information stored on disk may be purged at any time
+The connection information stored on disk may be expired at any time
with the
.i purgestat
command or by invoking sendmail with the
@@ -1174,7 +1177,8 @@ switch.
The implementation of certain system services
such as host and user name lookup
is controlled by the service switch.
-If the host operating system supports such a switch
+If the host operating system supports such a switch,
+and sendmail knows about it,
.i sendmail
will use the native version.
Ultrix, Solaris, and DEC OSF/1 are examples of such systems\**.
@@ -4262,7 +4266,9 @@ FAIL cert presented but could not be verified,
NONE STARTTLS has not been performed.
TEMP temporary error occurred.
PROTOCOL some protocol error occurred.
-SOFTWARE STARTTLS handshake failed.
+SOFTWARE STARTTLS handshake failed,
+ which is a fatal error for this session,
+ the e-mail will be queued.
.)b
.pp
There are three types of dates that can be used.
@@ -4504,6 +4510,9 @@ The syntax is:
.br
.b F \c
.i c\|file
+.br
+.b F \c
+.i c\||program
.)b
The first form defines the class
.i c
@@ -4530,11 +4539,13 @@ CHmonet
CHucbmonet
.)b
are equivalent.
-The ``F'' form
-reads the elements of the class
+The ``F'' forms
+read the elements of the class
.i c
from the named
-.i file .
+.i file
+or
+.i program .
Each element should be listed on a separate line.
To specify an optional file, use ``-o'' between the class
name and the file name, e.g.,
@@ -5382,7 +5393,7 @@ should be in the format
``\c
.i class \c
.b :
-.i file ''
+.i info ''
where
.i class \c
.b :
@@ -5397,6 +5408,10 @@ for back compatibility),
(if
.sm NEWDB
is specified),
+.q btree
+(if
+.sm NEWDB
+is specified),
.q dbm
(if
.sm NDBM
@@ -5404,6 +5419,13 @@ is specified),
.q stab
(internal symbol table \*- not normally used
unless you have no other database lookup),
+.q sequence
+(use a sequence of maps
+previously declared),
+.q ldap
+(if
+.sm LDAPMAP
+is specified),
or
.q nis
(if
@@ -9390,7 +9412,7 @@ replace it with a blank sheet for double-sided output.
.\".sz 10
.\"Eric Allman
.\".sp
-.\"Version $Revision: 8.317.4.47 $
+.\"Version $Revision: 8.317.4.56 $
.\".ce 0
.bp 3
.ce
diff --git a/contrib/sendmail/libmilter/Makefile.m4 b/contrib/sendmail/libmilter/Makefile.m4
index 4b924641d236..19381a48f96c 100644
--- a/contrib/sendmail/libmilter/Makefile.m4
+++ b/contrib/sendmail/libmilter/Makefile.m4
@@ -16,9 +16,9 @@ APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL')
divert(bldTARGETS_SECTION)
# Install the API header file
-MFAPI= ${SRCDIR}/include/libmilter/mfapi.h
+MFAPI= ${SRCDIR}/inc`'lude/libmilter/mfapi.h
install-mfapi: ${MFAPI}
- ${INSTALL} ${MFAPI} ${DESTDIR}${INCLUDEDIR}
+ ${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}
divert(0)
bldFINISH
diff --git a/contrib/sendmail/libmilter/README b/contrib/sendmail/libmilter/README
index ffe09c479830..7c052cae1a4d 100644
--- a/contrib/sendmail/libmilter/README
+++ b/contrib/sendmail/libmilter/README
@@ -44,6 +44,11 @@ threading support differs according to the compiler and linker used. Check
the Makefile in your appropriate obj.*/libmilter build subdirectory if you
are unsure of the local flag used.
+Note that since filters use threads, it may be necessary to alter per
+process limits in your filter. For example, you might look at using
+setrlimit() to increase the number of open file descriptors if your filter
+is going to be busy.
+
+----------------------------------------+
| SPECIFYING FILTERS IN SENDMAIL CONFIGS |
@@ -416,4 +421,4 @@ main(argc, argv)
/* eof */
-$Revision: 8.9.2.1.2.13 $, Last updated $Date: 2000/12/29 18:55:23 $
+$Revision: 8.9.2.1.2.14 $, Last updated $Date: 2001/02/21 23:08:19 $
diff --git a/contrib/sendmail/libmilter/engine.c b/contrib/sendmail/libmilter/engine.c
index 554631ce9351..0fd48ebc7467 100644
--- a/contrib/sendmail/libmilter/engine.c
+++ b/contrib/sendmail/libmilter/engine.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: engine.c,v 8.67.4.15 2000/12/29 19:43:10 gshapiro Exp $";
+static char id[] = "@(#)$Id: engine.c,v 8.67.4.17 2001/01/22 19:00:16 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -122,7 +122,7 @@ static int dec_arg2 __P((char *, size_t, char **, char **));
#define NX_INIT (MASK(ST_OPTS))
#define NX_OPTS (MASK(ST_CONN))
#define NX_CONN (MASK(ST_HELO) | MASK(ST_MAIL))
-#define NX_HELO (MASK(ST_MAIL))
+#define NX_HELO (MASK(ST_HELO) | MASK(ST_MAIL))
#define NX_MAIL (MASK(ST_RCPT) | MASK(ST_ABRT))
#define NX_RCPT (MASK(ST_HDRS) | MASK(ST_EOHS) | MASK(ST_RCPT) | MASK(ST_ABRT))
#define NX_HDRS (MASK(ST_EOHS) | MASK(ST_HDRS) | MASK(ST_ABRT))
diff --git a/contrib/sendmail/libmilter/listener.c b/contrib/sendmail/libmilter/listener.c
index 8b1d952b74a0..6a1a8017c39e 100644
--- a/contrib/sendmail/libmilter/listener.c
+++ b/contrib/sendmail/libmilter/listener.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.18 2000/12/29 19:44:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.21 2001/02/14 02:20:40 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -30,16 +30,19 @@ static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.18 2000/12/29 19:44:28 gsha
** conn -- connection description
** backlog -- listen backlog
** socksize -- socksize of created socket
+** family -- family of created socket
+** name -- name for logging
**
** Returns:
** socket upon success, error code otherwise.
*/
static socket_t
-mi_milteropen(conn, backlog, socksize, name)
+mi_milteropen(conn, backlog, socksize, family, name)
char *conn;
int backlog;
SOCKADDR_LEN_T *socksize;
+ int *family;
char *name;
{
socket_t sock;
@@ -393,7 +396,7 @@ mi_milteropen(conn, backlog, socksize, name)
(void) close(sock);
return INVALID_SOCKET;
}
-
+ *family = addr.sa.sa_family;
return sock;
}
/*
@@ -457,6 +460,46 @@ mi_closener()
** MI_FAILURE -- Network initialization failed.
*/
+# if BROKEN_PTHREAD_SLEEP
+
+/*
+** Solaris 2.6, perhaps others, gets an internal threads library panic
+** when sleep() is used:
+**
+** thread_create() failed, returned 11 (EINVAL)
+** co_enable, thr_create() returned error = 24
+** libthread panic: co_enable failed (PID: 17793 LWP 1)
+** stacktrace:
+** ef526b10
+** ef52646c
+** ef534cbc
+** 156a4
+** 14644
+** 1413c
+** 135e0
+** 0
+*/
+
+# define MI_SLEEP(s) \
+{ \
+ int rs = 0; \
+ struct timeval st; \
+ \
+ st.tv_sec = (s); \
+ st.tv_usec = 0; \
+ if (st.tv_sec > 0) \
+ rs = select(0, NULL, NULL, NULL, &st); \
+ if (rs != 0) \
+ { \
+ smi_log(SMI_LOG_ERR, \
+ "MI_SLEEP(): select() returned non-zero result %d, errno = %d", \
+ rs, errno); \
+ } \
+}
+# else /* BROKEN_PTHREAD_SLEEP */
+# define MI_SLEEP(s) sleep((s))
+# endif /* BROKEN_PTHREAD_SLEEP */
+
int
mi_listener(conn, dbg, smfi, timeout, backlog)
char *conn;
@@ -466,11 +509,12 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
int backlog;
{
socket_t connfd = INVALID_SOCKET;
+ int family = AF_UNSPEC;
int sockopt = 1;
int r;
int ret = MI_SUCCESS;
- int cnt_m = 0;
- int cnt_t = 0;
+ int mcnt = 0;
+ int tcnt = 0;
sthread_t thread_id;
_SOCK_ADDR cliaddr;
SOCKADDR_LEN_T socksize;
@@ -485,7 +529,8 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
smfi->xxfi_name, conn);
(void) smutex_init(&L_Mutex);
(void) smutex_lock(&L_Mutex);
- listenfd = mi_milteropen(conn, backlog, &socksize, smfi->xxfi_name);
+ listenfd = mi_milteropen(conn, backlog, &socksize, &family,
+ smfi->xxfi_name);
if (!ValidSocket(listenfd))
{
smi_log(SMI_LOG_FATAL,
@@ -545,10 +590,29 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
break;
}
+ memset(&cliaddr, '\0', sizeof cliaddr);
connfd = accept(listenfd, (struct sockaddr *) &cliaddr,
&clilen);
(void) smutex_unlock(&L_Mutex);
+ /*
+ ** If remote side closes before
+ ** accept() finishes, sockaddr
+ ** might not be fully filled in.
+ */
+
+ if (ValidSocket(connfd) &&
+ (clilen == 0 ||
+# ifdef BSD4_4_SOCKADDR
+ cliaddr.sa.sa_len == 0 ||
+# endif /* BSD4_4_SOCKADDR */
+ cliaddr.sa.sa_family != family))
+ {
+ (void) close(connfd);
+ connfd = INVALID_SOCKET;
+ errno = EINVAL;
+ }
+
if (!ValidSocket(connfd))
{
smi_log(SMI_LOG_ERR,
@@ -569,15 +633,16 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
(void) close(connfd);
smi_log(SMI_LOG_ERR, "%s: malloc(ctx) failed",
smfi->xxfi_name);
- sleep(++cnt_m);
- if (cnt_m >= MAX_FAILS_M)
+ mcnt++;
+ MI_SLEEP(mcnt);
+ if (mcnt >= MAX_FAILS_M)
{
ret = MI_FAILURE;
break;
}
continue;
}
- cnt_m = 0;
+ mcnt = 0;
memset(ctx, '\0', sizeof *ctx);
ctx->ctx_sd = connfd;
ctx->ctx_dbg = dbg;
@@ -611,17 +676,18 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
smi_log(SMI_LOG_ERR,
"%s: thread_create() failed: %d",
smfi->xxfi_name, r);
- sleep(++cnt_t);
+ tcnt++;
+ MI_SLEEP(tcnt);
(void) close(connfd);
free(ctx);
- if (cnt_t >= MAX_FAILS_T)
+ if (tcnt >= MAX_FAILS_T)
{
ret = MI_FAILURE;
break;
}
continue;
}
- cnt_t = 0;
+ tcnt = 0;
}
if (ret != MI_SUCCESS)
mi_stop_milters(MILTER_ABRT);
diff --git a/contrib/sendmail/libmilter/sm_gethost.c b/contrib/sendmail/libmilter/sm_gethost.c
index 9541a93bb425..32c8fafe5f9b 100644
--- a/contrib/sendmail/libmilter/sm_gethost.c
+++ b/contrib/sendmail/libmilter/sm_gethost.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.4 2000/12/19 04:26:33 gshapiro Exp $";
+static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.6 2001/02/14 04:07:23 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -54,7 +54,7 @@ getipnodebyname(name, family, flags, err)
resv6 = bitset(RES_USE_INET6, _res.options);
_res.options |= RES_USE_INET6;
}
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
h = gethostbyname(name);
*err = h_errno;
if (family == AF_INET6 && !resv6)
@@ -102,7 +102,7 @@ mi_gethostbyname(name, family)
# if NETINET6
h = getipnodebyname(name, family, AI_V4MAPPED|AI_ALL, &err);
- h_errno = err;
+ SM_SET_H_ERRNO(err);
# else /* NETINET6 */
h = gethostbyname(name);
# endif /* NETINET6 */
diff --git a/contrib/sendmail/libsmdb/smdb2.c b/contrib/sendmail/libsmdb/smdb2.c
index e6f350a16e50..af56fe910178 100644
--- a/contrib/sendmail/libsmdb/smdb2.c
+++ b/contrib/sendmail/libsmdb/smdb2.c
@@ -1,5 +1,5 @@
/*
-** Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+** Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
** All rights reserved.
**
** By using this file, you agree to the terms and conditions set
@@ -8,7 +8,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: smdb2.c,v 8.53.2.1.2.5 2000/10/26 00:39:56 geir Exp $";
+static char id[] = "@(#)$Id: smdb2.c,v 8.53.2.1.2.7 2001/02/14 04:07:24 gshapiro Exp $";
#endif /* ! lint */
#include <fcntl.h>
@@ -359,9 +359,12 @@ int
smdb2_cursor_close(cursor)
SMDB_CURSOR *cursor;
{
+ int ret;
DBC *dbc = (DBC *) cursor->smdbc_impl;
- return db2_error_to_smdb(dbc->c_close(dbc));
+ ret = db2_error_to_smdb(dbc->c_close(dbc));
+ free(cursor);
+ return ret;
}
int
diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c
index 473d04ab3b81..a8eb82bab04e 100644
--- a/contrib/sendmail/mail.local/mail.local.c
+++ b/contrib/sendmail/mail.local/mail.local.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -12,14 +12,14 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1990, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.39 2000/11/14 20:02:47 gshapiro Exp $";
+static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.57 2001/02/11 20:08:20 gshapiro Exp $";
#endif /* ! lint */
/*
@@ -106,37 +106,25 @@ extern size_t strlcat __P((char *, const char *, size_t));
# if defined(_AIX)
# define USE_LOCKF 1
# define USE_SETEUID 1
-# define USE_VSYSLOG 0
# endif /* defined(_AIX) */
# if defined(__hpux)
# define USE_LOCKF 1
# define USE_SETRESUID 1
-# define USE_VSYSLOG 0
# endif /* defined(__hpux) */
# ifdef DGUX
# define HASSNPRINTF 1
# define USE_LOCKF 1
-# define USE_VSYSLOG 0
# endif /* DGUX */
# if defined(_CRAY)
# if !defined(MAXPATHLEN)
# define MAXPATHLEN PATHSIZE
# endif /* !defined(MAXPATHLEN) */
-# define USE_VSYSLOG 0
# define _PATH_MAILDIR "/usr/spool/mail"
# endif /* defined(_CRAY) */
-# if defined(ultrix)
-# define USE_VSYSLOG 0
-# endif /* defined(ultrix) */
-
-# if defined(__osf__)
-# define USE_VSYSLOG 0
-# endif /* defined(__osf__) */
-
# if defined(NeXT) && !defined(__APPLE__)
# include <libc.h>
# define _PATH_MAILDIR "/usr/spool/mail"
@@ -160,10 +148,6 @@ extern size_t strlcat __P((char *, const char *, size_t));
# define LOCK_EX F_LOCK
# endif /* USE_LOCKF */
-# ifndef USE_VSYSLOG
-# define USE_VSYSLOG 1
-# endif /* ! USE_VSYSLOG */
-
# ifndef LOCK_EX
# include <sys/file.h>
# endif /* ! LOCK_EX */
@@ -205,18 +189,19 @@ extern FILE *fdopen __P((int, const char *));
# define HASSNPRINTF 1 /* has snprintf starting in 4.3 */
# endif /* _AIX4 >= 40300 */
-# if !HASSNPRINTF
+# if !HASSNPRINTF && !SFIO
extern int snprintf __P((char *, size_t, const char *, ...));
# ifndef _CRAY
extern int vsnprintf __P((char *, size_t, const char *, ...));
# endif /* ! _CRAY */
-# endif /* !HASSNPRINTF */
+# endif /* !HASSNPRINTF && !SFIO */
/*
** If you don't have setreuid, and you have saved uids, and you have
** a seteuid() call that doesn't try to emulate using setuid(), then
** you can try defining USE_SETEUID.
*/
+
# ifdef USE_SETEUID
# define setreuid(r, e) seteuid(e)
# endif /* USE_SETEUID */
@@ -224,6 +209,7 @@ extern int vsnprintf __P((char *, size_t, const char *, ...));
/*
** And of course on hpux you have setresuid()
*/
+
# ifdef USE_SETRESUID
# define setreuid(r, e) setresuid(-1, e, -1)
# endif /* USE_SETRESUID */
@@ -261,19 +247,21 @@ off_t BodyLength;
#endif /* CONTENTLENGTH */
bool EightBitMime = TRUE; /* advertise 8BITMIME in LMTP */
+char ErrBuf[10240]; /* error buffer */
int ExitVal = EX_OK; /* sysexits.h error value. */
+bool HoldErrs = FALSE; /* Hold errors in ErrBuf */
bool LMTPMode = FALSE;
-bool bouncequota = FALSE; /* permanent error when over quota */
+bool BounceQuota = FALSE; /* permanent error when over quota */
-void deliver __P((int, char *, bool));
+void deliver __P((int, char *));
int e_to_sys __P((int));
void notifybiff __P((char *));
-int store __P((char *, int));
+int store __P((char *, int, bool *));
void usage __P((void));
-void vwarn __P((const char *, _BSD_VA_LIST_));
int lockmbox __P((char *));
void unlockmbox __P((void));
void mailerr __P((const char *, const char *, ...));
+void flush_error __P((void));
int
@@ -287,7 +275,6 @@ main(argc, argv)
char *from;
extern char *optarg;
extern int optind;
- extern void dolmtp __P((bool));
/* make sure we have some open file descriptors */
@@ -313,7 +300,7 @@ main(argc, argv)
break;
case 'b': /* bounce mail when over quota. */
- bouncequota = TRUE;
+ BounceQuota = TRUE;
break;
case 'd': /* Backward compatible. */
@@ -323,7 +310,7 @@ main(argc, argv)
case 'r': /* Backward compatible. */
if (from != NULL)
{
- mailerr(NULL, "multiple -f options");
+ mailerr(NULL, "Multiple -f options");
usage();
}
from = optarg;
@@ -345,8 +332,21 @@ main(argc, argv)
notifybiff(NULL);
if (LMTPMode)
- dolmtp(bouncequota);
+ {
+ extern void dolmtp __P((void));
+ if (argc > 0)
+ {
+ mailerr("421", "Users should not be specified in command line if LMTP required");
+ exit(EX_TEMPFAIL);
+ }
+
+ dolmtp();
+ /* NOTREACHED */
+ exit(EX_OK);
+ }
+
+ /* Non-LMTP from here on out */
if (*argv == '\0')
usage();
@@ -355,6 +355,7 @@ main(argc, argv)
** uid matches, otherwise, use the name from the password file
** corresponding to the uid.
*/
+
uid = getuid();
if (from == NULL && ((from = getlogin()) == NULL ||
@@ -371,8 +372,17 @@ main(argc, argv)
** failures. This results in the delivery being reattempted later
** at the expense of repeated failures and multiple deliveries.
*/
- for (fd = store(from, 0); *argv; ++argv)
- deliver(fd, *argv, bouncequota);
+
+ HoldErrs = TRUE;
+ fd = store(from, 0, NULL);
+ HoldErrs = FALSE;
+ if (fd < 0)
+ {
+ flush_error();
+ exit(ExitVal);
+ }
+ for (; *argv != NULL; ++argv)
+ deliver(fd, *argv);
exit(ExitVal);
/* NOTREACHED */
return ExitVal;
@@ -460,7 +470,7 @@ parseaddr(s, rcpt)
p = malloc(l);
if (p == NULL)
{
- printf("421 4.3.0 memory exhausted\r\n");
+ mailerr("421 4.3.0", "Memory exhausted");
exit(EX_TEMPFAIL);
}
@@ -473,15 +483,14 @@ process_recipient(addr)
char *addr;
{
if (getpwnam(addr) == NULL)
- return "550 5.1.1 user unknown";
+ return "550 5.1.1 User unknown";
return NULL;
}
#define RCPT_GROW 30
void
-dolmtp(bouncequota)
- bool bouncequota;
+dolmtp()
{
char *return_path = NULL;
char **rcpt_addr = NULL;
@@ -495,7 +504,10 @@ dolmtp(bouncequota)
char myhostname[1024];
char buf[4096];
+ memset(myhostname, '\0', sizeof myhostname);
(void) gethostname(myhostname, sizeof myhostname - 1);
+ if (myhostname[0] == '\0')
+ strlcpy(myhostname, "localhost", sizeof myhostname);
printf("220 %s LMTP ready\r\n", myhostname);
for (;;)
@@ -515,24 +527,37 @@ dolmtp(bouncequota)
case 'D':
if (strcasecmp(buf, "data") == 0)
{
+ bool inbody = FALSE;
+
if (rcpt_num == 0)
{
- printf("503 5.5.1 No recipients\r\n");
+ mailerr("503 5.5.1", "No recipients");
continue;
}
- msgfd = store(return_path, rcpt_num);
- if (msgfd == -1)
+ HoldErrs = TRUE;
+ msgfd = store(return_path, rcpt_num, &inbody);
+ HoldErrs = FALSE;
+ if (msgfd < 0 && !inbody)
+ {
+ flush_error();
continue;
+ }
for (i = 0; i < rcpt_num; i++)
{
+ if (msgfd < 0)
+ {
+ /* print error for rcpt */
+ flush_error();
+ continue;
+ }
p = strchr(rcpt_addr[i], '+');
if (p != NULL)
- *p++ = '\0';
- deliver(msgfd, rcpt_addr[i],
- bouncequota);
+ *p = '\0';
+ deliver(msgfd, rcpt_addr[i]);
}
- (void) close(msgfd);
+ if (msgfd >= 0)
+ (void) close(msgfd);
goto rset;
}
goto syntaxerr;
@@ -546,7 +571,7 @@ dolmtp(bouncequota)
/* check for duplicate per RFC 1651 4.2 */
if (gotlhlo)
{
- printf("503 %s Duplicate LHLO\r\n",
+ mailerr("503", "%s Duplicate LHLO",
myhostname);
continue;
}
@@ -568,17 +593,19 @@ dolmtp(bouncequota)
{
if (return_path != NULL)
{
- printf("503 5.5.1 Nested MAIL command\r\n");
+ mailerr("503 5.5.1",
+ "Nested MAIL command");
continue;
}
if (strncasecmp(buf+5, "from:", 5) != 0 ||
((return_path = parseaddr(buf + 10,
FALSE)) == NULL))
{
- printf("501 5.5.4 Syntax error in parameters\r\n");
+ mailerr("501 5.5.4",
+ "Syntax error in parameters");
continue;
}
- printf("250 2.5.0 ok\r\n");
+ printf("250 2.5.0 Ok\r\n");
continue;
}
goto syntaxerr;
@@ -589,7 +616,7 @@ dolmtp(bouncequota)
case 'N':
if (strcasecmp(buf, "noop") == 0)
{
- printf("250 2.0.0 ok\r\n");
+ printf("250 2.0.0 Ok\r\n");
continue;
}
goto syntaxerr;
@@ -600,7 +627,7 @@ dolmtp(bouncequota)
case 'Q':
if (strcasecmp(buf, "quit") == 0)
{
- printf("221 2.0.0 bye\r\n");
+ printf("221 2.0.0 Bye\r\n");
exit(EX_OK);
}
goto syntaxerr;
@@ -613,7 +640,8 @@ dolmtp(bouncequota)
{
if (return_path == NULL)
{
- printf("503 5.5.1 Need MAIL command\r\n");
+ mailerr("503 5.5.1",
+ "Need MAIL command");
continue;
}
if (rcpt_num >= rcpt_alloc)
@@ -625,7 +653,8 @@ dolmtp(bouncequota)
sizeof(char **));
if (rcpt_addr == NULL)
{
- printf("421 4.3.0 memory exhausted\r\n");
+ mailerr("421 4.3.0",
+ "Memory exhausted");
exit(EX_TEMPFAIL);
}
}
@@ -633,21 +662,23 @@ dolmtp(bouncequota)
((rcpt_addr[rcpt_num] = parseaddr(buf + 8,
TRUE)) == NULL))
{
- printf("501 5.5.4 Syntax error in parameters\r\n");
+ mailerr("501 5.5.4",
+ "Syntax error in parameters");
continue;
}
- if ((err = process_recipient(rcpt_addr[rcpt_num])) != NULL)
+ err = process_recipient(rcpt_addr[rcpt_num]);
+ if (err != NULL)
{
- printf("%s\r\n", err);
+ mailerr(NULL, "%s", err);
continue;
}
rcpt_num++;
- printf("250 2.1.5 ok\r\n");
+ printf("250 2.1.5 Ok\r\n");
continue;
}
else if (strcasecmp(buf, "rset") == 0)
{
- printf("250 2.0.0 ok\r\n");
+ printf("250 2.0.0 Ok\r\n");
rset:
while (rcpt_num > 0)
@@ -665,7 +696,7 @@ rset:
case 'V':
if (strncasecmp(buf, "vrfy ", 5) == 0)
{
- printf("252 2.3.3 try RCPT to attempt delivery\r\n");
+ printf("252 2.3.3 Try RCPT to attempt delivery\r\n");
continue;
}
goto syntaxerr;
@@ -674,7 +705,7 @@ rset:
default:
syntaxerr:
- printf("500 5.5.2 Syntax error\r\n");
+ mailerr("500 5.5.2", "Syntax error");
continue;
/* NOTREACHED */
break;
@@ -683,9 +714,10 @@ rset:
}
int
-store(from, lmtprcpts)
+store(from, lmtprcpts, inbody)
char *from;
int lmtprcpts;
+ bool *inbody;
{
FILE *fp = NULL;
time_t tval;
@@ -696,28 +728,25 @@ store(from, lmtprcpts)
int fd;
char tmpbuf[sizeof _PATH_LOCTMP + 1];
+ if (inbody != NULL)
+ *inbody = FALSE;
+
(void) umask(0077);
(void) strlcpy(tmpbuf, _PATH_LOCTMP, sizeof tmpbuf);
- if ((fd = mkstemp(tmpbuf)) == -1 || (fp = fdopen(fd, "w+")) == NULL)
+ if ((fd = mkstemp(tmpbuf)) < 0 || (fp = fdopen(fd, "w+")) == NULL)
{
- if (lmtprcpts)
- {
- printf("451 4.3.0 unable to open temporary file\r\n");
- return -1;
- }
- else
- {
- mailerr("451 4.3.0", "unable to open temporary file");
- exit(ExitVal);
- }
+ mailerr("451 4.3.0", "Unable to open temporary file");
+ return -1;
}
(void) unlink(tmpbuf);
if (LMTPMode)
{
- printf("354 go ahead\r\n");
+ printf("354 Go ahead\r\n");
(void) fflush(stdout);
}
+ if (inbody != NULL)
+ *inbody = TRUE;
(void) time(&tval);
(void) fprintf(fp, "From %s %s", from, ctime(&tval));
@@ -729,7 +758,7 @@ store(from, lmtprcpts)
line[0] = '\0';
eline = TRUE;
- while (fgets(line, sizeof(line), stdin) != (char *)NULL)
+ while (fgets(line, sizeof(line), stdin) != (char *) NULL)
{
size_t line_len = 0;
int peek;
@@ -740,7 +769,7 @@ store(from, lmtprcpts)
line_len++;
/* Check for dot-stuffing */
- if (prevfl && lmtprcpts && line[0] == '.')
+ if (prevfl && LMTPMode && line[0] == '.')
{
if (line[1] == '\n' ||
(line[1] == '\r' && line[2] == '\n'))
@@ -784,7 +813,8 @@ store(from, lmtprcpts)
if (prevfl && line[0] == '\n' && HeaderLength == 0)
{
eline = FALSE;
- HeaderLength = ftell(fp);
+ if (fp != NULL)
+ HeaderLength = ftell(fp);
if (HeaderLength <= 0)
{
/*
@@ -802,6 +832,7 @@ store(from, lmtprcpts)
else
{
if (eline && line[0] == 'F' &&
+ fp != NULL &&
!memcmp(line, "From ", 5))
(void) putc('>', fp);
eline = FALSE;
@@ -821,40 +852,39 @@ store(from, lmtprcpts)
#endif /* CONTENTLENGTH */
}
- (void) fwrite(line, sizeof(char), line_len, fp);
- if (ferror(fp))
+ if (fp != NULL)
{
- if (lmtprcpts)
- {
- while (lmtprcpts--)
- printf("451 4.3.0 temporary file write error\r\n");
- (void) fclose(fp);
- return -1;
- }
- else
+ (void) fwrite(line, sizeof(char), line_len, fp);
+ if (ferror(fp))
{
mailerr("451 4.3.0",
- "temporary file write error");
+ "Temporary file write error");
(void) fclose(fp);
- exit(ExitVal);
+ fp = NULL;
+ continue;
}
}
}
- if (lmtprcpts)
+ /* check if an error occurred */
+ if (fp == NULL)
+ return -1;
+
+ if (LMTPMode)
{
/* Got a premature EOF -- toss message and exit */
exit(EX_OK);
}
/* If message not newline terminated, need an extra. */
- if (strchr(line, '\n') == NULL)
+ if (fp != NULL && strchr(line, '\n') == NULL)
(void) putc('\n', fp);
lmtpdot:
#ifdef CONTENTLENGTH
- BodyLength = ftell(fp);
+ if (fp != NULL)
+ BodyLength = ftell(fp);
if (HeaderLength == 0 && BodyLength > 0) /* empty body */
{
HeaderLength = BodyLength;
@@ -880,32 +910,23 @@ store(from, lmtprcpts)
#endif /* CONTENTLENGTH */
/* Output a newline; note, empty messages are allowed. */
- (void) putc('\n', fp);
+ if (fp != NULL)
+ (void) putc('\n', fp);
- if (fflush(fp) == EOF || ferror(fp) != 0)
+ if (fp == NULL || fflush(fp) == EOF || ferror(fp) != 0)
{
- if (lmtprcpts)
- {
- while (lmtprcpts--)
- printf("451 4.3.0 temporary file write error\r\n");
- (void) fclose(fp);
- return -1;
- }
- else
- {
- mailerr("451 4.3.0", "temporary file write error");
+ mailerr("451 4.3.0", "Temporary file write error");
+ if (fp != NULL)
(void) fclose(fp);
- exit(ExitVal);
- }
+ return -1;
}
return fd;
}
void
-deliver(fd, name, bouncequota)
+deliver(fd, name)
int fd;
char *name;
- bool bouncequota;
{
struct stat fsb;
struct stat sb;
@@ -913,6 +934,7 @@ deliver(fd, name, bouncequota)
char path[MAXPATHLEN];
int mbfd = -1, nr = 0, nw, off;
char *p;
+ char *errcode;
off_t curoff;
#ifdef CONTENTLENGTH
off_t headerbytes;
@@ -926,28 +948,17 @@ deliver(fd, name, bouncequota)
** Disallow delivery to unknown names -- special mailboxes can be
** handled in the sendmail aliases file.
*/
+
if ((pw = getpwnam(name)) == NULL)
{
- if (ExitVal != EX_TEMPFAIL)
- ExitVal = EX_UNAVAILABLE;
- if (LMTPMode)
- {
- if (ExitVal == EX_TEMPFAIL)
- printf("451 4.3.0 cannot lookup name: %s\r\n",
- name);
- else
- printf("550 5.1.1 unknown name: %s\r\n", name);
- }
+ if (ExitVal == EX_TEMPFAIL)
+ errcode = "451 4.3.0";
else
{
- char *errcode = NULL;
-
- if (ExitVal == EX_TEMPFAIL)
- errcode = "451 4.3.0";
- else
- errcode = "550 5.1.1";
- mailerr(errcode, "unknown name: %s", name);
+ ExitVal = EX_UNAVAILABLE;
+ errcode = "550 5.1.1";
}
+ mailerr(errcode, "Unknown name: %s", name);
return;
}
endpwent();
@@ -1007,16 +1018,13 @@ tryagain:
if (off == EX_TEMPFAIL || e_to_sys(off) == EX_TEMPFAIL)
{
ExitVal = EX_TEMPFAIL;
- mailerr("451 4.3.0",
- "lockmailbox %s failed; error code %d %s",
- p, off, errno > 0 ? errstring(errno) : "");
+ errcode = "451 4.3.0";
}
else
- {
- mailerr("551 5.3.0",
- "lockmailbox %s failed; error code %d %s",
- p, off, errno > 0 ? errstring(errno) : "");
- }
+ errcode = "551 5.3.0";
+
+ mailerr(errcode, "lockmailbox %s failed; error code %d %s",
+ p, off, errno > 0 ? errstring(errno) : "");
return;
}
@@ -1043,7 +1051,7 @@ tryagain:
"%s: lstat: file changed after open", path);
goto err1;
}
- if (mbfd == -1)
+ if (mbfd < 0)
{
if (save_errno == EEXIST)
goto tryagain;
@@ -1128,7 +1136,7 @@ tryagain:
}
/* Get the starting offset of the new message for biff. */
- curoff = lseek(mbfd, (off_t)0, SEEK_END);
+ curoff = lseek(mbfd, (off_t) 0, SEEK_END);
if (sizeof curoff > sizeof(long))
(void) snprintf(biffmsg, sizeof(biffmsg), "%s@%s\n",
name, quad_to_string(curoff));
@@ -1137,9 +1145,9 @@ tryagain:
name, (long) curoff);
/* Copy the message into the file. */
- if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1)
+ if (lseek(fd, (off_t) 0, SEEK_SET) == (off_t) -1)
{
- mailerr("450 4.2.0", "temporary file: %s",
+ mailerr("450 4.2.0", "Temporary file: %s",
errstring(errno));
goto err1;
}
@@ -1176,13 +1184,12 @@ tryagain:
{
if ((nw = write(mbfd, buf + off, nr - off)) < 0)
{
+ errcode = "450 4.2.0";
#ifdef EDQUOT
- if (errno == EDQUOT && bouncequota)
- mailerr("552 5.2.2", "%s: %s",
- path, errstring(errno));
- else
+ if (errno == EDQUOT && BounceQuota)
+ errcode = "552 5.2.2";
#endif /* EDQUOT */
- mailerr("450 4.2.0", "%s: %s",
+ mailerr(errcode, "%s: %s",
path, errstring(errno));
goto err3;
}
@@ -1190,7 +1197,7 @@ tryagain:
}
if (nr < 0)
{
- mailerr("450 4.2.0", "temporary file: %s",
+ mailerr("450 4.2.0", "Temporary file: %s",
errstring(errno));
goto err3;
}
@@ -1200,15 +1207,7 @@ tryagain:
{
mailerr("450 4.2.0", "%s: %s", path, errstring(errno));
err3:
- if (setreuid(0, 0) < 0)
- {
-#if 0
- /* already printed an error above for this recipient */
- (void) e_to_sys(errno);
- mailerr("450 4.2.0", "setreuid(0, 0): %s",
- errstring(errno));
-#endif /* 0 */
- }
+ (void) setreuid(0, 0);
#ifdef DEBUG
fprintf(stderr, "reset euid = %d\n", geteuid());
#endif /* DEBUG */
@@ -1222,12 +1221,12 @@ err0: unlockmbox();
/* Close and check -- NFS doesn't write until the close. */
if (close(mbfd))
{
+ errcode = "450 4.2.0";
#ifdef EDQUOT
- if (errno == EDQUOT && bouncequota)
- mailerr("552 5.2.2", "%s: %s", path, errstring(errno));
- else
+ if (errno == EDQUOT && BounceQuota)
+ errcode = "552 5.2.2";
#endif /* EDQUOT */
- mailerr("450 4.2.0", "%s: %s", path, errstring(errno));
+ mailerr(errcode, "%s: %s", path, errstring(errno));
(void) truncate(path, curoff);
}
else
@@ -1244,7 +1243,7 @@ err0: unlockmbox();
#endif /* DEBUG */
unlockmbox();
if (LMTPMode)
- printf("250 2.1.5 %s OK\r\n", name);
+ printf("250 2.1.5 %s Ok\r\n", name);
}
/*
@@ -1399,7 +1398,7 @@ notifybiff(msg)
if (addr.sin_family == AF_UNSPEC)
return;
- if (f < 0 && (f = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+ if (f < 0 && (f = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
return;
len = strlen(msg) + 1;
(void) sendto(f, msg, len, 0, (struct sockaddr *) &addr, sizeof(addr));
@@ -1423,61 +1422,53 @@ mailerr(hdr, fmt, va_alist)
va_dcl
#endif /* __STDC__ */
{
+ size_t len = 0;
va_list ap;
+ (void) e_to_sys(errno);
+
#ifdef __STDC__
va_start(ap, fmt);
#else /* __STDC__ */
va_start(ap);
#endif /* __STDC__ */
+
if (LMTPMode)
{
if (hdr != NULL)
- printf("%s ", hdr);
- (void) vprintf(fmt, ap);
- (void) printf("\r\n");
- }
- else
- {
- (void) e_to_sys(errno);
- vwarn(fmt, ap);
+ {
+ snprintf(ErrBuf, sizeof ErrBuf, "%s ", hdr);
+ len = strlen(ErrBuf);
+ }
}
+ (void) vsnprintf(&ErrBuf[len], sizeof ErrBuf - len, fmt, ap);
+
+ if (!HoldErrs)
+ flush_error();
+
+ /* Log the message to syslog. */
+ if (!LMTPMode)
+ syslog(LOG_ERR, "%s", ErrBuf);
}
void
-vwarn(fmt, ap)
- const char *fmt;
- _BSD_VA_LIST_ ap;
+flush_error()
{
- /*
- ** Log the message to stderr.
- **
- ** Don't use LOG_PERROR as an openlog() flag to do this,
- ** it's not portable enough.
- */
-
- if (ExitVal != EX_USAGE)
- (void) fprintf(stderr, "mail.local: ");
- (void) vfprintf(stderr, fmt, ap);
- (void) fprintf(stderr, "\n");
-
-#if USE_VSYSLOG
- /* Log the message to syslog. */
- vsyslog(LOG_ERR, fmt, ap);
-#else /* USE_VSYSLOG */
+ if (LMTPMode)
+ printf("%s\r\n", ErrBuf);
+ else
{
- char fmtbuf[10240];
-
- (void) vsnprintf(fmtbuf, sizeof fmtbuf, fmt, ap);
- syslog(LOG_ERR, "%s", fmtbuf);
+ if (ExitVal != EX_USAGE)
+ (void) fprintf(stderr, "mail.local: ");
+ fprintf(stderr, "%s\n", ErrBuf);
}
-#endif /* USE_VSYSLOG */
}
/*
* e_to_sys --
* Guess which errno's are temporary. Gag me.
*/
+
int
e_to_sys(num)
int num;
@@ -1490,7 +1481,7 @@ e_to_sys(num)
{
#ifdef EDQUOT
case EDQUOT: /* Disc quota exceeded */
- if (bouncequota)
+ if (BounceQuota)
{
ExitVal = EX_UNAVAILABLE;
break;
@@ -1631,15 +1622,6 @@ mkstemp(path)
return (_gettemp(path, &fd) ? fd : -1);
}
-# if 0
-char *
-mktemp(path)
- char *path;
-{
- return(_gettemp(path, (int *)NULL) ? path : (char *)NULL);
-}
-# endif /* 0 */
-
static
_gettemp(path, doopen)
char *path;
diff --git a/contrib/sendmail/mailstats/mailstats.c b/contrib/sendmail/mailstats/mailstats.c
index 1984c673ccfb..0632f6e701ee 100644
--- a/contrib/sendmail/mailstats/mailstats.c
+++ b/contrib/sendmail/mailstats/mailstats.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: mailstats.c,v 8.53.16.11 2000/09/17 17:04:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: mailstats.c,v 8.53.16.12 2001/02/15 20:52:36 geir Exp $";
#endif /* ! lint */
#include <unistd.h>
diff --git a/contrib/sendmail/praliases/praliases.c b/contrib/sendmail/praliases/praliases.c
index 8db0cd15eb92..b40d19d54ba1 100644
--- a/contrib/sendmail/praliases/praliases.c
+++ b/contrib/sendmail/praliases/praliases.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1983 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1988, 1993\n\
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: praliases.c,v 8.59.4.15 2000/10/24 00:42:59 geir Exp $";
+static char id[] = "@(#)$Id: praliases.c,v 8.59.4.18 2001/01/22 19:00:18 gshapiro Exp $";
#endif /* ! lint */
#include <sys/types.h>
@@ -272,6 +272,21 @@ praliases(filename, argc, argv)
db_name++;
}
+ /* Skip non-file based DB types */
+ if (db_type != NULL && *db_type != '\0')
+ {
+ if (db_type != SMDB_TYPE_DEFAULT &&
+ strcmp(db_type, "hash") != 0 &&
+ strcmp(db_type, "btree") != 0 &&
+ strcmp(db_type, "dbm") != 0)
+ {
+ fprintf(stderr,
+ "praliases: Skipping non-file based alias type %s\n",
+ db_type);
+ return;
+ }
+ }
+
if (*db_name == '\0' || (db_type != NULL && *db_type == '\0'))
{
if (colon != NULL)
diff --git a/contrib/sendmail/rmail/rmail.c b/contrib/sendmail/rmail/rmail.c
index dcd10d31d451..a091492e724f 100644
--- a/contrib/sendmail/rmail/rmail.c
+++ b/contrib/sendmail/rmail/rmail.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: rmail.c,v 8.39.4.9 2000/11/17 08:42:56 gshapiro Exp $";
+static char id[] = "@(#)$Id: rmail.c,v 8.39.4.11 2001/02/14 04:07:25 gshapiro Exp $";
#endif /* ! lint */
/*
@@ -97,9 +97,9 @@ static char id[] = "@(#)$Id: rmail.c,v 8.39.4.9 2000/11/17 08:42:56 gshapiro Exp
# define memmove(d, s, l) (bcopy((s), (d), (l)))
#endif /* defined(sun) && !defined(BSD) && !defined(SOLARIS) && !defined(__svr4__) && !defined(__SVR4) */
-#if !HASSNPRINTF
+#if !HASSNPRINTF && !SFIO
extern int snprintf __P((char *, size_t, const char *, ...));
-#endif /* !HASSNPRINTF */
+#endif /* !HASSNPRINTF && !SFIO */
#if defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__) || defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
# ifndef HASSTRERROR
diff --git a/contrib/sendmail/smrsh/smrsh.c b/contrib/sendmail/smrsh/smrsh.c
index f1e622523cdd..71bcb2c82141 100644
--- a/contrib/sendmail/smrsh/smrsh.c
+++ b/contrib/sendmail/smrsh/smrsh.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1993 Eric P. Allman. All rights reserved.
* Copyright (c) 1993
@@ -13,7 +13,7 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1993 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1993\n\
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.6 2000/10/09 20:37:16 gshapiro Exp $";
+static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.8 2001/01/22 19:00:26 gshapiro Exp $";
#endif /* ! lint */
/*
@@ -76,9 +76,9 @@ static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.6 2000/10/09 20:37:16 gshapiro Exp
#ifndef CMDDIR
# if defined(HPUX10) || defined(HPUX11) || SOLARIS >= 20800
# define CMDDIR "/var/adm/sm.bin"
-# else /* HPUX10 || HPUX11 || SOLARIS > 20800 */
+# else /* HPUX10 || HPUX11 || SOLARIS >= 20800 */
# define CMDDIR "/usr/adm/sm.bin"
-# endif /* HPUX10 || HPUX11 || SOLARIS > 20800 */
+# endif /* HPUX10 || HPUX11 || SOLARIS >= 20800 */
#endif /* ! CMDDIR */
/* characters disallowed in the shell "-c" argument */
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index e4e62a1d8fec..fc8917afce2f 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -1,4 +1,4 @@
-# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+# 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
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.263.2.1.2.27 2000/12/16 16:46:02 gshapiro Exp $
+# $Id: README,v 8.263.2.1.2.32 2001/01/29 23:45:22 gshapiro Exp $
#
This directory contains the source files for sendmail(TM).
@@ -631,9 +631,10 @@ YOU HEADACHES!
When attempting to canonify a hostname, some broken name servers will
return SERVFAIL (a temporary failure) on T_AAAA (IPv6) lookups. If you
want to excuse this behavior, compile sendmail with
--D_FFR_WORKAROUND_BROKEN_NAMESERVERS. However, instead, we recommend catching
-the problem and reporting it to the name server administrator so we can rid
-the world of broken name servers.
+-D_FFR_WORKAROUND_BROKEN_NAMESERVERS and add WorkAroundBrokenAAAA to your
+ResolverOptions setting. However, instead, we recommend catching the
+problem and reporting it to the name server administrator so we can rid the
+world of broken name servers.
+----------------------------------------+
| STARTTLS COMPILATION AND CONFIGURATION |
@@ -1038,6 +1039,12 @@ IRIX 6.x
If you are using XFS filesystem, avoid using the -32 ABI switch to
the cc compiler if possible.
+ Broken inet_aton and inet_ntoa on IRIX using gcc: There's
+ a problem with gcc on IRIX, i.e., gcc can't pass structs
+ less than 16 bits long unless they are 8 bits; IRIX 6.2 has
+ some other sized structs. See
+ http://www.bitmechanic.com/mail-archives/mysql/current/0418.html
+
IRIX 6.4
The IRIX 6.5.4 version of /bin/m4 does not work properly with
sendmail. Either install fw_m4.sw.m4 off the Freeware_May99 CD and
@@ -1096,8 +1103,10 @@ BSDI (BSD/386) 1.0, NetBSD 0.9, FreeBSD 1.0
determined to continue to use your old, buggy version (or as
a shortcut to get sendmail working -- I'm sure you have the
best intentions to port a modern version of BIND), you can
- copy ../contrib/oldbind.compat.c into sendmail and add
- oldbind.compat.o to OBJADD in the Makefile.
+ copy ../contrib/oldbind.compat.c into sendmail and add the
+ following to devtools/Site/site.config.m4:
+
+ APPENDDEF(`confOBJADD', `oldbind.compat.o')
A/UX
Date: Tue, 12 Oct 1993 18:28:28 -0400 (EDT)
@@ -1236,6 +1245,17 @@ Linux
"#include <syslog.h>" to the SFIO version of stdio.h as the very
first line.
+glibc
+ glibc 2.2.1 (and possibly other versions) changed the value of
+ __RES in resolv.h but failed to actually provide the IPv6 API
+ changes that the change implied. Therefore, compiling with
+ -DNETINET6 fails.
+
+ Workarounds:
+ 1) Compile without -DNETINET6
+ 2) Build against a real BIND 8.2.2 include/lib tree
+ 3) Wait for glibc to fix it
+
AIX 4.X
The AIX 4.X linker uses library paths specified during compilation
using -L for run-time shared library searches. Therefore, it is
@@ -1268,7 +1288,7 @@ AIX 4.3.3
Workarounds:
1) Compile without -DNETINET6
- 2) Build against a real Bind 8.2.2 include/lib tree
+ 2) Build against a real BIND 8.2.2 include/lib tree
3) Wait for IBM to fix it
AIX 4.X
@@ -1668,4 +1688,4 @@ util.c Some general purpose routines used by sendmail.
version.c The version number and information about this
version of sendmail.
-(Version $Revision: 8.263.2.1.2.27 $, last update $Date: 2000/12/16 16:46:02 $ )
+(Version $Revision: 8.263.2.1.2.32 $, last update $Date: 2001/01/29 23:45:22 $ )
diff --git a/contrib/sendmail/src/bf.h b/contrib/sendmail/src/bf.h
index d7d6303fb412..8fc86aec701d 100644
--- a/contrib/sendmail/src/bf.h
+++ b/contrib/sendmail/src/bf.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+ * 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.
*
- * $Id: bf.h,v 8.5 1999/11/04 19:31:25 ca Exp $
+ * $Id: bf.h,v 8.5.16.2 2001/02/14 04:07:27 gshapiro Exp $
*
* Contributed by Exactis.com, Inc.
*
@@ -20,6 +20,7 @@ extern FILE *bfdup __P((FILE *));
extern int bfcommit __P((FILE *));
extern int bfrewind __P((FILE *));
extern int bftruncate __P((FILE *));
+extern int bffsync __P((FILE *));
extern int bfclose __P((FILE *));
extern bool bftest __P((FILE *));
diff --git a/contrib/sendmail/src/bf_portable.c b/contrib/sendmail/src/bf_portable.c
index 4de0af3cd3f3..3c09cece34a1 100644
--- a/contrib/sendmail/src/bf_portable.c
+++ b/contrib/sendmail/src/bf_portable.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: bf_portable.c,v 8.25.4.3 2000/06/29 21:21:58 gshapiro Exp $";
+static char id[] = "@(#)$Id: bf_portable.c,v 8.25.4.5 2001/02/14 04:07:27 gshapiro Exp $";
#endif /* ! lint */
#if SFIO
@@ -283,6 +283,47 @@ bftruncate(fp)
}
/*
+** 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:
diff --git a/contrib/sendmail/src/bf_torek.c b/contrib/sendmail/src/bf_torek.c
index ab129d43b70b..d58abc9c50e2 100644
--- a/contrib/sendmail/src/bf_torek.c
+++ b/contrib/sendmail/src/bf_torek.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: bf_torek.c,v 8.19.18.2 2000/09/17 17:04:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: bf_torek.c,v 8.19.18.4 2001/02/14 04:07:27 gshapiro Exp $";
#endif /* ! lint */
#if SFIO
@@ -381,6 +381,51 @@ bftruncate(fp)
}
/*
+** 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:
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index c6c5f78bd380..d1c7f1c4a31d 100644
--- a/contrib/sendmail/src/collect.c
+++ b/contrib/sendmail/src/collect.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: collect.c,v 8.136.4.8 2000/10/09 00:50:04 gshapiro Exp $";
+static char id[] = "@(#)$Id: collect.c,v 8.136.4.15 2001/02/21 01:05:59 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -84,7 +84,6 @@ collect(fp, smtpmode, hdrp, e)
volatile int hdrslen = 0;
volatile int numhdrs = 0;
volatile int dfd;
- volatile int afd;
volatile int rstat = EX_OK;
u_char *volatile pbp;
u_char peekbuf[8];
@@ -102,6 +101,8 @@ collect(fp, smtpmode, hdrp, e)
if (!headeronly)
{
struct stat stbuf;
+ long sff = SFF_OPENASROOT;
+
(void) strlcpy(dfname, queuename(e, 'd'), sizeof dfname);
#if _FFR_QUEUE_FILE_MODE
@@ -110,18 +111,21 @@ collect(fp, smtpmode, hdrp, e)
if (bitset(S_IWGRP, QueueFileMode))
oldumask = umask(002);
- df = bfopen(dfname, QueueFileMode, DataFileBufferSize,
- SFF_OPENASROOT);
+ df = bfopen(dfname, QueueFileMode,
+ DataFileBufferSize, sff);
if (bitset(S_IWGRP, QueueFileMode))
(void) umask(oldumask);
}
#else /* _FFR_QUEUE_FILE_MODE */
- df = bfopen(dfname, FileMode, DataFileBufferSize,
- SFF_OPENASROOT);
+ df = bfopen(dfname, FileMode, DataFileBufferSize, sff);
#endif /* _FFR_QUEUE_FILE_MODE */
if (df == NULL)
{
- syserr("Cannot create %s", dfname);
+ HoldErrs = FALSE;
+ if (smtpmode)
+ syserr("421 4.3.5 Unable to create data file");
+ else
+ syserr("Cannot create %s", dfname);
e->e_flags |= EF_NO_BODY_RETN;
finis(TRUE, ExitStat);
/* NOTREACHED */
@@ -346,8 +350,9 @@ bufferchar:
else if (c != '\0')
{
*bp++ = c;
+ hdrslen++;
if (MaxHeadersLength > 0 &&
- ++hdrslen > MaxHeadersLength)
+ hdrslen > MaxHeadersLength)
{
sm_syslog(LOG_NOTICE, e->e_id,
"headers too large (%d max) from %s during message collect",
@@ -496,13 +501,6 @@ readerr:
/* skip next few clauses */
/* EMPTY */
}
- else if ((afd = fileno(df)) >= 0 && fsync(afd) < 0)
- {
- dferror(df, "fsync", e);
- flush_errors(TRUE);
- finis(TRUE, ExitStat);
- /* NOTREACHED */
- }
else if (bfcommit(df) < 0)
{
int save_errno = errno;
@@ -527,6 +525,13 @@ readerr:
flush_errors(TRUE);
finis(save_errno != EEXIST, ExitStat);
}
+ else if (bffsync(df) < 0)
+ {
+ dferror(df, "bffsync", e);
+ flush_errors(TRUE);
+ finis(TRUE, ExitStat);
+ /* NOTREACHED */
+ }
else if (bfclose(df) < 0)
{
dferror(df, "bfclose", e);
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index f1d5a8a2e5d5..bff13f4845c8 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.61 2000/12/28 23:46:41 gshapiro Exp $";
+static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.69 2001/02/27 19:50:11 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -4358,7 +4358,7 @@ getipnodebyname(name, family, flags, err)
resv6 = bitset(RES_USE_INET6, _res.options);
_res.options |= RES_USE_INET6;
}
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
h = gethostbyname(name);
*err = h_errno;
if (family == AF_INET6 && !resv6)
@@ -4375,7 +4375,7 @@ getipnodebyaddr(addr, len, family, err)
{
struct hostent *h;
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
h = gethostbyaddr(addr, len, family);
*err = h_errno;
return h;
@@ -4401,6 +4401,7 @@ sm_gethostbyname(name, family)
char *name;
int family;
{
+ int save_errno;
struct hostent *h = NULL;
#if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4))
# if SOLARIS == 20300 || SOLARIS == 203
@@ -4411,12 +4412,14 @@ sm_gethostbyname(name, family)
if (tTd(61, 10))
dprintf("_switch_gethostbyname_r(%s)... ", name);
h = _switch_gethostbyname_r(name, &hp, buf, sizeof(buf), &h_errno);
+ save_errno = errno;
# else /* SOLARIS == 20300 || SOLARIS == 203 */
extern struct hostent *__switch_gethostbyname();
if (tTd(61, 10))
dprintf("__switch_gethostbyname(%s)... ", name);
h = __switch_gethostbyname(name);
+ save_errno = errno;
# endif /* SOLARIS == 20300 || SOLARIS == 203 */
#else /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4)) */
int nmaps;
@@ -4424,7 +4427,6 @@ sm_gethostbyname(name, family)
int flags = AI_DEFAULT|AI_ALL;
int err;
# endif /* NETINET6 */
- int save_errno;
char *maptype[MAXMAPSTACK];
short mapreturn[MAXMAPACTIONS];
char hbuf[MAXNAME];
@@ -4437,7 +4439,7 @@ sm_gethostbyname(name, family)
flags &= ~AI_ADDRCONFIG;
# endif /* ADDRCONFIG_IS_BROKEN */
h = getipnodebyname(name, family, flags, &err);
- h_errno = err;
+ SM_SET_H_ERRNO(err);
# else /* NETINET6 */
h = gethostbyname(name);
# endif /* NETINET6 */
@@ -4465,7 +4467,7 @@ sm_gethostbyname(name, family)
return NULL;
}
(void) strlcpy(hbuf, name, sizeof hbuf);
- shorten_hostname(hbuf);
+ (void) shorten_hostname(hbuf);
/* if it hasn't been shortened, there's no point */
if (strcmp(hbuf, name) != 0)
@@ -4478,7 +4480,7 @@ sm_gethostbyname(name, family)
h = getipnodebyname(hbuf, family,
AI_V4MAPPED|AI_ALL,
&err);
- h_errno = err;
+ SM_SET_H_ERRNO(err);
save_errno = errno;
# else /* NETINET6 */
h = gethostbyname(hbuf);
@@ -4541,26 +4543,42 @@ sm_gethostbyaddr(addr, len, type)
int type;
{
struct hostent *hp;
+
+#if NETINET6
+ if (type == AF_INET6 &&
+ IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *) addr))
+ {
+ /* Avoid reverse lookup for IPv6 unspecified address */
+ SM_SET_H_ERRNO(HOST_NOT_FOUND);
+ return NULL;
+ }
+#endif /* NETINET6 */
+
#if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204)
# if SOLARIS == 20300 || SOLARIS == 203
- static struct hostent he;
- static char buf[1000];
- extern struct hostent *_switch_gethostbyaddr_r();
+ {
+ static struct hostent he;
+ static char buf[1000];
+ extern struct hostent *_switch_gethostbyaddr_r();
- hp = _switch_gethostbyaddr_r(addr, len, type, &he, buf, sizeof(buf), &h_errno);
+ hp = _switch_gethostbyaddr_r(addr, len, type, &he,
+ buf, sizeof(buf), &h_errno);
+ }
# else /* SOLARIS == 20300 || SOLARIS == 203 */
- extern struct hostent *__switch_gethostbyaddr();
+ {
+ extern struct hostent *__switch_gethostbyaddr();
- hp = __switch_gethostbyaddr(addr, len, type);
+ hp = __switch_gethostbyaddr(addr, len, type);
+ }
# endif /* SOLARIS == 20300 || SOLARIS == 203 */
#else /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) */
# if NETINET6
- int err;
-# endif /* NETINET6 */
+ {
+ int err;
-# if NETINET6
- hp = getipnodebyaddr(addr, len, type, &err);
- h_errno = err;
+ hp = getipnodebyaddr(addr, len, type, &err);
+ SM_SET_H_ERRNO(err);
+ }
# else /* NETINET6 */
hp = gethostbyaddr(addr, len, type);
# endif /* NETINET6 */
@@ -4935,18 +4953,21 @@ load_if_names()
switch (af)
{
case AF_INET6:
- ia6 = sa->sin6.sin6_addr;
-# ifdef __KAME__
- /* convert into proper scoped address - */
- if ((IN6_IS_ADDR_LINKLOCAL(&ia6) ||
- IN6_IS_ADDR_SITELOCAL(&ia6)) &&
+# ifdef __KAME__
+ /* convert into proper scoped address */
+ if ((IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr) ||
+ IN6_IS_ADDR_SITELOCAL(&sa->sin6.sin6_addr)) &&
sa->sin6.sin6_scope_id == 0)
{
- sa->sin6.sin6_scope_id = ntohs(ia6.s6_addr[3] |
- ((unsigned int) ia6.s6_addr[2] << 8));
- ia6.s6_addr[2] = ia6.s6_addr[3] = 0;
+ struct in6_addr *ia6p;
+
+ ia6p = &sa->sin6.sin6_addr;
+ sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
+ ((unsigned int)ia6p->s6_addr[2] << 8));
+ ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
}
-# endif /* __KAME__ */
+# endif /* __KAME__ */
+ ia6 = sa->sin6.sin6_addr;
if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
{
addr = anynet_ntop(&ia6, buf6, sizeof buf6);
@@ -5129,6 +5150,20 @@ load_if_names()
# if NETINET6
case AF_INET6:
+# ifdef __KAME__
+ /* convert into proper scoped address */
+ if ((IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr) ||
+ IN6_IS_ADDR_SITELOCAL(&sa->sin6.sin6_addr)) &&
+ sa->sin6.sin6_scope_id == 0)
+ {
+ struct in6_addr *ia6p;
+
+ ia6p = &sa->sin6.sin6_addr;
+ sa->sin6.sin6_scope_id = ntohs(ia6p->s6_addr[3] |
+ ((unsigned int)ia6p->s6_addr[2] << 8));
+ ia6p->s6_addr[2] = ia6p->s6_addr[3] = 0;
+ }
+# endif /* __KAME__ */
ia6 = sa->sin6.sin6_addr;
if (IN6_IS_ADDR_UNSPECIFIED(&ia6))
{
diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h
index 3e478f0b8ff9..f98533d7615d 100644
--- a/contrib/sendmail/src/conf.h
+++ b/contrib/sendmail/src/conf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Id: conf.h,v 8.496.4.32 2000/12/15 19:20:53 gshapiro Exp $
+ * $Id: conf.h,v 8.496.4.37 2001/02/12 21:40:16 gshapiro Exp $
*/
/*
@@ -488,6 +488,9 @@ typedef int pid_t;
# endif /* ! __svr4__ */
# define GIDSET_T gid_t
# define USE_SA_SIGACTION 1 /* use sa_sigaction field */
+# if _FFR_MILTER
+# define BROKEN_PTHREAD_SLEEP 1 /* sleep after pthread_create() fails */
+# endif /* _FFR_MILTER */
# ifndef _PATH_UNIX
# define _PATH_UNIX "/dev/ksyms"
# endif /* ! _PATH_UNIX */
@@ -1004,6 +1007,12 @@ typedef int pid_t;
# define HASSTRL 0 /* strlcat(3) is broken in 2.5 and earlier */
# else /* OpenBSD < 199912 */
# define HASSTRL 1 /* has strlc{py,at}(3) functions */
+# if OpenBSD >= 200006
+# define HASSRANDOMDEV 1 /* has srandomdev(3) */
+# endif
+# if OpenBSD >= 200012
+# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */
+# endif
# endif /* OpenBSD < 199912 */
# endif /* defined(__OpenBSD__) */
#endif /* defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
@@ -1727,6 +1736,9 @@ typedef int pid_t;
# define _PATH_SENDMAILPID "/etc/sendmail.pid"
# endif /* ! _PATH_SENDMAILPID */
# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
+#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
+# define SM_SET_H_ERRNO(err) set_h_errno((err))
+#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
#endif /* __svr5__ */
/* ###################################################################### */
@@ -2722,6 +2734,10 @@ typedef void (*sigfunc_t) __P((int));
# define FORK fork /* function to call to fork mailer */
#endif /* ! FORK */
+/* setting h_errno */
+#ifndef SM_SET_H_ERRNO
+# define SM_SET_H_ERRNO(err) h_errno = (err)
+#endif /* SM_SET_H_ERRNO */
/* random routine -- set above using #ifdef _osname_ or in Makefile */
#if HASRANDOM
@@ -2810,7 +2826,6 @@ typedef void (*sigfunc_t) __P((int));
# endif /* !HASSNPRINTF */
#endif /* SFIO */
-
#ifndef SFIO_STDIO_COMPAT
# define SFIO_STDIO_COMPAT 0
#endif /* ! SFIO_STDIO_COMPAT */
diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c
index dda27618fb06..95506abbec55 100644
--- a/contrib/sendmail/src/control.c
+++ b/contrib/sendmail/src/control.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: control.c,v 8.44.14.13 2000/12/28 21:25:52 gshapiro Exp $";
+static char id[] = "@(#)$Id: control.c,v 8.44.14.15 2001/01/22 19:00:22 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index e29d77430df3..f4b07d420871 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -16,9 +16,9 @@
#ifndef lint
# ifdef DAEMON
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.41 2000/12/28 23:46:43 gshapiro Exp $ (with daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.51 2001/02/23 18:57:27 geir Exp $ (with daemon mode)";
# else /* DAEMON */
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.41 2000/12/28 23:46:43 gshapiro Exp $ (without daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.51 2001/02/23 18:57:27 geir Exp $ (without daemon mode)";
# endif /* DAEMON */
#endif /* ! lint */
@@ -461,9 +461,29 @@ getrequests(e)
FD_ISSET(Daemons[idx].d_socket, &readfds))
{
lotherend = Daemons[idx].d_socksize;
+ memset(&RealHostAddr, '\0',
+ sizeof RealHostAddr);
t = accept(Daemons[idx].d_socket,
(struct sockaddr *)&RealHostAddr,
&lotherend);
+
+ /*
+ ** If remote side closes before
+ ** accept() finishes, sockaddr
+ ** might not be fully filled in.
+ */
+
+ if (t >= 0 &&
+ (lotherend == 0 ||
+# ifdef BSD4_4_SOCKADDR
+ RealHostAddr.sa.sa_len == 0 ||
+# endif /* BSD4_4_SOCKADDR */
+ RealHostAddr.sa.sa_family != Daemons[idx].d_addr.sa.sa_family))
+ {
+ (void) close(t);
+ t = -1;
+ errno = EINVAL;
+ }
olddaemon = curdaemon = idx;
break;
}
@@ -477,10 +497,30 @@ getrequests(e)
struct sockaddr_un sa_un;
lotherend = sizeof sa_un;
+ memset(&sa_un, '\0', sizeof sa_un);
t = accept(ControlSocket,
(struct sockaddr *)&sa_un,
&lotherend);
- control = TRUE;
+
+ /*
+ ** If remote side closes before
+ ** accept() finishes, sockaddr
+ ** might not be fully filled in.
+ */
+
+ if (t >= 0 &&
+ (lotherend == 0 ||
+# ifdef BSD4_4_SOCKADDR
+ sa_un.sun_len == 0 ||
+# endif /* BSD4_4_SOCKADDR */
+ sa_un.sun_family != AF_UNIX))
+ {
+ (void) close(t);
+ t = -1;
+ errno = EINVAL;
+ }
+ if (t >= 0)
+ control = TRUE;
}
# else /* NETUNIX */
if (curdaemon == -1)
@@ -1614,7 +1654,8 @@ makeconnection(host, port, mci, e)
/* Set up the address for outgoing connection. */
if (bitnset(D_BINDIF, d_flags) &&
- (p = macvalue(macid("{if_addr}", NULL), e)) != NULL)
+ (p = macvalue(macid("{if_addr}", NULL), e)) != NULL &&
+ *p != '\0')
{
# if NETINET6
char p6[INET6_ADDRSTRLEN];
@@ -1628,18 +1669,13 @@ makeconnection(host, port, mci, e)
{
# if NETINET
case AF_INET:
- if ((clt_addr.sin.sin_addr.s_addr = inet_addr(p))
- != INADDR_NONE)
+ clt_addr.sin.sin_addr.s_addr = inet_addr(p);
+ if (clt_addr.sin.sin_addr.s_addr != INADDR_NONE &&
+ clt_addr.sin.sin_addr.s_addr != INADDR_LOOPBACK)
{
clt_bind = TRUE;
socksize = sizeof (struct sockaddr_in);
}
- else if (clt_addr.sin.sin_port != 0)
- {
- clt_addr.sin.sin_addr.s_addr = INADDR_ANY;
- clt_bind = TRUE;
- socksize = sizeof (struct sockaddr_in);
- }
break;
# endif /* NETINET */
@@ -1650,15 +1686,9 @@ makeconnection(host, port, mci, e)
else
strlcpy(p6, p, sizeof p6);
if (inet_pton(AF_INET6, p6,
- &clt_addr.sin6.sin6_addr) == 1)
- {
- clt_bind = TRUE;
- socksize = sizeof (struct sockaddr_in6);
- }
- else if (clt_addr.sin6.sin6_port != 0)
+ &clt_addr.sin6.sin6_addr) == 1 &&
+ !IN6_IS_ADDR_LOOPBACK(&clt_addr.sin6.sin6_addr))
{
- if (IN6_IS_ADDR_UNSPECIFIED(&clt_addr.sin6.sin6_addr))
- clt_addr.sin6.sin6_addr = in6addr_any;
clt_bind = TRUE;
socksize = sizeof (struct sockaddr_in6);
}
@@ -1721,7 +1751,7 @@ makeconnection(host, port, mci, e)
*/
# if NAMED_BIND
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
# endif /* NAMED_BIND */
errno = 0;
memset(&CurHostAddr, '\0', sizeof CurHostAddr);
@@ -2396,10 +2426,8 @@ myhostname(hostbuf, size)
{
register struct hostent *hp;
- if (gethostname(hostbuf, size) < 0)
- {
+ if (gethostname(hostbuf, size) < 0 || hostbuf[0] == '\0')
(void) strlcpy(hostbuf, "localhost", size);
- }
hp = sm_gethostbyname(hostbuf, InetMode);
if (hp == NULL)
return NULL;
@@ -3045,7 +3073,7 @@ host_map_lookup(map, name, av, statp)
: s->s_namecanon.nc_cname);
errno = s->s_namecanon.nc_errno;
# if NAMED_BIND
- h_errno = s->s_namecanon.nc_herrno;
+ SM_SET_H_ERRNO(s->s_namecanon.nc_herrno);
# endif /* NAMED_BIND */
*statp = s->s_namecanon.nc_stat;
if (*statp == EX_TEMPFAIL)
@@ -3221,6 +3249,8 @@ myhostname(hostbuf, size)
fixcrlf(hostbuf, TRUE);
(void) fclose(f);
}
+ if (hostbuf[0] == '\0')
+ (void) strlcpy(hostbuf, "localhost", size);
return NULL;
}
/*
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 440b1dba6b83..689ceeb39adc 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.56 2000/12/19 01:16:12 gshapiro Exp $";
+static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.66 2001/02/25 23:30:35 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -1132,7 +1132,7 @@ deliver(e, firstto)
if (*mvp == NULL)
{
- /* running SMTP */
+ /* running LMTP or SMTP */
#if SMTP
clever = TRUE;
*pvp = NULL;
@@ -1142,6 +1142,14 @@ deliver(e, firstto)
return EX_SOFTWARE;
#endif /* SMTP */
}
+ else if (bitnset(M_LMTP, m->m_flags))
+ {
+ /* not running LMTP */
+ sm_syslog(LOG_ERR, NULL,
+ "Warning: mailer %s: LMTP flag (F=z) turned off",
+ m->m_name);
+ clrbitn(M_LMTP, m->m_flags);
+ }
/*
** At this point *mvp points to the argument with $u. We
@@ -1235,7 +1243,7 @@ deliver(e, firstto)
continue;
}
#if NAMED_BIND
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
#endif /* NAMED_BIND */
ovr = TRUE;
@@ -1498,7 +1506,7 @@ deliver(e, firstto)
}
errno = 0;
#if NAMED_BIND
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
#endif /* NAMED_BIND */
CurHostName = NULL;
@@ -2267,7 +2275,7 @@ reconnect: /* after switching to an authenticated connection */
!DONE_STARTTLS(mci->mci_flags))
{
int olderrors;
- bool hasdot;
+ int dotpos;
bool usetls;
bool saveQuickAbort = QuickAbort;
bool saveSuprErrs = SuprErrs;
@@ -2275,6 +2283,7 @@ reconnect: /* after switching to an authenticated connection */
# if _FFR_TLS_CLT1
char *p;
# endif /* _FFR_TLS_CLT1 */
+ char *srvname;
extern SOCKADDR CurHostAddr;
rcode = EX_OK;
@@ -2296,11 +2305,25 @@ reconnect: /* after switching to an authenticated connection */
}
# endif /* _FFR_TLS_CLT1 */
- hasdot = CurHostName[strlen(CurHostName) - 1] == '.';
- if (hasdot)
- CurHostName[strlen(CurHostName) - 1] = '\0';
+ if (mci->mci_host != NULL)
+ {
+ srvname = mci->mci_host;
+ dotpos = strlen(srvname) - 1;
+ if (dotpos >= 0)
+ {
+ if (srvname[dotpos] == '.')
+ srvname[dotpos] = '\0';
+ else
+ dotpos = -1;
+ }
+ }
+ else
+ {
+ srvname = "";
+ dotpos = -1;
+ }
define(macid("{server_name}", NULL),
- newstr(CurHostName), e);
+ newstr(srvname), e);
if (CurHostAddr.sa.sa_family != 0)
define(macid("{server_addr}", NULL),
newstr(anynet_ntoa(&CurHostAddr)), e);
@@ -2314,7 +2337,7 @@ reconnect: /* after switching to an authenticated connection */
olderrors = Errors;
QuickAbort = FALSE;
SuprErrs = TRUE;
- if (rscheck("try_tls", CurHostName, NULL,
+ if (rscheck("try_tls", srvname, NULL,
e, TRUE, FALSE, 8, host) != EX_OK
|| Errors > olderrors)
usetls = FALSE;
@@ -2323,9 +2346,9 @@ reconnect: /* after switching to an authenticated connection */
# endif /* _FFR_TLS_O_T */
}
- /* undo change of CurHostName */
- if (hasdot)
- CurHostName[strlen(CurHostName)] = '.';
+ /* undo change of srvname */
+ if (dotpos >= 0)
+ srvname[dotpos] = '.';
if (usetls)
{
if ((rcode = starttls(m, mci, e)) == EX_OK)
@@ -2562,7 +2585,7 @@ do_transfer:
rcode = mci->mci_exitstat;
errno = mci->mci_errno;
#if NAMED_BIND
- h_errno = mci->mci_herrno;
+ SM_SET_H_ERRNO(mci->mci_herrno);
#endif /* NAMED_BIND */
if (rcode == EX_OK)
{
@@ -2593,6 +2616,18 @@ do_transfer:
/* get the exit status */
rcode = endmailer(mci, e, pv);
+ if (rcode == EX_TEMPFAIL &&
+ SmtpError[0] == '\0')
+ {
+ /*
+ ** Need an e_message for mailq display.
+ ** We set SmtpError as
+ */
+
+ snprintf(SmtpError, sizeof SmtpError,
+ "%s mailer (%s) exited with EX_TEMPFAIL",
+ m->m_name, m->m_mailer);
+ }
}
else
#if SMTP
@@ -3345,7 +3380,7 @@ giveresponse(status, dsn, m, mci, ctladdr, xstart, e)
}
errno = 0;
#if NAMED_BIND
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
#endif /* NAMED_BIND */
}
/*
@@ -5228,6 +5263,8 @@ endtls(ssl, side)
SSL *ssl;
char *side;
{
+ int ret = EX_OK;
+
if (ssl != NULL)
{
int r;
@@ -5238,7 +5275,7 @@ endtls(ssl, side)
sm_syslog(LOG_WARNING, NOQID,
"SSL_shutdown %s failed: %d",
side, r);
- return EX_SOFTWARE;
+ ret = EX_SOFTWARE;
}
else if (r == 0)
{
@@ -5246,12 +5283,12 @@ endtls(ssl, side)
sm_syslog(LOG_WARNING, NOQID,
"SSL_shutdown %s not done",
side);
- return EX_SOFTWARE;
+ ret = EX_SOFTWARE;
}
SSL_free(ssl);
ssl = NULL;
}
- return EX_OK;
+ return ret;
}
# endif /* STARTTLS */
#endif /* SMTP */
diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c
index 39126dddc4ae..18a092b586ad 100644
--- a/contrib/sendmail/src/domain.c
+++ b/contrib/sendmail/src/domain.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1986, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -15,9 +15,9 @@
#ifndef lint
# if NAMED_BIND
-static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (with name server)";
+static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.8 2001/02/12 21:40:19 gshapiro Exp $ (with name server)";
# else /* NAMED_BIND */
-static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (without name server)";
+static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.8 2001/02/12 21:40:19 gshapiro Exp $ (without name server)";
# endif /* NAMED_BIND */
#endif /* ! lint */
@@ -356,7 +356,7 @@ punt:
if (TryNullMXList)
{
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
errno = 0;
h = sm_gethostbyname(host, AF_INET);
if (h == NULL)
@@ -370,7 +370,7 @@ punt:
return -1;
}
# if NETINET6
- h_errno = 0;
+ SM_SET_H_ERRNO(0);
errno = 0;
h = sm_gethostbyname(host, AF_INET6);
if (h == NULL &&
@@ -752,7 +752,7 @@ cnameloop:
** broken.
*/
- h_errno = TRY_AGAIN;
+ SM_SET_H_ERRNO(TRY_AGAIN);
*statp = EX_TEMPFAIL;
/*
@@ -769,18 +769,22 @@ cnameloop:
*/
#if _FFR_WORKAROUND_BROKEN_NAMESERVERS
- /*
- ** Only return if not TRY_AGAIN as an
- ** attempt with a different qtype may
- ** succeed (res_querydomain() calls
- ** res_query() calls res_send() which
- ** sets errno to ETIMEDOUT if the
- ** nameservers could be contacted but
- ** didn't give an answer).
- */
+ if (WorkAroundBrokenAAAA)
+ {
+ /*
+ ** Only return if not TRY_AGAIN as an
+ ** attempt with a different qtype may
+ ** succeed (res_querydomain() calls
+ ** res_query() calls res_send() which
+ ** sets errno to ETIMEDOUT if the
+ ** nameservers could be contacted but
+ ** didn't give an answer).
+ */
- if (qtype != T_ANY && errno != ETIMEDOUT)
- return FALSE;
+ if (qtype != T_ANY &&
+ errno != ETIMEDOUT)
+ return FALSE;
+ }
#else /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */
if (qtype != T_ANY)
return FALSE;
@@ -931,7 +935,7 @@ cnameloop:
host);
CurEnv->e_message = newstr(ebuf);
}
- h_errno = NO_RECOVERY;
+ SM_SET_H_ERRNO(NO_RECOVERY);
*statp = EX_CONFIG;
return FALSE;
}
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index e57a91da08a9..c19125268fd7 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: headers.c,v 8.203.4.10 2000/10/13 17:54:30 gshapiro Exp $";
+static char id[] = "@(#)$Id: headers.c,v 8.203.4.12 2001/01/22 19:00:22 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -308,7 +308,7 @@ hse:
dp = qval;
l = 0;
dp[l++] = '"';
- for (sp = fvalue; *sp != '\0' && l < MAXNAME - 2; sp++)
+ for (sp = fvalue; *sp != '\0' && l < MAXNAME - 3; sp++)
{
switch(*sp)
{
@@ -337,7 +337,7 @@ hse:
if (LogLevel > 9)
sm_syslog(LOG_WARNING, e->e_id,
"Warning: truncated header '%s' before check with '%s' len=%d max=%d",
- fname, rs, l, MAXNAME);
+ fname, rs, l, MAXNAME - 1);
}
if ((sp = macvalue(macid("{currHeader}", NULL), e)) !=
NULL)
diff --git a/contrib/sendmail/src/macro.c b/contrib/sendmail/src/macro.c
index 1a32182d13f5..70e18e4e0692 100644
--- a/contrib/sendmail/src/macro.c
+++ b/contrib/sendmail/src/macro.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: macro.c,v 8.40.16.7 2000/10/09 15:49:06 gshapiro Exp $";
+static char id[] = "@(#)$Id: macro.c,v 8.40.16.9 2001/02/22 01:16:55 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -295,6 +295,8 @@ macvalue(n, e)
if (p != NULL)
return p;
+ if (e == e->e_parent)
+ break;
e = e->e_parent;
}
return NULL;
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index 5097b581977b..bf976e0f7d52 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -13,7 +13,7 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1988, 1993\n\
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: main.c,v 8.485.4.38 2000/12/19 02:50:33 gshapiro Exp $";
+static char id[] = "@(#)$Id: main.c,v 8.485.4.44 2001/02/08 14:06:55 ca Exp $";
#endif /* ! lint */
#define _DEFINE
@@ -1062,7 +1062,8 @@ main(argc, argv, envp)
/* set up the $=m class now, after .cf has a chance to redefine $m */
expand("\201m", jbuf, sizeof jbuf, CurEnv);
- setclass('m', jbuf);
+ if (jbuf[0] != '\0')
+ setclass('m', jbuf);
/* probe interfaces and locate any additional names */
if (!DontProbeInterfaces)
@@ -1231,8 +1232,10 @@ main(argc, argv, envp)
/* full names can't have newlines */
if (strchr(FullName, '\n') != NULL)
{
- FullName = full = newstr(denlstring(FullName, TRUE, TRUE));
+ full = newstr(denlstring(FullName, TRUE, TRUE));
+ FullName = full;
}
+
/* check for characters that may have to be quoted */
if (!rfc822_string(FullName))
{
@@ -1241,6 +1244,7 @@ main(argc, argv, envp)
** as a comment so crackaddr() doesn't destroy
** the name portion of the address.
*/
+
FullName = addquotes(FullName);
if (full != NULL)
free(full);
@@ -1295,10 +1299,13 @@ main(argc, argv, envp)
/* our name for SMTP codes */
expand("\201j", jbuf, sizeof jbuf, CurEnv);
- MyHostName = jbuf;
- if (strchr(jbuf, '.') == NULL)
+ if (jbuf[0] == '\0')
+ MyHostName = newstr("localhost");
+ else
+ MyHostName = jbuf;
+ if (strchr(MyHostName, '.') == NULL)
message("WARNING: local host name (%s) is not qualified; fix $j in config file",
- jbuf);
+ MyHostName);
/* make certain that this name is part of the $=w class */
setclass('w', MyHostName);
@@ -1855,7 +1862,7 @@ main(argc, argv, envp)
}
else
p = newstr(fv);
- CurEnv->e_auth_param = newstr(xtextify(p, NULL));
+ CurEnv->e_auth_param = newstr(xtextify(p, "="));
}
}
if (macvalue('s', CurEnv) == NULL)
@@ -1866,6 +1873,7 @@ main(argc, argv, envp)
CurEnv->e_to = NULL;
CurEnv->e_flags |= EF_GLOBALERRS;
HoldErrs = FALSE;
+ SuperSafe = FALSE;
usrerr("Recipient names must be specified");
/* collect body for UUCP return */
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index 8fb0cfd435ad..4a10c8189800 100644
--- a/contrib/sendmail/src/map.c
+++ b/contrib/sendmail/src/map.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: map.c,v 8.414.4.34 2000/12/18 18:00:43 ca Exp $";
+static char id[] = "@(#)$Id: map.c,v 8.414.4.39 2001/02/22 18:56:22 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -52,7 +52,7 @@ static bool db_map_open __P((MAP *, int, char *, DBTYPE, DB_INFO *));
static bool db_map_open __P((MAP *, int, char *, DBTYPE, void **));
# endif /* DB_VERSION_MAJOR > 2 */
#endif /* NEWDB */
-static bool extract_canonname __P((char *, char *, char[], int));
+static bool extract_canonname __P((char *, char *, char *, char[], int));
#ifdef LDAPMAP
static void ldapmap_clear __P((LDAPMAP_STRUCT *));
static STAB *ldapmap_findconn __P((LDAPMAP_STRUCT *));
@@ -767,11 +767,10 @@ getcanonname(host, hbsize, trymx)
#if NAMED_BIND
if (got_tempfail)
- h_errno = TRY_AGAIN;
+ SM_SET_H_ERRNO(TRY_AGAIN);
else
- h_errno = HOST_NOT_FOUND;
+ SM_SET_H_ERRNO(HOST_NOT_FOUND);
#endif /* NAMED_BIND */
-
return FALSE;
}
/*
@@ -779,6 +778,7 @@ getcanonname(host, hbsize, trymx)
**
** Parameters:
** name -- the name against which to match.
+** dot -- where to reinsert '.' to get FQDN
** line -- the /etc/hosts line.
** cbuf -- the location to store the result.
** cbuflen -- the size of cbuf.
@@ -789,8 +789,9 @@ getcanonname(host, hbsize, trymx)
*/
static bool
-extract_canonname(name, line, cbuf, cbuflen)
+extract_canonname(name, dot, line, cbuf, cbuflen)
char *name;
+ char *dot;
char *line;
char cbuf[];
int cbuflen;
@@ -819,6 +820,14 @@ extract_canonname(name, line, cbuf, cbuflen)
}
if (strcasecmp(name, p) == 0)
found = TRUE;
+ else if (dot != NULL)
+ {
+ /* try looking for the FQDN as well */
+ *dot = '.';
+ if (strcasecmp(name, p) == 0)
+ found = TRUE;
+ *dot = '\0';
+ }
}
if (found && strchr(cbuf, '.') == NULL)
{
@@ -1623,6 +1632,10 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo)
ret = db->open(db, buf, NULL, dbtype, flags, DBMMODE);
if (ret != 0)
{
+#ifdef DB_OLD_VERSION
+ if (ret == DB_OLD_VERSION)
+ ret = EINVAL;
+#endif /* DB_OLD_VERSION */
(void) db->close(db, 0);
db = NULL;
}
@@ -2258,7 +2271,7 @@ nis_getcanonname(name, hbsize, statp)
*statp = EX_UNAVAILABLE;
return FALSE;
}
- shorten_hostname(nbuf);
+ (void) shorten_hostname(nbuf);
keylen = strlen(nbuf);
if (yp_domain == NULL)
@@ -2302,13 +2315,13 @@ nis_getcanonname(name, hbsize, statp)
free(vp);
if (tTd(38, 44))
dprintf("got record `%s'\n", host_record);
- if (!extract_canonname(nbuf, host_record, cbuf, sizeof cbuf))
+ if (!extract_canonname(nbuf, NULL, host_record, cbuf, sizeof cbuf))
{
/* this should not happen, but.... */
*statp = EX_NOHOST;
return FALSE;
}
- if (hbsize < strlen(cbuf))
+ if (hbsize <= strlen(cbuf))
{
*statp = EX_UNAVAILABLE;
return FALSE;
@@ -2639,7 +2652,7 @@ nisplus_getcanonname(name, hbsize, statp)
return FALSE;
}
(void) strlcpy(nbuf, name, sizeof nbuf);
- shorten_hostname(nbuf);
+ (void) shorten_hostname(nbuf);
p = strchr(nbuf, '.');
if (p == NULL)
@@ -3937,7 +3950,7 @@ ldapmap_parseargs(map, args)
if ((ptr = strchr(p, ' ')) != NULL)
*ptr = '\0';
- syserr("Deref must be [never|always|search|find] not %s in map %s",
+ syserr("Deref must be [never|always|search|find] (not %s) in map %s",
p, map->map_mname);
if (ptr != NULL)
*ptr = ' ';
@@ -3972,7 +3985,7 @@ ldapmap_parseargs(map, args)
if ((ptr = strchr(p, ' ')) != NULL)
*ptr = '\0';
- syserr("Scope must be [base|one|sub] not %s in map %s",
+ syserr("Scope must be [base|one|sub] (not %s) in map %s",
p, map->map_mname);
if (ptr != NULL)
*ptr = ' ';
@@ -4044,7 +4057,7 @@ ldapmap_parseargs(map, args)
if ((ptr = strchr(p, ' ')) != NULL)
*ptr = '\0';
- syserr("Method for binding must be [none|simple|krbv4] not %s in map %s",
+ syserr("Method for binding must be [none|simple|krbv4] (not %s) in map %s",
p, map->map_mname);
if (ptr != NULL)
*ptr = ' ';
@@ -4312,6 +4325,7 @@ void
ldapmap_set_defaults(spec)
char *spec;
{
+ STAB *class;
MAP map;
/* Allocate and set the default values */
@@ -4320,7 +4334,17 @@ ldapmap_set_defaults(spec)
ldapmap_clear(LDAPDefaults);
memset(&map, '\0', sizeof map);
+
+ /* look up the class */
+ class = stab("ldap", ST_MAPCLASS, ST_FIND);
+ if (class == NULL)
+ {
+ syserr("readcf: LDAPDefaultSpec: class ldap not available");
+ return;
+ }
+ map.map_class = &class->s_mapclass;
map.map_db1 = (ARBPTR_T) LDAPDefaults;
+ map.map_mname = "O LDAPDefaultSpec";
(void) ldapmap_parseargs(&map, spec);
@@ -5412,7 +5436,7 @@ ni_getcanonname(name, hbsize, statp)
*statp = EX_UNAVAILABLE;
return FALSE;
}
- shorten_hostname(nbuf);
+ (void) shorten_hostname(nbuf);
/* we only accept single token search key */
if (strchr(nbuf, '.'))
@@ -5832,6 +5856,7 @@ text_getcanonname(name, hbsize, statp)
int *statp;
{
bool found;
+ char *dot;
FILE *f;
char linebuf[MAXLINE];
char cbuf[MAXNAME + 1];
@@ -5846,7 +5871,7 @@ text_getcanonname(name, hbsize, statp)
return FALSE;
}
(void) strlcpy(nbuf, name, sizeof nbuf);
- shorten_hostname(nbuf);
+ dot = shorten_hostname(nbuf);
f = fopen(HostsFile, "r");
if (f == NULL)
@@ -5862,7 +5887,8 @@ text_getcanonname(name, hbsize, statp)
if (p != NULL)
*p = '\0';
if (linebuf[0] != '\0')
- found = extract_canonname(nbuf, linebuf, cbuf, sizeof cbuf);
+ found = extract_canonname(nbuf, dot, linebuf,
+ cbuf, sizeof cbuf);
}
(void) fclose(f);
if (!found)
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index a248090b4c34..0698573209b1 100644
--- a/contrib/sendmail/src/milter.c
+++ b/contrib/sendmail/src/milter.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: milter.c,v 8.50.4.41 2000/12/27 21:35:32 gshapiro Exp $";
+static char id[] = "@(#)$Id: milter.c,v 8.50.4.44 2001/01/23 19:43:57 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -261,7 +261,7 @@ milter_sysread(m, buf, sz, to, e)
}
curl += len;
- if (len == 0 || len >= sz)
+ if (len == 0 || curl >= sz)
break;
}
@@ -1810,7 +1810,11 @@ milter_send_command(m, command, data, sz, e, state)
case SMFIR_ACCEPT:
/* this filter is done with message/connection */
- m->mf_state = SMFS_DONE;
+ if (command == SMFIC_HELO ||
+ command == SMFIC_CONNECT)
+ m->mf_state = SMFS_CLOSABLE;
+ else
+ m->mf_state = SMFS_DONE;
break;
case SMFIR_CONTINUE:
@@ -2092,7 +2096,7 @@ milter_per_connection_check(e)
{
struct milter *m = InputFilters[i];
- if (m->mf_state == SMFS_DONE)
+ if (m->mf_state == SMFS_CLOSABLE)
milter_quit_filter(m, e);
}
}
@@ -2936,11 +2940,31 @@ milter_helo(helo, e, state)
ENVELOPE *e;
char *state;
{
+ int i;
char *response;
if (tTd(64, 10))
dprintf("milter_helo(%s)\n", helo);
+ /* HELO/EHLO can come after encryption is negotiated */
+ for (i = 0; InputFilters[i] != NULL; i++)
+ {
+ struct milter *m = InputFilters[i];
+
+ switch (m->mf_state)
+ {
+ case SMFS_INMSG:
+ /* abort in message filters */
+ milter_abort_filter(m, e);
+ /* FALLTHROUGH */
+
+ case SMFS_DONE:
+ /* reset done filters */
+ m->mf_state = SMFS_OPEN;
+ break;
+ }
+ }
+
response = milter_command(SMFIC_HELO, helo, strlen(helo) + 1,
MilterHeloMacros, e, state);
milter_per_connection_check(e);
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index fd4f34b7611f..0a2d8ad8dac2 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.9 2000/10/09 03:14:48 gshapiro Exp $";
+static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.11 2001/02/14 04:07:27 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -2727,7 +2727,11 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host)
MapOpenErr = FALSE;
(void) rewrite(pvp, rsno, 0, e);
if (MapOpenErr)
- usrerrenh("4.3.0", "451 Temporary failure");
+ {
+ usrerrenh("4.3.0", "451 Temporary failure");
+ rstat = EX_TEMPFAIL;
+ goto finis;
+ }
if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET ||
pvp[1] == NULL || (strcmp(pvp[1], "error") != 0 &&
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index 590aed9d0240..f94498ec23e7 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -16,9 +16,9 @@
#ifndef lint
# if QUEUE
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.38 2000/12/08 14:33:02 ca Exp $ (with queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.44 2001/02/22 00:55:35 ca Exp $ (with queueing)";
# else /* QUEUE */
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.38 2000/12/08 14:33:02 ca Exp $ (without queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.44 2001/02/22 00:55:35 ca Exp $ (without queueing)";
# endif /* QUEUE */
#endif /* ! lint */
@@ -835,6 +835,7 @@ run_single_queue(queuedir, forkflag, verbose)
CurEnv = &QueueEnvelope;
e = newenvelope(&QueueEnvelope, CurEnv);
e->e_flags = BlankEnvelope.e_flags;
+ e->e_parent = NULL;
/* make sure we have disconnected from parent */
if (forkflag)
@@ -1558,7 +1559,7 @@ workcmpf1(a, b)
return b->w_lock - a->w_lock;
/* job priority */
- return a->w_pri - b->w_pri;
+ return workcmpf0(a, b);
}
/*
** WORKCMPF2 -- second compare function for ordering work based on host name.
@@ -1599,7 +1600,7 @@ workcmpf2(a, b)
return i;
/* job priority */
- return a->w_pri - b->w_pri;
+ return workcmpf0(a, b);
}
/*
** WORKCMPF3 -- simple submission-time-only compare function.
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index 942ca5b11c68..fa994232b062 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: readcf.c,v 8.382.4.31 2000/12/18 18:00:43 ca Exp $";
+static char id[] = "@(#)$Id: readcf.c,v 8.382.4.38 2001/02/17 00:05:12 geir Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -844,6 +844,8 @@ fileclass(class, filename, fmt, safe, optional)
** T -- the mailer type (for DSNs)
** U -- the uid to run as
** W -- the time to wait at the end
+** m -- maximum messages per connection
+** / -- new root directory
** The first word is the canonical name of the mailer.
**
** Returns:
@@ -2059,7 +2061,9 @@ setoption(opt, val, safe, sticky, e)
if (val[0] == '\0')
HelpFile = "helpfile";
else
+ {
HelpFile = newstr(val);
+ }
break;
case 'h': /* maximum hop count */
@@ -2094,6 +2098,13 @@ setoption(opt, val, safe, sticky, e)
HasWildcardMX = !clearmode;
continue;
}
+#if _FFR_WORKAROUND_BROKEN_NAMESERVERS
+ if (sm_strcasecmp(q, "WorkAroundBrokenAAAA") == 0)
+ {
+ WorkAroundBrokenAAAA = !clearmode;
+ continue;
+ }
+#endif /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */
for (rfp = ResolverFlags; rfp->rf_name != NULL; rfp++)
{
if (strcasecmp(q, rfp->rf_name) == 0)
@@ -2248,7 +2259,9 @@ setoption(opt, val, safe, sticky, e)
if (val[0] == '\0')
StatFile = "statistics";
else
+ {
StatFile = newstr(val);
+ }
break;
case 's': /* be super safe, even if expensive */
@@ -2549,7 +2562,9 @@ setoption(opt, val, safe, sticky, e)
case O_HSDIR: /* persistent host status directory */
if (val[0] != '\0')
+ {
HostStatDir = newstr(val);
+ }
break;
case O_SINGTHREAD: /* single thread deliveries (requires hsdir) */
diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c
index d144792f789d..258e7e23ab8e 100644
--- a/contrib/sendmail/src/recipient.c
+++ b/contrib/sendmail/src/recipient.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: recipient.c,v 8.231.14.8 2000/09/14 23:32:27 gshapiro Exp $";
+static char id[] = "@(#)$Id: recipient.c,v 8.231.14.10 2001/02/14 04:07:30 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index 8e5c9d517817..101dc71db15b 100644
--- a/contrib/sendmail/src/savemail.c
+++ b/contrib/sendmail/src/savemail.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: savemail.c,v 8.212.4.11 2000/12/18 18:00:44 ca Exp $";
+static char id[] = "@(#)$Id: savemail.c,v 8.212.4.12 2001/01/07 19:31:05 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -1015,7 +1015,8 @@ errbody(mci, e, separator)
}
/* Reporting-MTA: is us (required) */
- (void) snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s", MyHostName);
+ (void) snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s",
+ MyHostName);
putline(buf, mci);
/* DSN-Gateway: not relevant since we are not translating */
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 9a6698a9c07a..ffb0b33f56b9 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -20,7 +20,7 @@
#ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.45 2000/12/28 23:46:44 gshapiro Exp $";
+static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.50 2001/02/22 18:56:24 gshapiro Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
@@ -152,6 +152,9 @@ static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.45 2000/12/28 23:46:44 gs
#ifndef INT32SZ
# define INT32SZ 4 /* size of a 32 bit integer in bytes */
#endif /* ! INT32SZ */
+#ifndef INADDR_LOOPBACK
+# define INADDR_LOOPBACK 0x7f000001 /* loopback address */
+#endif /* ! INADDR_LOOPBACK */
/*
** Error return from inet_addr(3), in case not defined in /usr/include.
@@ -1377,6 +1380,7 @@ struct milter
# define SMFS_OPEN 'O' /* connected to remote milter filter */
# define SMFS_INMSG 'M' /* currently servicing a message */
# define SMFS_DONE 'D' /* done with current message */
+# define SMFS_CLOSABLE 'Q' /* done with current connection */
# define SMFS_ERROR 'E' /* error state */
# define SMFS_READY 'R' /* ready for action */
@@ -1692,6 +1696,9 @@ EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */
EXTERN bool SuperSafe; /* be extra careful, even if expensive */
EXTERN bool SuprErrs; /* set if we are suppressing errors */
EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */
+#if _FFR_WORKAROUND_BROKEN_NAMESERVERS
+EXTERN bool WorkAroundBrokenAAAA; /* some nameservers return SERVFAIL on AAAA queries */
+#endif /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */
EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */
EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */
EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */
@@ -2063,7 +2070,7 @@ extern void setuserenv __P((const char *, const char *));
extern void settime __P((ENVELOPE *));
extern char *sfgets __P((char *, int, FILE *, time_t, char *));
extern char *shortenstring __P((const char *, int));
-extern void shorten_hostname __P((char []));
+extern char *shorten_hostname __P((char []));
extern bool shorten_rfc822_string __P((char *, size_t));
extern SIGFUNC_DECL sigusr1 __P((int));
extern SIGFUNC_DECL sighup __P((int));
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 78443a8d0e5b..72d22c05f721 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -16,9 +16,9 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.66 2000/12/18 18:00:44 ca Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.67 2001/01/07 19:31:05 gshapiro Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.66 2000/12/18 18:00:44 ca Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.67 2001/01/07 19:31:05 gshapiro Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -1159,7 +1159,7 @@ smtp(nullserver, d_flags, e)
if (gothello)
{
usrerr("503 %s Duplicate HELO/EHLO",
- MyHostName);
+ MyHostName);
break;
}
diff --git a/contrib/sendmail/src/stats.c b/contrib/sendmail/src/stats.c
index 880f3d90dac4..e03de5f1354f 100644
--- a/contrib/sendmail/src/stats.c
+++ b/contrib/sendmail/src/stats.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: stats.c,v 8.36.14.3 2000/09/17 17:04:27 gshapiro Exp $";
+static char id[] = "@(#)$Id: stats.c,v 8.36.14.5 2001/02/14 04:07:30 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/udb.c b/contrib/sendmail/src/udb.c
index 91d03f193e17..9b8ccd0a3d0b 100644
--- a/contrib/sendmail/src/udb.c
+++ b/contrib/sendmail/src/udb.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-1999, 2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -15,9 +15,9 @@
#ifndef lint
# if USERDB
-static char id[] = "@(#)$Id: udb.c,v 8.111 1999/11/16 02:04:04 gshapiro Exp $ (with USERDB)";
+static char id[] = "@(#)$Id: udb.c,v 8.111.16.1 2001/01/04 18:18:37 gshapiro Exp $ (with USERDB)";
# else /* USERDB */
-static char id[] = "@(#)$Id: udb.c,v 8.111 1999/11/16 02:04:04 gshapiro Exp $ (without USERDB)";
+static char id[] = "@(#)$Id: udb.c,v 8.111.16.1 2001/01/04 18:18:37 gshapiro Exp $ (without USERDB)";
# endif /* USERDB */
#endif /* ! lint */
@@ -1011,6 +1011,10 @@ _udbx_init(e)
0644);
if (ret != 0)
{
+#ifdef DB_OLD_VERSION
+ if (ret == DB_OLD_VERSION)
+ ret = EINVAL;
+#endif /* DB_OLD_VERSION */
(void) up->udb_dbp->close(up->udb_dbp, 0);
up->udb_dbp = NULL;
}
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index bfce56a0beac..83034dcf5ade 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -15,9 +15,9 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.18 2000/12/20 16:36:11 ca Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.24 2001/02/21 00:59:09 gshapiro Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.18 2000/12/20 16:36:11 ca Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.24 2001/02/21 00:59:09 gshapiro Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -844,6 +844,7 @@ safesaslfile(context, file)
if (file == NULL || *file == '\0')
return SASL_OK;
+
sff = SFF_SAFEDIRPATH|SFF_NOWLINK|SFF_NOGWFILES|SFF_NOWWFILES|SFF_ROOTOK;
if ((p = strrchr(file, '/')) == NULL)
p = file;
@@ -873,12 +874,13 @@ safesaslfile(context, file)
}
# endif /* SASL <= 10515 */
- if ((r = safefile(file, RunAsUid, RunAsGid, RunAsUserName, sff,
+ p = file;
+ if ((r = safefile(p, RunAsUid, RunAsGid, RunAsUserName, sff,
S_IRUSR, NULL)) == 0)
return SASL_OK;
if (LogLevel >= 11 || (r != ENOENT && LogLevel >= 9))
sm_syslog(LOG_WARNING, NOQID, "error: safesasl(%s) failed: %s",
- file, errstring(r));
+ p, errstring(r));
return SASL_CONTINUE;
}
@@ -1528,7 +1530,7 @@ smtpmailfrom(m, mci, e)
else
{
smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName,
- *bufp == '@' ? ',' : ':', bufp, optbuf);
+ *bufp == '@' ? ',' : ':', bufp, optbuf);
}
SmtpPhase = mci->mci_phase = "client MAIL";
sm_setproctitle(TRUE, e, "%s %s: %s", qid_printname(e),
@@ -1943,6 +1945,8 @@ smtpdata(m, mci, e)
else
r = 4;
e->e_statmsg = newstr(&SmtpReplyBuffer[r]);
+ SmtpPhase = mci->mci_phase = "idle";
+ sm_setproctitle(TRUE, e, "%s: %s", CurHostName, mci->mci_phase);
if (rstat != EX_PROTOCOL)
return rstat;
if (LogLevel > 1)
@@ -2116,6 +2120,17 @@ smtpquit(m, mci, e)
}
/*
** SMTPRSET -- send a RSET (reset) command
+**
+** Parameters:
+** m -- a pointer to the mailer.
+** mci -- the mailer connection information.
+** e -- the current envelope.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** closes the connection if there is no reply to RSET.
*/
void
@@ -2154,6 +2169,15 @@ smtprset(m, mci, e)
}
/*
** SMTPPROBE -- check the connection state
+**
+** Parameters:
+** mci -- the mailer connection information.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** closes the connection if there is no reply to RSET.
*/
int
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index e71627f5972d..6b301cb9a40a 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.15 2000/10/18 23:46:07 ca Exp $";
+static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.19 2001/02/22 18:56:24 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -497,7 +497,8 @@ log_sendmail_pid(e)
pidf = safefopen(pidpath, O_WRONLY|O_TRUNC, 0644, sff);
if (pidf == NULL)
{
- sm_syslog(LOG_ERR, NOQID, "unable to write %s", pidpath);
+ sm_syslog(LOG_ERR, NOQID, "unable to write %s: %s",
+ pidpath, errstring(errno));
}
else
{
@@ -1785,10 +1786,10 @@ printit:
** host -- the host to shorten (stripped in place).
**
** Returns:
-** none.
+** place where string was trunacted, NULL if not truncated.
*/
-void
+char *
shorten_hostname(host)
char host[];
{
@@ -1808,7 +1809,7 @@ shorten_hostname(host)
/* see if there is any domain at all -- if not, we are done */
p = strchr(host, '.');
if (p == NULL)
- return;
+ return NULL;
/* yes, we have a domain -- see if it looks like us */
mydom = macvalue('m', CurEnv);
@@ -1817,7 +1818,11 @@ shorten_hostname(host)
i = strlen(++p);
if ((canon ? strcasecmp(p, mydom) : strncasecmp(p, mydom, i)) == 0 &&
(mydom[i] == '.' || mydom[i] == '\0'))
+ {
*--p = '\0';
+ return p;
+ }
+ return NULL;
}
/*
** PROG_OPEN -- open a program for reading
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 2499b106f8bb..60a42c673d0d 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: version.c,v 8.43.4.25 2000/12/29 18:22:18 gshapiro Exp $";
+static char id[] = "@(#)$Id: version.c,v 8.43.4.30 2001/02/27 19:22:31 gshapiro Exp $";
#endif /* ! lint */
-char Version[] = "8.11.2";
+char Version[] = "8.11.3";
diff --git a/contrib/sendmail/vacation/vacation.c b/contrib/sendmail/vacation/vacation.c
index 8b85c381750d..b58b87ea8a36 100644
--- a/contrib/sendmail/vacation/vacation.c
+++ b/contrib/sendmail/vacation/vacation.c
@@ -13,7 +13,7 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1983, 1987, 1993\n\
The Regents of the University of California. All rights reserved.\n\
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: vacation.c,v 8.68.4.15 2000/11/27 22:17:27 ca Exp $";
+static char id[] = "@(#)$Id: vacation.c,v 8.68.4.16 2001/02/14 05:02:21 gshapiro Exp $";
#endif /* ! lint */
#include <ctype.h>