summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorgene <gene@cvs.openbsd.org>1997-11-09 04:05:49 +0000
committergene <gene@cvs.openbsd.org>1997-11-09 04:05:49 +0000
commit5ffedb7ce00b68fe114660b0a38b949225691abf (patch)
treeaef5ccb69f26f8e35e8f93872633a50780c69faf /usr.sbin
parent9c3ade9a06cde621c1cd6f71484c00f8c6a93e56 (diff)
Upgrade to sendmail 8.8.8
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sendmail/RELEASE_NOTES141
-rw-r--r--usr.sbin/sendmail/cf/README10
-rw-r--r--usr.sbin/sendmail/cf/cf/knecht.mc5
-rw-r--r--usr.sbin/sendmail/cf/m4/version.m44
-rw-r--r--usr.sbin/sendmail/cf/ostype/sinix.m415
-rw-r--r--usr.sbin/sendmail/contrib/expn.pl46
-rw-r--r--usr.sbin/sendmail/doc/op/op.me8
-rw-r--r--usr.sbin/sendmail/makemap/makemap.c17
-rw-r--r--usr.sbin/sendmail/smrsh/smrsh.c3
-rw-r--r--usr.sbin/sendmail/src/READ_ME49
-rw-r--r--usr.sbin/sendmail/src/collect.c4
-rw-r--r--usr.sbin/sendmail/src/conf.c26
-rw-r--r--usr.sbin/sendmail/src/conf.h21
-rw-r--r--usr.sbin/sendmail/src/daemon.c39
-rw-r--r--usr.sbin/sendmail/src/deliver.c89
-rw-r--r--usr.sbin/sendmail/src/err.c6
-rw-r--r--usr.sbin/sendmail/src/headers.c20
-rw-r--r--usr.sbin/sendmail/src/main.c50
-rw-r--r--usr.sbin/sendmail/src/map.c156
-rw-r--r--usr.sbin/sendmail/src/parseaddr.c15
-rw-r--r--usr.sbin/sendmail/src/queue.c13
-rw-r--r--usr.sbin/sendmail/src/readcf.c12
-rw-r--r--usr.sbin/sendmail/src/recipient.c9
-rw-r--r--usr.sbin/sendmail/src/savemail.c64
-rw-r--r--usr.sbin/sendmail/src/sendmail.h7
-rw-r--r--usr.sbin/sendmail/src/srvrsmtp.c30
-rw-r--r--usr.sbin/sendmail/src/usersmtp.c5
-rw-r--r--usr.sbin/sendmail/src/util.c10
-rw-r--r--usr.sbin/sendmail/src/version.c4
-rw-r--r--usr.sbin/sendmail/test/t_exclopen.c2
30 files changed, 585 insertions, 295 deletions
diff --git a/usr.sbin/sendmail/RELEASE_NOTES b/usr.sbin/sendmail/RELEASE_NOTES
index 9f4f3abd54f..b3e1a8b33d3 100644
--- a/usr.sbin/sendmail/RELEASE_NOTES
+++ b/usr.sbin/sendmail/RELEASE_NOTES
@@ -1,11 +1,150 @@
SENDMAIL RELEASE NOTES
- @(#)RELEASE_NOTES 8.8.7.7 (Berkeley) 8/3/97
+ @(#)RELEASE_NOTES 8.8.8.4 (Berkeley) 10/24/97
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.8.8/8.8.8 97/10/24
+ If the check_relay ruleset failed, the relay= field was logged
+ incorrectly. Problem noted by Kari Hurtta of the Finnish
+ Meteorological Institute.
+ If /usr/tmp/dead.letter already existed, sendmail could not
+ add additional bounces to it. Problem noted by Thomas J.
+ Arseneault of SRI International.
+ If an SMTP mailer used a non-standard port number for the outgoing
+ connection, it would be displayed incorrectly in verbose mode.
+ Problem noted by John Kennedy of Cal State University, Chico.
+ Log the ETRN parameter specified by the client before altering them
+ to internal form. Suggested by Bob Kupiec of GES-Verio.
+ EXPN and VRFY SMTP commands on malformed addresses were logging as
+ User unknown with bogus delay= values. Change them to log
+ the same as compliant addresses. Problem noted by Kari E.
+ Hurtta of the Finnish Meteorological Institute.
+ Ignore the debug resolver option unless using sendmail debug trace
+ option for resolver. Problem noted by Greg Nichols of Wind
+ River Systems.
+ If SingleThreadDelivery was enabled and the remote server returned a
+ protocol error on the DATA command, the connection would be
+ closed but the persistent host status file would not be
+ unlocked so other sendmail processes could not deliver to
+ that host. Problem noted by Peter Wemm of DIALix.
+ If queueing up a message due to an expensive mailer, don't increment
+ the number of delivery attempts or set the last delivery
+ attempt time so the message will be delivered on the next
+ queue run regardless of MinQueueAge. Problem noted by
+ Brian J. Coan of the Institute for Global Communications.
+ Authentication warnings of "Processed from queue _directory_" and
+ "Processed by _username_ with -C _filename_" would be logged
+ with the incorrect timestamp. Problem noted by Kari E. Hurtta
+ of the Finnish Meteorological Institute.
+ Use a better heuristic for detecting GDBM.
+ Log null connections on dropped connections. Problem noted by
+ Jon Lewis of Florida Digital Turnpike.
+ If class dbm maps are rebuilt, sendmail will now detect this and
+ reopen the map. Previously, they could give stale
+ results during a single message processing (but would
+ recover when the next message was received). Fix from
+ Joe Pruett of Q7 Enterprises.
+ Do not log failures such as "User unknown" on -bv or SMTP VRFY
+ requests. Problem noted by Kari E. Hurtta of the
+ Finnish Meteorological Institute.
+ Do not send a bounce message back to the sender regarding bad
+ recipients if the SMTP connection is dropped before the
+ message is accepted. Problem noted by Kari E. Hurtta of the
+ Finnish Meteorological Institute.
+ Use "localhost" instead of "[UNIX: localhost]" when connecting to
+ sendmail via a UNIX pipe. This will allow rulesets using
+ $&{client_name} to process without sending the string through
+ dequote. Problem noted by Alan Barrett of Internet Africa.
+ A combination of deferred delivery mode, a double bounce situation,
+ and the inability to save a bounce message to
+ /var/tmp/dead.letter would cause sendmail to send a bounce
+ to postmaster but not remove the offending envelope from the
+ queue causing it to create a new bounce message each time the
+ queue was run. Problem noted by Brad Doctor of Net Daemons
+ Associates.
+ Remove newlines from hostname information returned via DNS. There are
+ no known security implications of newlines in hostnames as
+ sendmail filters newlines in all vital areas; however, this
+ could cause confusing error messages.
+ Starting with sendmail 8.8.6, mail sent with the '-t' option would be
+ rejected if any of the specified addresses were bad. This
+ behavior was modified to only reject the bad addresses and not
+ the entire message. Problem noted by Jozsef Hollosi of
+ SuperNet, Inc.
+ Use Timeout.fileopen when delivering mail to a file. Suggested by
+ Bryan Costales of InfoBeat, Inc.
+ Display the proper Final-Recipient on DSN messages for non-SMTP
+ mailers. Problem noted by Kari E. Hurtta of the
+ Finnish Meteorological Institute.
+ An error in calculating the available space in the list of addresses
+ for logging deliveries could cause an address to be silently
+ dropped.
+ Include the initial user environment if sendmail is restarted via
+ a HUP signal. This will give room for the process title.
+ Problem noted by Jon Lewis of Florida Digital Turnpike.
+ Mail could be delivered without a body if the machine does not
+ support flock locking and runs out of processes during
+ delivery. Fix from Chuck Lever of the University of Michigan.
+ Drop recipient address from 251 and 551 SMTP responses per RFC 821.
+ Problem noted by Kari E. Hurtta of the Finnish Meteorological
+ Institute.
+ Make sure non-rebuildable database maps are opened before the
+ rebuildable maps (i.e. alias files) in case the database maps
+ are needed for verifying the left hand side of the aliases.
+ Problem noted by Lloyd Parkes of Victoria University.
+ Make sure sender RFC822 source route addresses are alias expanded for
+ bounce messages. Problem noted by Juergen Georgi of
+ RUS University of Stuttgart.
+ Minor lint fixes.
+ Return a temporary error instead of a permanent error if an LDAP map
+ search returns an error. This will allow sequenced maps which
+ use other LDAP servers to be checked. Fix from Booker Bense
+ of Stanford University.
+ When automatically converting from quoted printable to 8bit text do
+ not pad bare linefeeds with a space. Problem noted by Theo
+ Nolte of the University of Technology Aachen, Germany.
+ Portability:
+ Non-standard C compilers may have had a problem compiling
+ conf.c due to a standard C external declaration of
+ setproctitle(). Problem noted by Ted Roberts of
+ Electronic Data Systems.
+ AUX: has a broken O_EXCL implementation. Reported by Jim
+ Jagielski of jaguNET Access Services.
+ BSD/OS: didn't compile if HASSETUSERCONTEXT was defined.
+ Digital UNIX: Digital UNIX (and possibly others) moves
+ loader environment variables into the loader memory
+ area. If one of these environment variables (such as
+ LD_LIBRARY_PATH) was the last environment variable,
+ an invalid memory address would be used by the process
+ title routine causing memory corruption. Problem
+ noted by Sam Hartman of Mesa Internet Systems.
+ GNU libc: uses an enum for _PC_CHOWN_RESTRICTED which caused
+ chownsafe() to always return 0 even if the OS does
+ not permit file giveaways. Problem noted by
+ Yasutaka Sumi of The University of Tokyo.
+ IRIX6: Syslog buffer size set to 512 bytes. Reported by
+ Gerald Rinske of Siemens Business Services VAS.
+ Linux: Pad process title with NULLs. Problem noted by
+ Jon Lewis of Florida Digital Turnpike.
+ SCO OpenServer 5.0: SIOCGIFCONF ioctl call returns an
+ incorrect value for the number of interfaces.
+ Problem noted by Chris Loelke of JetStream Internet
+ Services.
+ SINIX: Update for Makefile and syslog buffer size from Gerald
+ Rinske of Siemens Business Services VAS.
+ Solaris: Make sure HASGETUSERSHELL setting for SunOS is not
+ used on a Solaris machine. Problem noted by
+ Stephen Ma of Jtec Pty Limited.
+ CONFIG: SINIX: Update from Gerald Rinske of Siemens Business
+ Services VAS.
+ MAKEMAP: Use a better heuristic for detecting GDBM.
+ CONTRIB: expn.pl: Updated version from the author, David Muir Sharnoff.
+ OP.ME: Document the F=i mailer flag. Problem noted by Per Hedeland of
+ Ericsson.
+
8.8.7/8.8.7 97/08/03
If using Berkeley DB on systems without O_EXLOCK (open a file with
an exclusive lock already set -- i.e., almost all systems
diff --git a/usr.sbin/sendmail/cf/README b/usr.sbin/sendmail/cf/README
index af8cdb1c7bb..184a3532559 100644
--- a/usr.sbin/sendmail/cf/README
+++ b/usr.sbin/sendmail/cf/README
@@ -4,7 +4,7 @@
Eric Allman <eric@CS.Berkeley.EDU>
- @(#)README 8.122 (Berkeley) 7/6/97
+ @(#)README 8.124 (Berkeley) 9/23/97
This document describes the sendmail configuration files being used
@@ -657,7 +657,7 @@ genericstable This feature will cause certain addresses originating in the
The key for this table is either the full address or the
unqualified username (the former is tried first); the
value is the new user address. If the new user address does
- not include a domain, $j is used. Note that the address must
+ not include a domain, $j is used. Note that the address
being looked up must be fully qualified. For local mail, it
is necessary to use FEATURE(always_add_domain) for the
addresses to be qualified.
@@ -1335,10 +1335,10 @@ confCF_VERSION $Z macro If defined, this is appended to the
confFROM_HEADER From: [$?x$x <$g>$|$g$.] The format of an
internally generated From: address.
confRECEIVED_HEADER Received:
- [$?sfrom $s .$?_($?s$|from $.$_)
+ [$?sfrom $s $.$?_($?s$|from $.$_)
$.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u$.;
- $b]
+ for $u; $|;
+ $.$b]
The format of the Received: header
in messages passed through this host.
It is unwise to try to change this.
diff --git a/usr.sbin/sendmail/cf/cf/knecht.mc b/usr.sbin/sendmail/cf/cf/knecht.mc
index 111ac782884..71ae12b69bd 100644
--- a/usr.sbin/sendmail/cf/cf/knecht.mc
+++ b/usr.sbin/sendmail/cf/cf/knecht.mc
@@ -38,7 +38,7 @@ divert(-1)
#
divert(0)dnl
-VERSIONID(`@(#)knecht.mc 8.13 (Berkeley) 7/7/97')
+VERSIONID(`@(#)knecht.mc 8.15 (Berkeley) 10/20/97')
OSTYPE(bsd4.4)dnl
DOMAIN(generic)dnl
define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward+$h:$z/.forward')dnl
@@ -48,6 +48,7 @@ define(`confTO_ICONNECT', `10s')dnl
define(`confCOPY_ERRORS_TO', `Postmaster')dnl
define(`confTO_QUEUEWARN', `8h')dnl
define(`confPRIVACY_FLAGS', ``authwarnings,noexpn,novrfy'')dnl
+define(`LOCAL_MAILER_FLAGS', `rmn9P')dnl
FEATURE(virtusertable)dnl
MAILER(local)dnl
MAILER(smtp)dnl
@@ -119,7 +120,7 @@ R<FAIL> $* $#error $: 451 Sender domain must resolve
# handle case of no @domain on address
R<?> $* $: < ? $&{client_name} > $1
R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $: 551 Domain name required
+R<? $+> $* $#error $: 550 Domain name required
...remote is not
R<$+> $* $#error $: $1 error from domaincheck
diff --git a/usr.sbin/sendmail/cf/m4/version.m4 b/usr.sbin/sendmail/cf/m4/version.m4
index 0e03173f700..a2cbdc9144d 100644
--- a/usr.sbin/sendmail/cf/m4/version.m4
+++ b/usr.sbin/sendmail/cf/m4/version.m4
@@ -32,8 +32,8 @@ divert(-1)
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-VERSIONID(`@(#)version.m4 8.8.7.1 (Berkeley) 8/1/97')
+VERSIONID(`@(#)version.m4 8.8.8.1 (Berkeley) 10/24/97')
#
divert(0)
# Configuration version number
-DZ8.8.7`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.8.8`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/usr.sbin/sendmail/cf/ostype/sinix.m4 b/usr.sbin/sendmail/cf/ostype/sinix.m4
index 7b50e9e2cc3..278d4c84cec 100644
--- a/usr.sbin/sendmail/cf/ostype/sinix.m4
+++ b/usr.sbin/sendmail/cf/ostype/sinix.m4
@@ -34,12 +34,9 @@ divert(-1)
#
divert(0)
-VERSIONID(`@(#)sinix.m4 8.1 (Berkeley) 12/14/96')
-define(`QUEUE_DIR', /usr/ucblib/mqueue)dnl
-define(`ALIAS_FILE', /usr/ucblib/aliases)dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', /usr/ucblib/sendmail.hf)')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', /usr/ucblib/sendmail.st)')dnl
-define(`LOCAL_MAILER_PATH', `/usr/ucblib/mail.local')dnl
-define(`LOCAL_MAILER_FLAGS', `rmn9')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
+VERSIONID(`@(#)sinix.m4 8.2 (Berkeley) 9/13/97')
+ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl
+define(`ALIAS_FILE', /etc/aliases)dnl
+define(`LOCAL_MAILER_PATH', `/bin/mail.local')dnl
+ifdef(`STATUS_FILE',, `define(`STATUS_FILE', /var/sendmail.st)')dnl
+ifdef(`HELP_FILE',, `define(`HELP_FILE', /etc/sendmail.hf)')dnl
diff --git a/usr.sbin/sendmail/contrib/expn.pl b/usr.sbin/sendmail/contrib/expn.pl
index 039782e458a..5ba6410bd23 100644
--- a/usr.sbin/sendmail/contrib/expn.pl
+++ b/usr.sbin/sendmail/contrib/expn.pl
@@ -13,7 +13,7 @@ $sockaddr = 'S n a4 x8';
# system requirements:
# must have 'nslookup' and 'hostname' programs.
-# $Header: /cvs/OpenBSD/src/usr.sbin/sendmail/contrib/Attic/expn.pl,v 1.3 1996/12/14 21:16:35 downsj Exp $
+# $Header: /cvs/OpenBSD/src/usr.sbin/sendmail/contrib/Attic/expn.pl,v 1.4 1997/11/09 04:05:29 gene Exp $
# TODO:
# less magic should apply to command-line addresses
@@ -96,7 +96,7 @@ $sockaddr = 'S n a4 x8';
# $debug : -d
# $valid : -a
# $levels : -1
-# S : the socket connection to $server
+# $S : the socket connection to $server
$have_nslookup = 1; # we have the nslookup program
$port = 'smtp';
@@ -143,12 +143,6 @@ if ($valid) {
}
}
-$0 = "$av0 - building local socket";
-($name,$aliases,$proto) = getprotobyname('tcp');
-($name,$aliases,$port) = getservbyname($port,'tcp')
- unless $port =~ /^\d+/;
-$this = pack($sockaddr, &AF_INET, 0, $thisaddr);
-
HOST:
while (@hosts) {
$server = shift(@hosts);
@@ -177,15 +171,13 @@ while (@hosts) {
# get a connection, or look for an mx
$0 = "$av0 - socket to $server";
- $that = pack($sockaddr, &AF_INET, $port, $thataddr);
- socket(S, &AF_INET, &SOCK_STREAM, $proto)
- || die "socket: $!";
- $0 = "$av0 - bind to $server";
- bind(S, $this)
- || die "bind $hostname,0: $!";
- $0 = "$av0 - connect to $server";
- print "debug = $debug server = $server\n" if $debug > 8;
- if (! connect(S, $that) || ($debug == 10 && $server =~ /relay\d.UU.NET$/i)) {
+
+ $S = new IO::Socket::INET (
+ 'PeerAddr' => $server,
+ 'PeerPort' => $port,
+ 'Proto' => 'tcp');
+
+ if (! $S || ($debug == 10 && $server =~ /relay\d.UU.NET$/i)) {
$0 = "$av0 - $server: could not connect: $!\n";
$emsg = $!;
unless (&mxlookup(0,$server,"$server: could not connect: $!",*users)) {
@@ -193,12 +185,12 @@ while (@hosts) {
}
next HOST;
}
- select((select(S),$| = 1)[0]); # don't buffer output to S
+ $S->autoflush(1);
# read the greeting
$0 = "$av0 - talking to $server";
&alarm("greeting with $server",'');
- while(<S>) {
+ while(<$S>) {
alarm(0);
print if $watch;
if (/^(\d+)([- ])/) {
@@ -210,7 +202,7 @@ while (@hosts) {
print STDERR "$server: NOT 220 greeting: $_"
if ($debug || $vw);
if (&mxlookup(0,$server,"$server: did not respond with a 220 greeting",*users)) {
- close(S);
+ close($S);
next HOST;
}
}
@@ -222,7 +214,7 @@ while (@hosts) {
unless (&mxlookup(0,$server,"$server: did not respond with SMTP codes",*users)) {
&giveup('',"$server: did not talk SMTP");
}
- close(S);
+ close($S);
next HOST;
}
&alarm("greeting with $server",'');
@@ -233,7 +225,7 @@ while (@hosts) {
$0 = "$av0 - sending helo to $server";
&alarm("sending helo to $server","");
&ps("helo $hostname");
- while(<S>) {
+ while(<$S>) {
print if $watch;
last if /^\d+ /;
}
@@ -395,11 +387,11 @@ while (@hosts) {
&alarm("sending 'quit' to $server",'');
$0 = "$av0 - sending 'quit' to $server";
&ps("quit");
- while(<S>) {
+ while(<$S>) {
print if $watch;
last if /^\d+ /;
}
- close(S);
+ close($S);
alarm(0);
}
@@ -604,7 +596,7 @@ sub expn_vrfy
&alarm("${c}'ing $try_u on $server",'',$u);
&ps("$c $try_u");
alarm(0);
- $s = <S>;
+ $s = <$S>;
if ($s eq '') {
return "$server: lost connection";
}
@@ -905,7 +897,7 @@ sub ps
{
local($p) = @_;
print ">>> $p\n" if $watch;
- print S "$p\n";
+ print $S "$p\n";
}
# return case-adjusted name for a host (for comparison purposes)
sub trhost
@@ -1207,7 +1199,7 @@ sub read_response
local($done,$watch) = @_;
local(@resp);
print $s if $watch;
- while(($done eq "-") && ($s = <S>) && ($s =~ /^\d+([- ])/)) {
+ while(($done eq "-") && ($s = <$S>) && ($s =~ /^\d+([- ])/)) {
print $s if $watch;
$done = $1;
push(@resp,$s);
diff --git a/usr.sbin/sendmail/doc/op/op.me b/usr.sbin/sendmail/doc/op/op.me
index fc8ca3ad43c..60bc113807b 100644
--- a/usr.sbin/sendmail/doc/op/op.me
+++ b/usr.sbin/sendmail/doc/op/op.me
@@ -30,7 +30,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)op.me 8.105 (Berkeley) 7/3/97
+.\" @(#)op.me 8.106 (Berkeley) 10/20/97
.\"
.\" eqn op.me | pic | troff -me
.eh 'SMM:08-%''Sendmail Installation and Operation Guide'
@@ -67,7 +67,7 @@
Eric Allman
eric@Sendmail.ORG
.sp
-Version 8.105
+Version 8.106
.sp
For Sendmail Version 8.8
.)l
@@ -4128,6 +4128,8 @@ macro).
.ip h
Upper case should be preserved in host names
for this mailer.
+.ip i
+Do User Database rewriting on envelope sender address.
.ip I
This mailer will be speaking SMTP
to another
@@ -8185,7 +8187,7 @@ replace it with a blank sheet for double-sided output.
.\".sz 10
.\"Eric Allman
.\".sp
-.\"Version 8.105
+.\"Version 8.106
.\".ce 0
.bp 3
.ce
diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c
index e4dff21343f..3a04a0b6cd5 100644
--- a/usr.sbin/sendmail/makemap/makemap.c
+++ b/usr.sbin/sendmail/makemap/makemap.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)makemap.c 8.37 (Berkeley) 7/10/97";
+static char sccsid[] = "@(#)makemap.c 8.38 (Berkeley) 9/23/97";
#endif /* not lint */
#include <sys/types.h>
@@ -363,13 +363,6 @@ main(argc, argv)
pbuf, errstring(st));
exit(EX_CANTCREAT);
}
- if (std.st_dev == stp.st_dev && std.st_ino == stp.st_ino)
- {
- fprintf(stderr,
- "%s: cannot run with GDBM\n",
- mapname);
- exit(EX_CONFIG);
- }
break;
#endif
default:
@@ -407,6 +400,14 @@ main(argc, argv)
#ifdef NDBM
case T_DBM:
dbp.dbm = dbm_open(mapname, mode, 0644);
+ if (dbp.dbm != NULL &&
+ dbm_dirfno(dbp.dbm) == dbm_pagfno(dbp.dbm))
+ {
+ fprintf(stderr, "dbm map %s: cannot run with GDBM\n",
+ mapname);
+ dbm_close(dbp.dbm);
+ exit(EX_CONFIG);
+ }
if (!ignoresafeties && dbp.dbm != NULL &&
(filechanged(dbuf, dbm_dirfno(dbp.dbm), &std, sff) ||
filechanged(pbuf, dbm_pagfno(dbp.dbm), &stp, sff)))
diff --git a/usr.sbin/sendmail/smrsh/smrsh.c b/usr.sbin/sendmail/smrsh/smrsh.c
index 662ec828302..c3314e6e17c 100644
--- a/usr.sbin/sendmail/smrsh/smrsh.c
+++ b/usr.sbin/sendmail/smrsh/smrsh.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)smrsh.c 8.4 (Berkeley) 11/11/95";
+static char sccsid[] = "@(#)smrsh.c 8.5 (Berkeley) 10/19/97";
#endif /* not lint */
/*
@@ -76,6 +76,7 @@ static char sccsid[] = "@(#)smrsh.c 8.4 (Berkeley) 11/11/95";
#endif
#include <sysexits.h>
#include <syslog.h>
+#include <stdlib.h>
/* directory in which all commands must reside */
#ifndef CMDDIR
diff --git a/usr.sbin/sendmail/src/READ_ME b/usr.sbin/sendmail/src/READ_ME
index 154916a0a6e..7eea2674651 100644
--- a/usr.sbin/sendmail/src/READ_ME
+++ b/usr.sbin/sendmail/src/READ_ME
@@ -30,7 +30,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# @(#)READ_ME 8.148 (Berkeley) 8/1/97
+# @(#)READ_ME 8.156 (Berkeley) 10/23/97
#
This directory contains the source files for sendmail.
@@ -148,9 +148,10 @@ The options are:
NEWDB The new Berkeley DB package. Some systems (e.g., BSD/OS and
Digital UNIX 4.0) have this package pre-installed. If your
- system does not have NEWDB installed, get the latest version
+ system does not have NEWDB installed, get version 1.85
from http://www.sleepycat.com/packages/db.1.85.tar.gz.
- DO NOT use the version from the Net2 distribution. If you are
+ DO NOT use Berkeley DB version 2.X with sendmail. DO NOT
+ use the version from the Net2 distribution. If you are
still running BSD/386 1.x, you will also need to define
OLD_NEWDB.
NDBM The older NDBM implementation -- the very old V7 DBM
@@ -731,7 +732,13 @@ SunOS 4.1.3, 4.1.3_U1
101790-01 (SunOS 4.1.3_U1: TCP socket and reset problems).
Solaris 2.x (SunOS 5.x)
- To compile for Solaris, be sure you use -DSOLARIS.
+ To compile for Solaris, the Makefile chosen by makesendmail must
+ include a SOLARIS definition which reflects the Solaris version
+ (i.e. -DSOLARIS=20400 for 2.4 or -DSOLARIS=20501 for 2.5.1).
+ If you are using gcc, make sure -I/usr/include is not used (or
+ it might complain about TopFrame). If you are using Sun's cc,
+ make sure /opt/SUNWspro/bin/cc is used instead of /usr/ucb/cc
+ (or it might complain about tm_zone).
To the best of my knowledge, Solaris does not have the
gethostbyname problem described above. However, it does
@@ -828,22 +835,25 @@ Solaris 2.6 (SunOS 5.6)
incompatible snprintf(3s) calls. This problem is fixed in sendmail
8.8.5.
-Solaris 2.5.1 (SunOS 5.5.1)
- Apparently patch 103663-01 installs a new /usr/include/resolv.h
- file that defines the __P macro without checking to see if it is
- already defined. This causes compile warnings such as:
+Solaris 2.5.1 (SunOS 5.5.1) and 2.6 (SunOS 5.6)
+ Apparently Solaris 2.5.1 patch 103663-01 installs a new
+ /usr/include/resolv.h file that defines the __P macro without
+ checking to see if it is already defined. This new resolv.h is also
+ included in the Solaris 2.6 distribution. This causes compile
+ warnings such as:
In file included from daemon.c:51:
/usr/include/resolv.h:208: warning: `__P' redefined
cdefs.h:58: warning: this is the location of the previous definition
- If you are running with this patch, create a resolv.h file in the
- obj.SunOS.5.5.1.* directory that reads:
+ These warnings can be safely ignored or you can create a resolv.h
+ file in the obj.SunOS.5.5.1.* or obj.SunOS.5.6.* directory that reads:
#undef __P
#include "/usr/include/resolv.h"
- ... And then file a bug report with Sun.
+ Sun is aware of the problem (Sun bug ID 4081053) and it will be fixed
+ in a to-be-released patch.
Ultrix
By default, the IDENT protocol is turned off on Ultrix. If you
@@ -852,7 +862,7 @@ Ultrix
IDENT on in the configuration file by setting the "ident" timeout
to 30 seconds.
-OSF/1
+Digital UNIX (formerly DEC OSF/1)
If you are compiling on OSF/1 (DEC Alpha), you must use
-L/usr/shlib (otherwise it core dumps on startup). You may also
need -mld to get the nlist() function, although some versions
@@ -865,6 +875,19 @@ OSF/1
properly due to a bug in the getpw* routines. If you want to use
this, use -DDEC_OSF_BROKEN_GETPWENT=1. The problem is fixed in 3.2C.
+ On Digital UNIX 4.0 and later, Berkeley DB is included with the
+ operating system and already has the ndbm.o module removed. However,
+ Digital has modified the original Berkeley DB db.h include file.
+ This results in the following warning while compiling map.c and udb.c:
+
+ cc: Warning: /usr/include/db.h, line 74: The redefinition of the macro
+ "__signed" conflicts with a current definition because the replacement
+ lists differ. The redefinition is now in effect.
+ #define __signed signed
+ ------------------------^
+
+ This warning can be ignored.
+
IRIX
The header files on SGI IRIX are completely prototyped, and as
a result you can sometimes get some warning messages during
@@ -1439,4 +1462,4 @@ version.c The version number and information about this
Eric Allman
-(Version 8.148, last update 8/1/97 16:41:54)
+(Version 8.156, last update 10/23/97 12:53:12)
diff --git a/usr.sbin/sendmail/src/collect.c b/usr.sbin/sendmail/src/collect.c
index de4ee064879..58f0dc75142 100644
--- a/usr.sbin/sendmail/src/collect.c
+++ b/usr.sbin/sendmail/src/collect.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)collect.c 8.71 (Berkeley) 6/30/97";
+static char sccsid[] = "@(#)collect.c 8.72 (Berkeley) 10/6/97";
#endif /* not lint */
# include <errno.h>
@@ -567,7 +567,7 @@ readerr:
/* check for message too large */
if (MaxMessageSize > 0 && e->e_msgsize > MaxMessageSize)
{
- e->e_flags |= EF_NO_BODY_RETN;
+ e->e_flags |= EF_NO_BODY_RETN|EF_CLRQUEUE;
e->e_status = "5.2.3";
usrerr("552 Message exceeds maximum fixed size (%ld)",
MaxMessageSize);
diff --git a/usr.sbin/sendmail/src/conf.c b/usr.sbin/sendmail/src/conf.c
index ebd8e4fc836..b19ecd9d64f 100644
--- a/usr.sbin/sendmail/src/conf.c
+++ b/usr.sbin/sendmail/src/conf.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)conf.c 8.374 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)conf.c 8.379 (Berkeley) 10/20/97";
#endif /* not lint */
# include "sendmail.h"
@@ -1973,7 +1973,7 @@ getla()
/* Non Apollo stuff removed by Don Lewis 11/15/93 */
#ifndef lint
-static char rcsid[] = "@(#)$Id: conf.c,v 1.8 1997/08/04 02:17:48 downsj Exp $";
+static char rcsid[] = "@(#)$Id: conf.c,v 1.9 1997/11/09 04:05:36 gene Exp $";
#endif /* !lint */
#ifdef apollo
@@ -2066,7 +2066,6 @@ refuseconnections(port)
static time_t lastconn = (time_t) 0;
static int conncnt = 0;
extern bool enoughdiskspace();
- extern void setproctitle __P((const char *, ...));
#ifdef XLA
if (!xla_smtp_ok())
@@ -2225,7 +2224,7 @@ initsetproctitle(argc, argv, envp)
char **argv;
char **envp;
{
- register int i;
+ register int i, envpsize = 0;
extern char **environ;
/*
@@ -2234,7 +2233,7 @@ initsetproctitle(argc, argv, envp)
*/
for (i = 0; envp[i] != NULL; i++)
- continue;
+ envpsize += strlen(envp[i]) + 1;
environ = (char **) xalloc(sizeof (char *) * (i + 1));
for (i = 0; envp[i] != NULL; i++)
environ[i] = newstr(envp[i]);
@@ -2245,6 +2244,16 @@ initsetproctitle(argc, argv, envp)
*/
Argv = argv;
+
+ /*
+ ** Find the last environment variable within sendmail's
+ ** process memory area.
+ */
+ while (i > 0 && (envp[i - 1] < argv[0] ||
+ envp[i - 1] > (argv[argc - 1] +
+ strlen(argv[argc - 1]) + 1 + envpsize)))
+ i--;
+
if (i > 0)
LastArgv = envp[i - 1] + strlen(envp[i - 1]);
else
@@ -2820,6 +2829,7 @@ char *optarg = NULL; /* argument associated with option */
#define tell(s) if (opterr) {fputs(*nargv,stderr);fputs(s,stderr); \
fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);}
+int
getopt(nargc,nargv,ostr)
int nargc;
char *const *nargv;
@@ -2827,7 +2837,7 @@ getopt(nargc,nargv,ostr)
{
static char *place = EMSG; /* option letter processing */
static char atend = 0;
- register char *oli; /* option letter list index */
+ register char *oli = NULL; /* option letter list index */
if (atend) {
atend = 0;
@@ -2929,7 +2939,7 @@ vsprintf(s, fmt, ap)
* causing nast effects.
**************************************************************/
-/*static char _id[] = "$Id: conf.c,v 1.8 1997/08/04 02:17:48 downsj Exp $";*/
+/*static char _id[] = "$Id: conf.c,v 1.9 1997/11/09 04:05:36 gene Exp $";*/
static void sm_dopr();
static char *DoprEnd;
static int SnprfOverflow;
@@ -3844,7 +3854,7 @@ chownsafe(fd, safedir)
bool safedir;
{
#if (!defined(_POSIX_CHOWN_RESTRICTED) || _POSIX_CHOWN_RESTRICTED != -1) && \
- defined(_PC_CHOWN_RESTRICTED)
+ (defined(_PC_CHOWN_RESTRICTED) || defined(_GNU_TYPES_H))
int rval;
/* give the system administrator a chance to override */
diff --git a/usr.sbin/sendmail/src/conf.h b/usr.sbin/sendmail/src/conf.h
index 7414904429d..de37c145b78 100644
--- a/usr.sbin/sendmail/src/conf.h
+++ b/usr.sbin/sendmail/src/conf.h
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)conf.h 8.328 (Berkeley) 8/3/97
+ * @(#)conf.h 8.335 (Berkeley) 10/24/97
*/
/*
@@ -294,7 +294,9 @@ typedef int pid_t;
define BSD_REMAP_SIGNAL_TO_SIGVEC
RTisms needed above */
/* make this sendmail in a completely different place */
-# define _PATH_VENDORCF "/usr/local/newmail/sendmail.cf"
+# ifndef _PATH_VENDOR_CF
+# define _PATH_VENDOR_CF "/usr/local/newmail/sendmail.cf"
+# endif
# ifndef _PATH_SENDMAILPID
# define _PATH_SENDMAILPID "/usr/local/newmail/sendmail.pid"
# endif
@@ -348,6 +350,7 @@ typedef int pid_t;
# ifdef IRIX6
# define LA_TYPE LA_IRIX6 /* figure out at run time */
# define SAFENFSPATHCONF 0 /* pathconf(2) lies on NFS filesystems */
+# define SYSLOG_BUFSIZE 512
# else
# define LA_TYPE LA_INT
@@ -382,7 +385,6 @@ typedef int pid_t;
# include <sys/time.h>
# define HASINITGROUPS 1 /* has initgroups(3) call */
# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
# define HASFCHMOD 1 /* has fchmod(2) syscall */
# define IP_SRCROUTE 1 /* can check IP source routing */
# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
@@ -438,6 +440,7 @@ typedef int pid_t;
# else
/* SunOS 4.0.3 or 4.1.x */
+# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
# define HASSETREUID 1 /* has setreuid(2) call */
# ifndef HASFLOCK
# define HASFLOCK 1 /* has flock(2) call */
@@ -903,6 +906,7 @@ extern int errno;
#if _SCO_DS >= 1
# include <paths.h>
# define _SCO_unix_4_2
+# define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM returns bogus value */
# define HASSNPRINTF 1 /* has snprintf(3) call */
# define HASFCHMOD 1 /* has fchmod(2) call */
# define HASSETRLIMIT 1 /* has setrlimit(2) call */
@@ -1188,6 +1192,7 @@ extern void *malloc();
# define LA_TYPE LA_PROCSTR
# endif
# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() impl */
+# define SPT_PADCHAR '\0' /* pad process title with nulls */
# ifndef _PATH_SENDMAILPID
# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
# endif
@@ -1224,6 +1229,7 @@ extern void *malloc();
# define BSD /* has BSD routines */
# define HASSETRLIMIT 0 /* ... but not setrlimit(2) */
# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
+# define BOGUS_O_EXCL 1 /* exclusive open follows symlinks */
# define HASUNAME 1 /* use System V uname(2) system call */
# define HASFCHMOD 1 /* has fchmod(2) syscall */
# define HASINITGROUPS 1 /* has initgroups(3) call */
@@ -1836,6 +1842,15 @@ typedef struct msgb mblk_t;
# undef offsetof /* avoid stddefs.h and sys/sysmacros.h conflict */
#endif
+/*
+** Siemens Nixdorf Informationssysteme AG SINIX
+**
+** Contributed by Gerald Rinske <Gerald.Rinske@mch.sni.de>
+** of Siemens Business Services VAS.
+*/
+#ifdef _sinix_
+# define SYSLOG_BUFSIZE 1024
+#endif
/**********************************************************************
** End of Per-Operating System defines
diff --git a/usr.sbin/sendmail/src/daemon.c b/usr.sbin/sendmail/src/daemon.c
index bc8fd6f1e90..e62aaf147d5 100644
--- a/usr.sbin/sendmail/src/daemon.c
+++ b/usr.sbin/sendmail/src/daemon.c
@@ -37,9 +37,9 @@
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.186 (Berkeley) 8/2/97 (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.195 (Berkeley) 10/23/97 (with daemon mode)";
#else
-static char sccsid[] = "@(#)daemon.c 8.186 (Berkeley) 8/2/97 (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.195 (Berkeley) 10/23/97 (without daemon mode)";
#endif
#endif /* not lint */
@@ -103,9 +103,7 @@ static char sccsid[] = "@(#)daemon.c 8.186 (Berkeley) 8/2/97 (without daemon mod
** e -- the current envelope.
**
** Returns:
-** TRUE -- if a "null server" should be used -- that is, one
-** that rejects all commands.
-** FALSE -- to use a normal server.
+** none.
**
** Side Effects:
** Waits until some interesting activity occurs. When
@@ -122,7 +120,7 @@ int ListenQueueSize = 10; /* size of listen queue */
int TcpRcvBufferSize = 0; /* size of TCP receive buffer */
int TcpSndBufferSize = 0; /* size of TCP send buffer */
-bool
+void
getrequests(e)
ENVELOPE *e;
{
@@ -188,7 +186,7 @@ getrequests(e)
*/
if (tTd(15, 1))
- printf("getrequests: port 0x%x\n", DaemonAddr.sin.sin_port);
+ printf("getrequests: port 0x%x\n", port);
/* get a socket for the SMTP connection */
socksize = opendaemonsocket(TRUE);
@@ -238,7 +236,7 @@ getrequests(e)
/* see if we are rejecting connections */
(void) blocksignal(SIGALRM);
- if (refuseconnections(ntohs(DaemonAddr.sin.sin_port)))
+ if (refuseconnections(ntohs(port)))
{
if (DaemonSocket >= 0)
{
@@ -284,7 +282,7 @@ getrequests(e)
/* wait for a connection */
setproctitle("accepting connections on port %d",
- ntohs(DaemonAddr.sin.sin_port));
+ ntohs(port));
#if 0
/*
** Andrew Sun <asun@ieps-sun.ml.com> claims that this will
@@ -372,7 +370,6 @@ getrequests(e)
char *p;
extern SIGFUNC_DECL intsig __P((int));
FILE *inchannel, *outchannel;
- bool nullconn;
/*
** CHILD -- return to caller.
@@ -437,13 +434,6 @@ getrequests(e)
/* open maps for check_relay ruleset */
initmaps(FALSE, e);
- /* validate the connection */
- HoldErrs = TRUE;
- nullconn = !validate_connection(&RealHostAddr, RealHostName, e);
- HoldErrs = FALSE;
- if (nullconn)
- break;
-
#ifdef XLA
if (!xla_host_ok(RealHostName))
{
@@ -452,9 +442,7 @@ getrequests(e)
}
#endif
- if (tTd(15, 2))
- printf("getreq: returning (normal server)\n");
- return FALSE;
+ break;
}
/* parent -- keep track of children */
@@ -473,8 +461,8 @@ getrequests(e)
(void) close(pipefd[1]);
}
if (tTd(15, 2))
- printf("getreq: returning (null server)\n");
- return TRUE;
+ printf("getreq: returning\n");
+ return;
}
/*
** OPENDAEMONSOCKET -- open the SMTP socket
@@ -1265,7 +1253,7 @@ getauthinfo(fd)
int nleft;
struct hostent *hp;
char **ha;
- bool may_be_forged;
+ volatile bool may_be_forged;
char ibuf[MAXNAME + 1];
static char hbuf[MAXNAME * 2 + 2];
@@ -1750,6 +1738,7 @@ host_map_lookup(map, name, av, statp)
}
/* found a match -- copy out */
+ hp->h_name = denlstring((char *) hp->h_name, TRUE, TRUE);
s->s_namecanon.nc_stat = *statp = EX_OK;
s->s_namecanon.nc_cname = newstr(hp->h_name);
if (bitset(MF_MATCHONLY, map->map_mflags))
@@ -2027,7 +2016,9 @@ hostnamebyanyaddr(sap)
#endif /* NAMED_BIND */
if (hp != NULL && hp->h_name[0] != '[')
- return (char *) hp->h_name;
+ return denlstring((char *) hp->h_name, TRUE, TRUE);
+ else if (sap->sa.sa_family == AF_UNIX && sap->sunix.sun_path[0] == '\0')
+ return "localhost";
else
{
/* produce a dotted quad */
diff --git a/usr.sbin/sendmail/src/deliver.c b/usr.sbin/sendmail/src/deliver.c
index 741af15de1d..957551590fc 100644
--- a/usr.sbin/sendmail/src/deliver.c
+++ b/usr.sbin/sendmail/src/deliver.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)deliver.c 8.285 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)deliver.c 8.296 (Berkeley) 10/22/97";
#endif /* not lint */
#include "sendmail.h"
@@ -44,6 +44,10 @@ static char sccsid[] = "@(#)deliver.c 8.285 (Berkeley) 8/2/97";
extern int h_errno;
#endif
+#if HASSETUSERCONTEXT
+# include <login_cap.h>
+#endif
+
#if SMTP
extern char SmtpError[];
#endif
@@ -77,7 +81,7 @@ sendall(e, mode)
register ENVELOPE *ee;
ENVELOPE *splitenv = NULL;
int oldverbose = Verbose;
- bool somedeliveries = FALSE;
+ bool somedeliveries = FALSE, expensive = FALSE;
pid_t pid;
extern void sendenvelope();
@@ -281,6 +285,7 @@ sendall(e, mode)
if (tTd(13, 30))
printf(" ... expensive\n");
q->q_flags |= QQUEUEUP;
+ expensive = TRUE;
}
else
{
@@ -393,11 +398,13 @@ sendall(e, mode)
/* treat this as a delivery in terms of counting tries */
e->e_dtime = curtime();
- e->e_ntries++;
+ if (!expensive)
+ e->e_ntries++;
for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
{
ee->e_dtime = curtime();
- ee->e_ntries++;
+ if (!expensive)
+ ee->e_ntries++;
}
}
@@ -466,34 +473,13 @@ sendall(e, mode)
/*
** Since fcntl locking has the interesting semantic that
** the lock is owned by a process, not by an open file
- ** descriptor, we have to flush this to the queue, and
+ ** descriptor, we have to unlock this envelope, and
** then restart from scratch in the child.
*/
- {
- /* save id for future use */
- char *qid = e->e_id;
-
- /* now drop the envelope in the parent */
- e->e_flags |= EF_INQUEUE;
- dropenvelope(e, FALSE);
-
- /* arrange to reacquire lock after fork */
- e->e_id = qid;
- }
-
+ unlockqueue(e);
for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- /* save id for future use */
- char *qid = ee->e_id;
-
- /* drop envelope in parent */
- ee->e_flags |= EF_INQUEUE;
- dropenvelope(ee, FALSE);
-
- /* and save qid for reacquisition */
- ee->e_id = qid;
- }
+ unlockqueue(ee);
# endif /* !HASFLOCK */
@@ -1368,7 +1354,7 @@ tryhost:
hostbuf, m->m_name);
else
message("Connecting to %s port %d via %s...",
- hostbuf, port, m->m_name);
+ hostbuf, ntohs(port), m->m_name);
i = makeconnection(hostbuf, port, mci, e);
mci->mci_lastuse = curtime();
mci->mci_exitstat = i;
@@ -1577,7 +1563,7 @@ tryhost:
pwd = sm_getpwnam(contextaddr->q_user);
if (pwd != NULL)
(void) setusercontext(NULL,
- pwd, pwd->m_uid,
+ pwd, pwd->pw_uid,
LOGIN_SETRESOURCES|LOGIN_SETPRIORITY);
}
#endif
@@ -1901,7 +1887,7 @@ tryhost:
for (to = tochain; to != NULL; to = to->q_tchain)
{
e->e_to = to->q_paddr;
- if (strlen(to->q_paddr) + (t - tobuf) + 2 >= sizeof tobuf)
+ if (strlen(to->q_paddr) + (t - tobuf) + 2 > sizeof tobuf)
{
/* not enough room */
continue;
@@ -2244,6 +2230,8 @@ endmailer(mci, e, pv)
{
int st;
+ mci_unlock_host(mci);
+
/* close any connections */
if (mci->mci_in != NULL)
(void) xfclose(mci->mci_in, mci->mci_mailer->m_name, "mci_in");
@@ -2331,6 +2319,9 @@ giveresponse(stat, m, mci, ctladdr, xstart, e)
extern int N_SysEx;
char buf[MAXLINE];
+ if (e == NULL)
+ syserr("giveresponse: null envelope");
+
/*
** Compute status message from code.
*/
@@ -2428,7 +2419,8 @@ giveresponse(stat, m, mci, ctladdr, xstart, e)
** that.
*/
- if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
+ if (OpMode != MD_VERIFY && !bitset(EF_VRFYONLY, e->e_flags) &&
+ LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
logdelivery(m, mci, &statmsg[4], ctladdr, xstart, e);
if (tTd(11, 2))
@@ -2741,7 +2733,7 @@ putfromline(mci, e)
}
}
expand(template, buf, sizeof buf, e);
- putxline(buf, strlen(buf), mci, PXLF_NOTHINGSPECIAL);
+ putxline(buf, strlen(buf), mci, PXLF_HEADER);
}
/*
** PUTBODY -- put the body of a message.
@@ -3096,17 +3088,21 @@ endofmessage:
** none.
*/
+static jmp_buf CtxMailfileTimeout;
+static void mailfiletimeout();
+
int
mailfile(filename, ctladdr, sfflags, e)
- char *filename;
+ char *volatile filename;
ADDRESS *ctladdr;
- int sfflags;
+ volatile int sfflags;
register ENVELOPE *e;
{
register FILE *f;
register pid_t pid = -1;
- int mode = ST_MODE_NOFILE;
+ volatile int mode = ST_MODE_NOFILE;
bool suidwarn = geteuid() == 0;
+ EVENT *ev;
if (tTd(11, 1))
{
@@ -3140,7 +3136,7 @@ mailfile(filename, ctladdr, sfflags, e)
/* child -- actually write to file */
struct stat stb;
MCI mcibuf;
- int oflags = O_WRONLY|O_APPEND;
+ volatile int oflags = O_WRONLY|O_APPEND;
if (e->e_lockfp != NULL)
(void) close(fileno(e->e_lockfp));
@@ -3152,6 +3148,16 @@ mailfile(filename, ctladdr, sfflags, e)
e->e_to = filename;
ExitStat = EX_OK;
+ if (setjmp(CtxMailfileTimeout) != 0)
+ {
+ exit(EX_TEMPFAIL);
+ }
+
+ if (TimeOuts.to_fileopen > 0)
+ ev = setevent(TimeOuts.to_fileopen, mailfiletimeout, 0);
+ else
+ ev = NULL;
+
#ifdef HASLSTAT
if (lstat(filename, &stb) < 0)
#else
@@ -3287,6 +3293,9 @@ mailfile(filename, ctladdr, sfflags, e)
exit(EX_CANTCREAT);
}
+ if (ev != NULL)
+ clrevent(ev);
+
bzero(&mcibuf, sizeof mcibuf);
mcibuf.mci_mailer = FileMailer;
mcibuf.mci_out = f;
@@ -3332,6 +3341,12 @@ mailfile(filename, ctladdr, sfflags, e)
}
return EX_UNAVAILABLE; /* avoid compiler warning on IRIX */
}
+
+static void
+mailfiletimeout()
+{
+ longjmp(CtxMailfileTimeout, 1);
+}
/*
** HOSTSIGNATURE -- return the "signature" for a host.
**
diff --git a/usr.sbin/sendmail/src/err.c b/usr.sbin/sendmail/src/err.c
index f4f95e6cd0f..f08d9609d8e 100644
--- a/usr.sbin/sendmail/src/err.c
+++ b/usr.sbin/sendmail/src/err.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)err.c 8.64 (Berkeley) 7/25/97";
+static char sccsid[] = "@(#)err.c 8.65 (Berkeley) 10/18/97";
#endif /* not lint */
# include "sendmail.h"
@@ -556,7 +556,9 @@ fmtmsg(eb, to, num, eno, fmt, ap)
}
/* output the "to" person */
- if (to != NULL && to[0] != '\0')
+ if (to != NULL && to[0] != '\0' &&
+ strncmp(num, "551", 3) != 0 &&
+ strncmp(num, "251", 3) != 0)
{
(void) snprintf(eb, spaceleft, "%s... ",
shortenstring(to, 203));
diff --git a/usr.sbin/sendmail/src/headers.c b/usr.sbin/sendmail/src/headers.c
index 5bfd4000331..857e9c32da1 100644
--- a/usr.sbin/sendmail/src/headers.c
+++ b/usr.sbin/sendmail/src/headers.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)headers.c 8.111 (Berkeley) 7/9/97";
+static char sccsid[] = "@(#)headers.c 8.115 (Berkeley) 10/22/97";
#endif /* not lint */
# include <errno.h>
@@ -522,9 +522,16 @@ eatheader(e, full)
(void) sendtolist(h->h_value, NULLADDR,
&e->e_sendqueue, 0, e);
+#if 0
+ /*
+ ** Change functionality so a fatal error on an
+ ** address doesn't affect the entire envelope.
+ */
+
/* delete fatal errors generated by this address */
- if (!GrabTo && !bitset(EF_FATALERRS, saveflags))
+ if (!bitset(EF_FATALERRS, saveflags))
e->e_flags &= ~EF_FATALERRS;
+#endif
}
/* save the message-id for logging */
@@ -1330,7 +1337,7 @@ put_vanilla_header(h, v, mci)
int putflags;
char obuf[MAXLINE];
- putflags = 0;
+ putflags = PXLF_HEADER;
#if _FFR_7BITHDRS
if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
putflags |= PXLF_STRIP8BIT;
@@ -1342,8 +1349,8 @@ put_vanilla_header(h, v, mci)
int l;
l = nlp - v;
- if (sizeof obuf - (obp - obuf) < l)
- l = sizeof obuf - (obp - obuf);
+ if (SPACELEFT(obuf, obp) - 1 < l)
+ l = SPACELEFT(obuf, obp) - 1;
snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v);
putxline(obuf, strlen(obuf), mci, putflags);
@@ -1385,7 +1392,7 @@ commaize(h, p, oldstyle, mci, e)
int opos;
int omax;
bool firstone = TRUE;
- int putflags = 0;
+ int putflags = PXLF_HEADER;
char obuf[MAXLINE + 3];
/*
@@ -1491,6 +1498,7 @@ commaize(h, p, oldstyle, mci, e)
*p = savechar;
continue;
}
+ name = denlstring(name, FALSE, TRUE);
/* output the name with nice formatting */
opos += strlen(name);
diff --git a/usr.sbin/sendmail/src/main.c b/usr.sbin/sendmail/src/main.c
index 5a303822edc..c496adb78ee 100644
--- a/usr.sbin/sendmail/src/main.c
+++ b/usr.sbin/sendmail/src/main.c
@@ -39,7 +39,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.249 (Berkeley) 7/25/97";
+static char sccsid[] = "@(#)main.c 8.258 (Berkeley) 10/20/97";
#endif /* not lint */
#define _DEFINE
@@ -50,10 +50,6 @@ static char sccsid[] = "@(#)main.c 8.249 (Berkeley) 7/25/97";
#include <resolv.h>
#endif
-# ifdef lint
-char edata, end;
-# endif /* lint */
-
/*
** SENDMAIL -- Post mail to a set of destinations.
**
@@ -122,7 +118,6 @@ main(argc, argv, envp)
char **av;
extern char Version[];
char *ep, *from;
- typedef int (*fnptr)();
STAB *st;
register int i;
int j;
@@ -133,7 +128,6 @@ main(argc, argv, envp)
bool run_in_foreground = FALSE; /* -bD mode */
static bool reenter = FALSE;
struct passwd *pw;
- struct stat stb;
struct hostent *hp;
bool nullserver = FALSE;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
@@ -436,6 +430,8 @@ main(argc, argv, envp)
res_init();
if (tTd(8, 8))
_res.options |= RES_DEBUG;
+ else
+ _res.options &= ~RES_DEBUG;
# ifdef RES_NOALIASES
_res.options |= RES_NOALIASES;
# endif
@@ -832,6 +828,15 @@ main(argc, argv, envp)
ConfigFileRead = TRUE;
vendor_post_defaults(CurEnv);
+ /* Enforce use of local time (null string overrides this) */
+ if (TimeZoneSpec == NULL)
+ unsetenv("TZ");
+ else if (TimeZoneSpec[0] != '\0')
+ setuserenv("TZ", TimeZoneSpec);
+ else
+ setuserenv("TZ", NULL);
+ tzset();
+
/* avoid denial-of-service attacks */
resetlimits();
@@ -903,15 +908,6 @@ main(argc, argv, envp)
if (DefaultNotify == 0)
DefaultNotify = QPINGONFAILURE|QPINGONDELAY;
- /* Enforce use of local time (null string overrides this) */
- if (TimeZoneSpec == NULL)
- unsetenv("TZ");
- else if (TimeZoneSpec[0] != '\0')
- setuserenv("TZ", TimeZoneSpec);
- else
- setuserenv("TZ", NULL);
- tzset();
-
/* be sure we don't pick up bogus HOSTALIASES environment variable */
if (queuemode && RealUid != 0)
(void) unsetenv("HOSTALIASES");
@@ -1321,7 +1317,7 @@ main(argc, argv, envp)
if (OpMode == MD_DAEMON || QueueIntvl != 0)
{
char dtype[200];
- extern bool getrequests __P((ENVELOPE *));
+ extern void getrequests __P((ENVELOPE *));
if (!run_in_foreground && !tTd(99, 100))
{
@@ -1371,7 +1367,7 @@ main(argc, argv, envp)
dropenvelope(CurEnv, TRUE);
#if DAEMON
- nullserver = getrequests(CurEnv);
+ getrequests(CurEnv);
/* drop privileges */
(void) drop_privileges(FALSE);
@@ -1385,6 +1381,11 @@ main(argc, argv, envp)
p = getauthinfo(fileno(InChannel));
define('_', p, &BlankEnvelope);
+
+ /* validate the connection */
+ HoldErrs = TRUE;
+ nullserver = !validate_connection(&RealHostAddr, RealHostName, CurEnv);
+ HoldErrs = FALSE;
#endif /* DAEMON */
}
@@ -1476,10 +1477,9 @@ main(argc, argv, envp)
CurEnv->e_flags &= ~EF_FATALERRS;
collect(InChannel, FALSE, NULL, CurEnv);
- /* bail out if there were fatal errors in collect */
- if (OpMode != MD_VERIFY && bitset(EF_FATALERRS, CurEnv->e_flags))
+ /* bail out if message too large */
+ if (bitset(EF_CLRQUEUE, CurEnv->e_flags))
{
- CurEnv->e_flags |= EF_CLRQUEUE;
finis();
/*NOTREACHED*/
return -1;
@@ -2047,7 +2047,7 @@ sighup(sig)
RunAsUid, RunAsGid);
exit(EX_OSERR);
}
- execv(SaveArgv[0], (ARGV_T) SaveArgv);
+ execve(SaveArgv[0], (ARGV_T) SaveArgv, (ARGV_T) ExternalEnviron);
if (LogLevel > 0)
sm_syslog(LOG_ALERT, NOQID, "could not exec %s: %m", SaveArgv[0]);
exit(EX_OSFILE);
@@ -2089,14 +2089,14 @@ drop_privileges(to_real_uid)
#ifdef NGROUPS_MAX
/* reset group permissions; these can be set later */
- emptygidset[0] = RunAsGid == 0 ? getegid() : RunAsGid;
+ emptygidset[0] = (to_real_uid || RunAsGid != 0) ? RunAsGid : getegid();
(void) setgroups(1, emptygidset);
#endif
/* reset primary group and user id */
- if (RunAsGid != 0 && setgid(RunAsGid) < 0)
+ if ((to_real_uid || RunAsGid != 0) && setgid(RunAsGid) < 0)
rval = EX_OSERR;
- if (RunAsUid != 0 && setuid(RunAsUid) < 0)
+ if ((to_real_uid || RunAsUid != 0) && setuid(RunAsUid) < 0)
rval = EX_OSERR;
return rval;
}
diff --git a/usr.sbin/sendmail/src/map.c b/usr.sbin/sendmail/src/map.c
index 88e82b19f98..e8897366095 100644
--- a/usr.sbin/sendmail/src/map.c
+++ b/usr.sbin/sendmail/src/map.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)map.c 8.181 (Berkeley) 7/9/97";
+static char sccsid[] = "@(#)map.c 8.186 (Berkeley) 10/21/97";
#endif /* not lint */
#include "sendmail.h"
@@ -402,8 +402,8 @@ map_rewrite(map, s, slen, av)
**
** Side Effects:
** initializes aliases:
-** if NDBM: opens the database.
-** if ~NDBM: reads the aliases into the symbol table.
+** if alias database: opens the database.
+** if no database available: reads aliases into the symbol table.
*/
void
@@ -417,25 +417,20 @@ initmaps(rebuild, e)
checkfd012("entering initmaps");
#endif
CurEnv = e;
- if (rebuild)
- {
- stabapply(map_init, 1);
- stabapply(map_init, 2);
- }
- else
- {
- stabapply(map_init, 0);
- }
+
+ stabapply(map_init, 0);
+ stabapply(map_init, rebuild ? 2 : 1);
#if XDEBUG
checkfd012("exiting initmaps");
#endif
}
void
-map_init(s, rebuild)
+map_init(s, pass)
register STAB *s;
- int rebuild;
+ int pass;
{
+ bool rebuildable;
register MAP *map;
/* has to be a map */
@@ -452,13 +447,23 @@ map_init(s, rebuild)
map->map_class->map_cname,
map->map_mname == NULL ? "NULL" : map->map_mname,
map->map_file == NULL ? "NULL" : map->map_file,
- rebuild);
+ pass);
+
+ /*
+ ** Pass 0 opens all non-rebuildable maps.
+ ** Pass 1 opens all rebuildable maps for read.
+ ** Pass 2 rebuilds all rebuildable maps.
+ */
+
+ rebuildable = (bitset(MF_ALIAS, map->map_mflags) &&
+ bitset(MCF_REBUILDABLE, map->map_class->map_cflags));
- if (rebuild == (bitset(MF_ALIAS, map->map_mflags) &&
- bitset(MCF_REBUILDABLE, map->map_class->map_cflags) ? 1 : 2))
+ if ((pass == 0 && rebuildable) ||
+ ((pass == 1 || pass == 2) && !rebuildable))
{
if (tTd(38, 3))
- printf("\twrong pass\n");
+ printf("\twrong pass (pass = %d, rebuildable = %d)\n",
+ pass, rebuildable);
return;
}
@@ -468,43 +473,42 @@ map_init(s, rebuild)
map->map_class->map_close(map);
map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
}
-
- if (rebuild == 2)
+
+ if (pass == 2)
{
rebuildaliases(map, FALSE);
+ return;
+ }
+
+ if (map->map_class->map_open(map, O_RDONLY))
+ {
+ if (tTd(38, 4))
+ printf("\t%s:%s %s: valid\n",
+ map->map_class->map_cname == NULL ? "NULL" :
+ map->map_class->map_cname,
+ map->map_mname == NULL ? "NULL" :
+ map->map_mname,
+ map->map_file == NULL ? "NULL" :
+ map->map_file);
+ map->map_mflags |= MF_OPEN;
}
else
{
- if (map->map_class->map_open(map, O_RDONLY))
- {
- if (tTd(38, 4))
- printf("\t%s:%s %s: valid\n",
- map->map_class->map_cname == NULL ? "NULL" :
- map->map_class->map_cname,
- map->map_mname == NULL ? "NULL" :
- map->map_mname,
- map->map_file == NULL ? "NULL" :
- map->map_file);
- map->map_mflags |= MF_OPEN;
- }
- else
+ if (tTd(38, 4))
+ printf("\t%s:%s %s: invalid: %s\n",
+ map->map_class->map_cname == NULL ? "NULL" :
+ map->map_class->map_cname,
+ map->map_mname == NULL ? "NULL" :
+ map->map_mname,
+ map->map_file == NULL ? "NULL" :
+ map->map_file,
+ errstring(errno));
+ if (!bitset(MF_OPTIONAL, map->map_mflags))
{
- if (tTd(38, 4))
- printf("\t%s:%s %s: invalid: %s\n",
- map->map_class->map_cname == NULL ? "NULL" :
- map->map_class->map_cname,
- map->map_mname == NULL ? "NULL" :
- map->map_mname,
- map->map_file == NULL ? "NULL" :
- map->map_file,
- errstring(errno));
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- extern MAPCLASS BogusMapClass;
+ extern MAPCLASS BogusMapClass;
- map->map_class = &BogusMapClass;
- map->map_mflags |= MF_OPEN;
- }
+ map->map_class = &BogusMapClass;
+ map->map_mflags |= MF_OPEN;
}
}
}
@@ -781,14 +785,6 @@ ndbm_map_open(map, mode)
if (std.st_mode == ST_MODE_NOFILE)
mode |= O_CREAT|O_EXCL;
- /* heuristic: if files are linked, this is actually gdbm */
- if (std.st_dev == stp.st_dev && std.st_ino == stp.st_ino)
- {
- syserr("dbm map \"%s\": cannot support GDBM",
- map->map_mname);
- return FALSE;
- }
-
#if LOCK_ON_OPEN
if (mode == O_RDONLY)
mode |= O_SHLOCK;
@@ -891,6 +887,20 @@ ndbm_map_open(map, mode)
}
dfd = dbm_dirfno(dbm);
pfd = dbm_pagfno(dbm);
+ if (dfd == pfd)
+ {
+ /* heuristic: if files are linked, this is actually gdbm */
+ dbm_close(dbm);
+#if !LOCK_ON_OPEN && !NOFTRUNCATE
+ if (map->map_lockfd >= 0)
+ close(map->map_lockfd);
+#endif
+ errno = 0;
+ syserr("dbm map \"%s\": cannot support GDBM",
+ map->map_mname);
+ return FALSE;
+ }
+
if (filechanged(dirfile, dfd, &std, sff) ||
filechanged(pagfile, pfd, &stp, sff))
{
@@ -944,6 +954,7 @@ ndbm_map_lookup(map, name, av, statp)
datum key, val;
int fd;
char keybuf[MAXNAME + 1];
+ struct stat stbuf;
if (tTd(38, 20))
printf("ndbm_map_lookup(%s, %s)\n",
@@ -960,9 +971,40 @@ ndbm_map_lookup(map, name, av, statp)
makelower(keybuf);
key.dptr = keybuf;
}
+lockdbm:
fd = dbm_dirfno((DBM *) map->map_db1);
if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags))
(void) lockfile(fd, map->map_file, ".dir", LOCK_SH);
+ if (fd < 0 || fstat(fd, &stbuf) < 0 || stbuf.st_mtime > map->map_mtime)
+ {
+ /* Reopen the database to sync the cache */
+ int omode = bitset(map->map_mflags, MF_WRITABLE) ? O_RDWR
+ : O_RDONLY;
+
+ map->map_class->map_close(map);
+ map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
+ if (map->map_class->map_open(map, omode))
+ {
+ map->map_mflags |= MF_OPEN;
+ if ((omode && O_ACCMODE) == O_RDWR)
+ map->map_mflags |= MF_WRITABLE;
+ goto lockdbm;
+ }
+ else
+ {
+ if (!bitset(MF_OPTIONAL, map->map_mflags))
+ {
+ extern MAPCLASS BogusMapClass;
+
+ *statp = EX_TEMPFAIL;
+ map->map_class = &BogusMapClass;
+ map->map_mflags |= MF_OPEN;
+ syserr("Cannot reopen NDBM database %s",
+ map->map_file);
+ }
+ return NULL;
+ }
+ }
val.dptr = NULL;
if (bitset(MF_TRY0NULL, map->map_mflags))
{
@@ -2489,7 +2531,7 @@ ldap_map_lookup(map, name, av, statp)
filter, map->map_mname);
}
result = NULL;
- *statp = EX_UNAVAILABLE;
+ *statp = EX_TEMPFAIL;
goto quick_exit;
}
}
diff --git a/usr.sbin/sendmail/src/parseaddr.c b/usr.sbin/sendmail/src/parseaddr.c
index 75b90898f21..78318347043 100644
--- a/usr.sbin/sendmail/src/parseaddr.c
+++ b/usr.sbin/sendmail/src/parseaddr.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)parseaddr.c 8.130 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)parseaddr.c 8.132 (Berkeley) 10/20/97";
#endif /* not lint */
# include "sendmail.h"
@@ -1859,6 +1859,7 @@ struct qflags AddressFlags[] =
{ "QDELIVERED", QDELIVERED },
{ "QDELAYED", QDELAYED },
{ "QTHISPASS", QTHISPASS },
+ { "QRCPTOK", QRCPTOK },
{ NULL }
};
@@ -2136,7 +2137,11 @@ maplocaluser(a, sendq, aliaslevel, e)
}
pvp = prescan(a->q_user, '\0', pvpbuf, sizeof pvpbuf, &delimptr, NULL);
if (pvp == NULL)
+ {
+ if (tTd(29, 9))
+ printf("maplocaluser: cannot prescan %s\n", a->q_user);
return;
+ }
define('h', a->q_host, e);
define('u', a->q_user, e);
@@ -2144,17 +2149,25 @@ maplocaluser(a, sendq, aliaslevel, e)
if (rewrite(pvp, 5, 0, e) == EX_TEMPFAIL)
{
+ if (tTd(29, 9))
+ printf("maplocaluser: rewrite tempfail\n");
a->q_flags |= QQUEUEUP;
a->q_status = "4.4.3";
return;
}
if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
+ {
+ if (tTd(29, 9))
+ printf("maplocaluser: doesn't resolve\n");
return;
+ }
/* if non-null, mailer destination specified -- has it changed? */
a1 = buildaddr(pvp, NULL, 0, e);
if (a1 == NULL || sameaddr(a, a1))
{
+ if (tTd(29, 9))
+ printf("maplocaluser: address unchanged\n");
if (a1 != NULL)
free(a1);
return;
diff --git a/usr.sbin/sendmail/src/queue.c b/usr.sbin/sendmail/src/queue.c
index 1d812b8f50d..d48efb1179b 100644
--- a/usr.sbin/sendmail/src/queue.c
+++ b/usr.sbin/sendmail/src/queue.c
@@ -36,9 +36,9 @@
#ifndef lint
#if QUEUE
-static char sccsid[] = "@(#)queue.c 8.174 (Berkeley) 7/23/97 (with queueing)";
+static char sccsid[] = "@(#)queue.c 8.175 (Berkeley) 10/4/97 (with queueing)";
#else
-static char sccsid[] = "@(#)queue.c 8.174 (Berkeley) 7/23/97 (without queueing)";
+static char sccsid[] = "@(#)queue.c 8.175 (Berkeley) 10/4/97 (without queueing)";
#endif
#endif /* not lint */
@@ -474,7 +474,6 @@ printctladdr(a, tfp)
FILE *tfp;
{
char *uname;
- char *paddr;
register ADDRESS *q;
uid_t uid;
gid_t gid;
@@ -514,12 +513,12 @@ printctladdr(a, tfp)
lastuid = uid;
lastctladdr = a;
- paddr = denlstring(a->q_paddr, TRUE, FALSE);
if (uid == 0 || uname == NULL || uname[0] == '\0')
- fprintf(tfp, "C:%s\n", paddr);
+ fprintf(tfp, "C");
else
- fprintf(tfp, "C%s:%ld:%ld:%s\n",
- uname, (long) uid, (long) gid, paddr);
+ fprintf(tfp, "C%s:%ld:%ld",
+ denlstring(uname, TRUE, FALSE), (long) uid, (long) gid);
+ fprintf(tfp, ":%s\n", denlstring(a->q_paddr, TRUE, FALSE));
}
/*
** RUNQUEUE -- run the jobs in the queue.
diff --git a/usr.sbin/sendmail/src/readcf.c b/usr.sbin/sendmail/src/readcf.c
index a1e42387fa8..681c3d3a1d7 100644
--- a/usr.sbin/sendmail/src/readcf.c
+++ b/usr.sbin/sendmail/src/readcf.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)readcf.c 8.200 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)readcf.c 8.201 (Berkeley) 10/1/97";
#endif /* not lint */
# include "sendmail.h"
@@ -1521,6 +1521,10 @@ struct optioninfo
#define O_DONTLOCK 0xa5
{ "DontLockFilesForRead", O_DONTLOCK, FALSE },
#endif
+#if _FFR_MAXALIASRECURSION_OPTION
+#define O_MAXALIASRCSN 0xa6
+ { "MaxAliasRecursion", O_MAXALIASRCSN, FALSE },
+#endif
{ NULL, '\0', FALSE }
};
@@ -2355,6 +2359,12 @@ setoption(opt, val, safe, sticky, e)
break;
#endif
+#if _FFR_MAXALIASRECURSION_OPTION
+ case O_MAXALIASRCSN:
+ MaxAliasRecursion = atoi(val);
+ break;
+#endif
+
default:
if (tTd(37, 1))
{
diff --git a/usr.sbin/sendmail/src/recipient.c b/usr.sbin/sendmail/src/recipient.c
index 2076884f090..adcce7acf83 100644
--- a/usr.sbin/sendmail/src/recipient.c
+++ b/usr.sbin/sendmail/src/recipient.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)recipient.c 8.130 (Berkeley) 5/29/97";
+static char sccsid[] = "@(#)recipient.c 8.133 (Berkeley) 10/19/97";
#endif /* not lint */
# include "sendmail.h"
@@ -263,6 +263,7 @@ recipient(a, sendq, aliaslevel, e)
/* break aliasing loops */
if (aliaslevel > MaxAliasRecursion)
{
+ a->q_flags |= QBADADDR;
a->q_status = "5.4.6";
usrerr("554 aliasing/forwarding loop broken (%d aliases deep; %d max)",
aliaslevel, MaxAliasRecursion);
@@ -327,7 +328,7 @@ recipient(a, sendq, aliaslevel, e)
for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
{
- if (sameaddr(q, a))
+ if (sameaddr(q, a) && bitset(QRCPTOK, q->q_flags))
{
if (tTd(26, 1))
{
@@ -641,7 +642,7 @@ recipient(a, sendq, aliaslevel, e)
a->q_paddr);
}
}
-
+ a->q_flags |= QRCPTOK;
return (a);
}
/*
@@ -922,7 +923,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
volatile int sfflags = SFF_REGONLY;
register char *p;
bool safechown = FALSE;
- bool safedir = FALSE;
+ volatile bool safedir = FALSE;
struct stat st;
char buf[MAXLINE];
extern bool chownsafe();
diff --git a/usr.sbin/sendmail/src/savemail.c b/usr.sbin/sendmail/src/savemail.c
index 1d39df8c767..76209dcc40e 100644
--- a/usr.sbin/sendmail/src/savemail.c
+++ b/usr.sbin/sendmail/src/savemail.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.114 (Berkeley) 8/2/97";
+static char sccsid[] = "@(#)savemail.c 8.121 (Berkeley) 10/22/97";
#endif /* not lint */
# include "sendmail.h"
@@ -85,7 +85,6 @@ savemail(e, sendbody)
int flags;
char buf[MAXLINE+1];
extern char *ttypath();
- typedef int (*fnptr)();
extern bool writable();
if (tTd(6, 1))
@@ -254,8 +253,29 @@ savemail(e, sendbody)
}
if (!emptyaddr(&e->e_from))
{
- (void) sendtolist(e->e_from.q_paddr,
- NULLADDR, &e->e_errorqueue, 0, e);
+ char from[TOBUFSIZE];
+ extern bool pruneroute __P((char *));
+
+ if (strlen(e->e_from.q_paddr) + 1 > sizeof from)
+ {
+ state = ESM_POSTMASTER;
+ break;
+ }
+ strcpy(from, e->e_from.q_paddr);
+
+ if (!DontPruneRoutes && pruneroute(from))
+ {
+ ADDRESS *a;
+
+ for (a = e->e_errorqueue; a != NULL;
+ a = a->q_next)
+ {
+ if (sameaddr(a, &e->e_from))
+ a->q_flags |= QDONTSEND;
+ }
+ }
+ (void) sendtolist(from, NULLADDR,
+ &e->e_errorqueue, 0, e);
}
/*
@@ -379,7 +399,7 @@ savemail(e, sendbody)
break;
}
- flags = SFF_NOLINK|SFF_CREAT|SFF_REGONLY|SFF_OPENASROOT|SFF_MUSTOWN;
+ flags = SFF_NOLINK|SFF_CREAT|SFF_REGONLY|SFF_ROOTOK|SFF_OPENASROOT|SFF_MUSTOWN;
if (!writable(DeadLetterDrop, NULL, flags) ||
(fp = safefopen(DeadLetterDrop, O_WRONLY|O_APPEND,
FileMode, flags)) == NULL)
@@ -519,26 +539,12 @@ returntosender(msg, returnq, flags, e)
initsys(ee);
for (q = returnq; q != NULL; q = q->q_next)
{
- extern bool pruneroute __P((char *));
-
if (bitset(QBADADDR, q->q_flags))
continue;
q->q_flags &= ~(QHASNOTIFY|Q_PINGFLAGS);
q->q_flags |= QPINGONFAILURE;
- if (!DontPruneRoutes && pruneroute(q->q_paddr))
- {
- register ADDRESS *p;
-
- parseaddr(q->q_paddr, q, RF_COPYPARSE, '\0', NULL, e);
- for (p = returnq; p != NULL; p = p->q_next)
- {
- if (p != q && sameaddr(p, q))
- q->q_flags |= QDONTSEND;
- }
- }
-
if (!bitset(QDONTSEND, q->q_flags))
ee->e_nrcpts++;
@@ -650,7 +656,7 @@ returntosender(msg, returnq, flags, e)
return 0;
for (q = ee->e_sendqueue; q != NULL; q = q->q_next)
{
- if (bitset(QSENT, q->q_flags))
+ if (bitset(QQUEUEUP|QSENT, q->q_flags))
return 0;
}
return -1;
@@ -681,7 +687,7 @@ errbody(mci, e, separator)
{
register FILE *xfile;
char *p;
- register ADDRESS *q;
+ register ADDRESS *q = NULL;
bool printheader;
bool sendbody;
bool pm_notify;
@@ -1001,17 +1007,23 @@ errbody(mci, e, separator)
p = "rfc822";
for (r = q; r->q_alias != NULL; r = r->q_alias)
continue;
- if (strchr(r->q_user, '@') == NULL)
+ if (strchr(r->q_user, '@') != NULL)
{
(void) snprintf(buf, sizeof buf,
- "Final-Recipient: %s; %.700s@%.100s",
- p, r->q_user, MyHostName);
+ "Final-Recipient: %s; %.800s",
+ p, r->q_user);
}
- else
+ else if (strchr(r->q_paddr, '@') != NULL)
{
(void) snprintf(buf, sizeof buf,
"Final-Recipient: %s; %.800s",
- p, r->q_user);
+ p, r->q_paddr);
+ }
+ else
+ {
+ (void) snprintf(buf, sizeof buf,
+ "Final-Recipient: %s; %.700s@%.100s",
+ p, r->q_user, MyHostName);
}
putline(buf, mci);
diff --git a/usr.sbin/sendmail/src/sendmail.h b/usr.sbin/sendmail/src/sendmail.h
index 00559ea1dff..fc3bf4942ca 100644
--- a/usr.sbin/sendmail/src/sendmail.h
+++ b/usr.sbin/sendmail/src/sendmail.h
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)sendmail.h 8.242 (Berkeley) 8/2/97
+ * @(#)sendmail.h 8.245 (Berkeley) 10/22/97
*/
/*
@@ -41,7 +41,7 @@
# ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.242 8/2/97";
+static char SmailSccsId[] = "@(#)sendmail.h 8.245 10/22/97";
# endif
# else /* _DEFINE */
# define EXTERN extern
@@ -206,6 +206,7 @@ typedef struct address ADDRESS;
# define QDELIVERED 0x00040000 /* DSN: successful final delivery */
# define QDELAYED 0x00080000 /* DSN: message delayed */
# define QTHISPASS 0x40000000 /* temp: address set this pass */
+# define QRCPTOK 0x80000000 /* recipient() processed address */
# define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
@@ -928,6 +929,7 @@ EXTERN int NoRecipientAction;
#define PXLF_NOTHINGSPECIAL 0 /* no special mapping */
#define PXLF_MAPFROM 0x0001 /* map From_ to >From_ */
#define PXLF_STRIP8BIT 0x0002 /* strip 8th bit */
+#define PXLF_HEADER 0x0004 /* map newlines in headers */
/*
** Additional definitions
*/
@@ -1231,7 +1233,6 @@ EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */
EXTERN char *MustQuoteChars; /* quote these characters in phrases */
EXTERN char *ServiceSwitchFile; /* backup service switch */
EXTERN char *DefaultCharSet; /* default character set for MIME */
-EXTERN int DeliveryNiceness; /* how nice to be during delivery */
EXTERN char *PostMasterCopy; /* address to get errs cc's */
EXTERN int CheckpointInterval; /* queue file checkpoint interval */
EXTERN bool DontPruneRoutes; /* don't prune source routes */
diff --git a/usr.sbin/sendmail/src/srvrsmtp.c b/usr.sbin/sendmail/src/srvrsmtp.c
index 3255e83eeb8..cd47d5de916 100644
--- a/usr.sbin/sendmail/src/srvrsmtp.c
+++ b/usr.sbin/sendmail/src/srvrsmtp.c
@@ -36,9 +36,9 @@
#ifndef lint
#if SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.154 (Berkeley) 8/2/97 (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (with SMTP)";
#else
-static char sccsid[] = "@(#)srvrsmtp.c 8.154 (Berkeley) 8/2/97 (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (without SMTP)";
#endif
#endif /* not lint */
@@ -153,7 +153,7 @@ smtp(nullserver, e)
volatile int n_noop = 0; /* count of NOOP/VERB/ONEX etc cmds */
volatile int n_helo = 0; /* count of HELO/EHLO commands */
bool ok;
- int lognullconnection = TRUE;
+ volatile int lognullconnection = TRUE;
register char *q;
char inp[MAXLINE];
char cmdbuf[MAXLINE];
@@ -252,6 +252,18 @@ smtp(nullserver, e)
sm_syslog(LOG_NOTICE, e->e_id,
"lost input channel from %.100s",
CurSmtpClient);
+ if (lognullconnection && LogLevel > 5)
+ sm_syslog(LOG_INFO, NULL,
+ "Null connection from %.100s",
+ CurSmtpClient);
+
+ /*
+ ** If have not accepted mail (DATA), do not bounce
+ ** bad addresses back to sender.
+ */
+ if (bitset(EF_CLRQUEUE, e->e_flags))
+ e->e_sendqueue = NULL;
+
if (InChild)
ExitStat = EX_QUIT;
finis();
@@ -872,6 +884,7 @@ smtp(nullserver, e)
shortenstring(inp, 203));
if (setjmp(TopFrame) > 0)
goto undo_subproc;
+ QuickAbort = TRUE;
vrfyqueue = NULL;
if (vrfy)
e->e_flags |= EF_VRFYONLY;
@@ -917,16 +930,17 @@ smtp(nullserver, e)
/* crude way to avoid denial-of-service attacks */
checksmtpattack(&n_etrn, MAXETRNCOMMANDS, "ETRN", e);
+ if (LogLevel > 5)
+ sm_syslog(LOG_INFO, e->e_id,
+ "%.100s: ETRN %s",
+ CurSmtpClient,
+ shortenstring(p, 203));
+
id = p;
if (*id == '@')
id++;
else
*--id = '@';
- if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: ETRN %s",
- CurSmtpClient,
- shortenstring(id, 203));
QueueLimitRecipient = id;
ok = runqueue(TRUE, TRUE);
QueueLimitRecipient = NULL;
diff --git a/usr.sbin/sendmail/src/usersmtp.c b/usr.sbin/sendmail/src/usersmtp.c
index 475a0dc2aa2..b088d608943 100644
--- a/usr.sbin/sendmail/src/usersmtp.c
+++ b/usr.sbin/sendmail/src/usersmtp.c
@@ -36,9 +36,9 @@
#ifndef lint
#if SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.87 (Berkeley) 6/3/97 (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.88 (Berkeley) 10/20/97 (with SMTP)";
#else
-static char sccsid[] = "@(#)usersmtp.c 8.87 (Berkeley) 6/3/97 (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.88 (Berkeley) 10/20/97 (without SMTP)";
#endif
#endif /* not lint */
@@ -60,7 +60,6 @@ static char sccsid[] = "@(#)usersmtp.c 8.87 (Berkeley) 6/3/97 (without SMTP)";
char SmtpMsgBuffer[MAXLINE]; /* buffer for commands */
char SmtpReplyBuffer[MAXLINE]; /* buffer for replies */
char SmtpError[MAXLINE] = ""; /* save failure error messages */
-int SmtpPid; /* pid of mailer */
bool SmtpNeedIntro; /* need "while talking" in transcript */
extern void smtpmessage __P((char *f, MAILER *m, MCI *mci, ...));
diff --git a/usr.sbin/sendmail/src/util.c b/usr.sbin/sendmail/src/util.c
index 36592a007a8..2e5aebe6e6c 100644
--- a/usr.sbin/sendmail/src/util.c
+++ b/usr.sbin/sendmail/src/util.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)util.c 8.133 (Berkeley) 8/1/97";
+static char sccsid[] = "@(#)util.c 8.137 (Berkeley) 10/22/97";
#endif /* not lint */
# include "sendmail.h"
@@ -520,6 +520,7 @@ putline(l, mci)
** pxflags -- flag bits:
** PXLF_MAPFROM -- map From_ to >From_.
** PXLF_STRIP8BIT -- strip 8th bit.
+** PXLF_HEADER -- map bare newline in header to newline space.
**
** Returns:
** none
@@ -626,7 +627,8 @@ putxline(l, len, mci, pxflags)
fputs(mci->mci_mailer->m_eol, mci->mci_out);
if (l < end && *l == '\n')
{
- if (*++l != ' ' && *l != '\t' && *l != '\0')
+ if (*++l != ' ' && *l != '\t' && *l != '\0' &&
+ bitset(PXLF_HEADER, pxflags))
{
(void) putc(' ', mci->mci_out);
if (TrafficLogFile != NULL)
@@ -1058,7 +1060,6 @@ checkfd012(where)
{
#if XDEBUG
register int i;
- struct stat stbuf;
for (i = 0; i < 3; i++)
fill_fd(i, where);
@@ -1199,7 +1200,6 @@ dumpfd(fd, printclosed, logit)
int i;
struct stat st;
char buf[200];
- extern char *hostnamebyanyaddr();
p = buf;
snprintf(p, SPACELEFT(buf, p), "%3d: ", fd);
@@ -1311,7 +1311,7 @@ defprint:
printit:
if (logit)
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
+ sm_syslog(LOG_DEBUG, CurEnv ? CurEnv->e_id : NULL,
"%.800s", buf);
else
printf("%s\n", buf);
diff --git a/usr.sbin/sendmail/src/version.c b/usr.sbin/sendmail/src/version.c
index c531c5bdf07..dc041baa38a 100644
--- a/usr.sbin/sendmail/src/version.c
+++ b/usr.sbin/sendmail/src/version.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)version.c 8.8.7.3 (Berkeley) 8/3/97";
+static char sccsid[] = "@(#)version.c 8.8.8.1 (Berkeley) 10/24/97";
#endif /* not lint */
-char Version[] = "8.8.7";
+char Version[] = "8.8.8";
diff --git a/usr.sbin/sendmail/test/t_exclopen.c b/usr.sbin/sendmail/test/t_exclopen.c
index 54f7873f4b3..a42baa93cd0 100644
--- a/usr.sbin/sendmail/test/t_exclopen.c
+++ b/usr.sbin/sendmail/test/t_exclopen.c
@@ -19,6 +19,8 @@
** HP-UX 10.20 OK
** Irix 5.3 OK
** Irix 6.2 OK
+** Irix 6.3 OK
+** Irix 6.4 OK
** Linux OK
** NeXT 2.1 OK
** Solaris 2.x OK