summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sendmail
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-12-03 06:07:35 +0000
committerpeter <peter@FreeBSD.org>1996-12-03 06:07:35 +0000
commitfe7a1e47bd429b92884cb10fd00713b54d052423 (patch)
treebce2798bf44cebaae1f172024373b9756aa4db09 /usr.sbin/sendmail
parent8e0d5faaa77159b266e4ab922edf43a79f52e0c0 (diff)
downloadFreeBSD-src-fe7a1e47bd429b92884cb10fd00713b54d052423.zip
FreeBSD-src-fe7a1e47bd429b92884cb10fd00713b54d052423.tar.gz
Import sendmail 8.8.4. See RELEASE_NOTES for changes.
Diffstat (limited to 'usr.sbin/sendmail')
-rw-r--r--usr.sbin/sendmail/RELEASE_NOTES103
-rw-r--r--usr.sbin/sendmail/cf/m4/cfhead.m46
-rw-r--r--usr.sbin/sendmail/cf/m4/proto.m46
-rw-r--r--usr.sbin/sendmail/cf/m4/version.m44
-rw-r--r--usr.sbin/sendmail/cf/ostype/mklinux.m44
-rwxr-xr-xusr.sbin/sendmail/contrib/etrn.pl301
-rw-r--r--usr.sbin/sendmail/doc/op/op.me16
-rw-r--r--usr.sbin/sendmail/mail.local/mail.local.c4
-rw-r--r--usr.sbin/sendmail/makemap/makemap.c3
-rw-r--r--usr.sbin/sendmail/src/READ_ME25
-rw-r--r--usr.sbin/sendmail/src/clock.c30
-rw-r--r--usr.sbin/sendmail/src/collect.c28
-rw-r--r--usr.sbin/sendmail/src/conf.c129
-rw-r--r--usr.sbin/sendmail/src/conf.h32
-rw-r--r--usr.sbin/sendmail/src/convtime.c5
-rw-r--r--usr.sbin/sendmail/src/daemon.c285
-rw-r--r--usr.sbin/sendmail/src/deliver.c132
-rw-r--r--usr.sbin/sendmail/src/envelope.c10
-rw-r--r--usr.sbin/sendmail/src/err.c6
-rw-r--r--usr.sbin/sendmail/src/headers.c22
-rw-r--r--usr.sbin/sendmail/src/main.c56
-rw-r--r--usr.sbin/sendmail/src/makesendmail9
-rw-r--r--usr.sbin/sendmail/src/map.c11
-rw-r--r--usr.sbin/sendmail/src/mci.c82
-rw-r--r--usr.sbin/sendmail/src/mime.c7
-rw-r--r--usr.sbin/sendmail/src/parseaddr.c11
-rw-r--r--usr.sbin/sendmail/src/queue.c86
-rw-r--r--usr.sbin/sendmail/src/readcf.c14
-rw-r--r--usr.sbin/sendmail/src/recipient.c25
-rw-r--r--usr.sbin/sendmail/src/savemail.c6
-rw-r--r--usr.sbin/sendmail/src/sendmail.h19
-rw-r--r--usr.sbin/sendmail/src/srvrsmtp.c34
-rw-r--r--usr.sbin/sendmail/src/stab.c4
-rw-r--r--usr.sbin/sendmail/src/udb.c38
-rw-r--r--usr.sbin/sendmail/src/usersmtp.c37
-rw-r--r--usr.sbin/sendmail/src/util.c51
-rw-r--r--usr.sbin/sendmail/src/version.c4
-rw-r--r--usr.sbin/sendmail/test/Results2
38 files changed, 1201 insertions, 446 deletions
diff --git a/usr.sbin/sendmail/RELEASE_NOTES b/usr.sbin/sendmail/RELEASE_NOTES
index 203b61a..621cbcc 100644
--- a/usr.sbin/sendmail/RELEASE_NOTES
+++ b/usr.sbin/sendmail/RELEASE_NOTES
@@ -1,11 +1,110 @@
SENDMAIL RELEASE NOTES
- @(#)RELEASE_NOTES 8.8.3.2 (Berkeley) 11/16/96
+ @(#)RELEASE_NOTES 8.8.4.4 (Berkeley) 12/2/96
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.4/8.8.4 96/12/02
+ SECURITY: under some circumstances, an attacker could get additional
+ permissions by hard linking to files that were group
+ writable by the attacker. The solution is to disallow any
+ files that have hard links -- this will affect .forward,
+ :include:, and output files. Problem noted by Terry
+ Kyriacopoulos of Interlog Internet Services. As a
+ workaround, set UnsafeGroupWrites -- always a good idea.
+ SECURITY: the TryNullMXList (w) option should not be safe -- if it
+ is, it is possible to do a denial-of-service attack on
+ MX hosts that rely on the use of the null MX list. There
+ is no danger if you have this option turned off (the default).
+ Problem noted by Dan Bernstein. Also, make the DontInitGroups
+ unsafe. I know of no specific attack against this, although
+ a denial-of-service attack is probably possible, but in theory
+ you should not be able to safely tweak anything that affects
+ the permissions that are used when mail is delivered.
+ Purgestat could go into an infinite loop if one of the host status
+ directories somehow became empty. Problem noted by Roy
+ Mongiovi of Georgia Tech.
+ Processes got "lost" when counting children due to a race condition.
+ This caused "proc_list_probe: lost pid" messages to be logged.
+ Problem noted by several people.
+ On systems with System V SIGCLD child signal semantics (notably AIX
+ and HP-UX), mail transactions would print the message "451
+ SMTP-MAIL: lost child: No child processes". Problem noted
+ by several people.
+ Miscellaneous compiler warnings on picky compilers (or when setting
+ gcc to high warning levels). From Tom Moore of NCR Corp.
+ SMTP protocol errors, and most errors on MAIL FROM: lines should
+ not be persistent between runs, since they are based on the
+ message rather than the host. Problem noted by Matt Dillon
+ of Best Internet Communications.
+ The F=7 flag was ignored on SMTP mailers. Problem noted by Tom Moore
+ of NCR (a.k.a., AT&T Global Information Solutions).
+ Avoid the possibility of having a child daemon run to completion
+ (including closing the SMTP socket) before the parent has
+ had a chance to close the socket; this can cause the parent
+ to hang for a long time waiting for the socket to drain.
+ Patch from Don Lewis of TDK Semiconductor.
+ If the fork() failed in a queue run, the queue runners would not be
+ rescheduled (so queue runs would stop). Patch from Don Lewis.
+ Some error conditions in ETRN could cause output without an SMTP
+ status code. Problem noted by Don Lewis.
+ Multiple :maildrop addresses in the user database didn't work properly.
+ Patch from Roy Mongiovi of Georgia Tech.
+ Add ".db" automatically onto any user database spec that does not
+ already have it; this is for consistency with makemap, the
+ K line, and the documentation. Inconsistency pointed out
+ by Roy Mongiovi.
+ Allow sendmail to be properly called in nohup mode. Patch from
+ Kyle Jones of UUNET.
+ Change ETRN to ignore but still update host status files; previously
+ it would ignore them and not save the updated status, which
+ caused stale information to be maintained. Based on a patch
+ from Christopher Davis of Kapor Enterprises Inc. Also, have
+ ETRN ignore the MinQueueAge option.
+ Patch long term host status to recover more gracefully from an empty
+ host status file condition. Patch from NAKAMURA Motonori
+ of Kyoto University.
+ Several patches to signal handling code to fix potential race
+ conditions from Don Lewis.
+ Make it possible to compile with -DDAEMON=0 (previously it had some
+ compile errors). This turns DAEMON, QUEUE, and SMTP into
+ 0/1 compilation flags. Note that DAEMON is an obsolete
+ compile flag; use NETINET instead. Solution based on a
+ patch from Bryan Costales.
+ PORTABILITY FIXES:
+ AIX4: getpwnam() and getpwuid() do a sequential scan of the
+ /etc/security/passwd file when called as root. This
+ is very slow on some systems. To speed it up, use the
+ (undocumented) _getpw{nam,uid}_shadow() routines.
+ Patch from Chris Thomas of UCLA/OAC Systems Group.
+ SCO 5.x: include -lprot in the Makefile. Patch from Bill
+ Glicker of Burrelle's Information Service.
+ NEWS-OS 4.x: need a definition for MODE_T to compile. Patch
+ from Makoto MATSUSHITA of Osaka University.
+ SunOS 4.0.3: compile problems. Patches from Andrew Cole of
+ Leeds University and SASABE Tetsuro of the University
+ of Tokyo.
+ DG/UX 5.4.4.11 from Brian J. Murrell of InterLinx Support
+ Services, Inc.
+ Domain/OS from Don (Truck) Lewis of TDK Semiconductor Corp.
+ I believe this to have only been a problem if you
+ compiled with -DUSE_VENDOR_CF_PATH -- another reason
+ to stick with /etc/sendmail.cf as your One True Path.
+ Digital UNIX (OSF/1 on Alpha) load average computation from
+ Martin Laubach of the Technischen Universität Wien.
+ CONFIG: change default Received: line to be multiple lines rather
+ than one long one. By popular demand.
+ MAIL.LOCAL: warnings weren't being logged on some systems. Patch
+ from Jerome Berkman of U.C. Berkeley.
+ MAKEMAP: be sure to zero hinfo to avoid cruft that can cause runs
+ to take a very long time. Problem noted by Yoshiro YONEYA
+ of NTT Software Corporation.
+ CONTRIB: add etrn.pl, contributed by John Beck.
+ NEW FILES:
+ contrib/etrn.pl
+
8.8.3/8.8.3 96/11/17
SECURITY: it was possible to get a root shell by lying to sendmail
about argv[0] and then sending it a signal. Problem noted
@@ -83,7 +182,7 @@ summary of the changes in that release.
AIX4: use tzname[] vector to determine time zone name.
Patch from NAKAMURA Motonori of Kyoto University.
MkLinux: add Makefile.Linux.ppc and OSTYPE(mklinux) support.
- Contributed by Paul DeBois <dubois@primate.wisc.edu>.
+ Contributed by Paul DuBois <dubois@primate.wisc.edu>.
Solaris: kstat(3k) support for retrieving the load average.
This adds the LA_KSTAT definition for LA_TYPE.
The outline of the implementation was contributed
diff --git a/usr.sbin/sendmail/cf/m4/cfhead.m4 b/usr.sbin/sendmail/cf/m4/cfhead.m4
index f152572..91d4b9a 100644
--- a/usr.sbin/sendmail/cf/m4/cfhead.m4
+++ b/usr.sbin/sendmail/cf/m4/cfhead.m4
@@ -128,7 +128,9 @@ define(`confMAILER_NAME', ``MAILER-DAEMON'')
define(`confFROM_LINE', `From $g $d')
define(`confOPERATORS', `.:%@!^/[]+')
define(`confSMTP_LOGIN_MSG', `$j Sendmail $v/$Z; $b')
-define(`confRECEIVED_HEADER', `$?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b')
+define(`confRECEIVED_HEADER', `$?sfrom $s $.$?_($?s$|from $.$_)
+ $.by $j ($v/$Z)$?r with $r$.
+ id $i$?u for $u$.; $b')
define(`confSEVEN_BIT_INPUT', `False')
define(`confEIGHT_BIT_HANDLING', `pass8')
define(`confALIAS_WAIT', `10')
@@ -154,4 +156,4 @@ define(`confMIME_FORMAT_ERRORS', `True')
define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')
divert(0)dnl
-VERSIONID(`@(#)cfhead.m4 8.6 (Berkeley) 6/19/96')
+VERSIONID(`@(#)cfhead.m4 8.7 (Berkeley) 11/20/96')
diff --git a/usr.sbin/sendmail/cf/m4/proto.m4 b/usr.sbin/sendmail/cf/m4/proto.m4
index 474dc7d..676aa35 100644
--- a/usr.sbin/sendmail/cf/m4/proto.m4
+++ b/usr.sbin/sendmail/cf/m4/proto.m4
@@ -34,7 +34,7 @@ divert(-1)
#
divert(0)
-VERSIONID(`@(#)proto.m4 8.135 (Berkeley) 10/26/96')
+VERSIONID(`@(#)proto.m4 8.136 (Berkeley) 11/24/96')
MAILER(local)dnl
@@ -428,7 +428,7 @@ _OPTION(OperatorChars, `confOPERATORS')
# shall I avoid calling initgroups(3) because of high NIS costs?
_OPTION(DontInitGroups, `confDONT_INIT_GROUPS')
-# are group-writable :include: and .forward files (un)trustworthy?
+# are group-writable `:include:' and .forward files (un)trustworthy?
_OPTION(UnsafeGroupWrites, `confUNSAFE_GROUP_WRITES')
# where do errors that occur when sending errors get sent?
@@ -635,7 +635,7 @@ ifdef(`_USE_DECNET_SYNTAX_',
R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u',
`dnl')
# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $j u%host@host => u@host
+R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
diff --git a/usr.sbin/sendmail/cf/m4/version.m4 b/usr.sbin/sendmail/cf/m4/version.m4
index 0fe40a9..b3ee9a7 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.3.1 (Berkeley) 11/16/96')
+VERSIONID(`@(#)version.m4 8.8.4.2 (Berkeley) 11/26/96')
#
divert(0)
# Configuration version number
-DZ8.8.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.8.4`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/usr.sbin/sendmail/cf/ostype/mklinux.m4 b/usr.sbin/sendmail/cf/ostype/mklinux.m4
index 1da5928..00adedb 100644
--- a/usr.sbin/sendmail/cf/ostype/mklinux.m4
+++ b/usr.sbin/sendmail/cf/ostype/mklinux.m4
@@ -32,11 +32,11 @@ divert(-1)
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# MkLinux support contributed by Paul DeBois <dubois@primate.wisc.edu>
+# MkLinux support contributed by Paul DuBois <dubois@primate.wisc.edu>
#
divert(0)
-VERSIONID(`@(#)mklinux.m4 8.1 (Berkeley) 10/30/96')
+VERSIONID(`@(#)mklinux.m4 8.2 (Berkeley) 11/17/96')
ifdef(`STATUS_FILE',,
`define(`STATUS_FILE', /var/log/sendmail.st)')
ifdef(`PROCMAIL_MAILER_PATH',,
diff --git a/usr.sbin/sendmail/contrib/etrn.pl b/usr.sbin/sendmail/contrib/etrn.pl
new file mode 100755
index 0000000..b5fcc27
--- /dev/null
+++ b/usr.sbin/sendmail/contrib/etrn.pl
@@ -0,0 +1,301 @@
+#!/usr/local/bin/perl
+'di ';
+'ds 00 \\"';
+'ig 00 ';
+#
+# THIS PROGRAM IS ITS OWN MANUAL PAGE. INSTALL IN man & bin.
+#
+
+# hardcoded constants, should work fine for BSD-based systems
+require 'sys/socket.ph';
+$sockaddr = 'S n a4 x8';
+
+# system requirements:
+# must have 'hostname' program.
+
+#############################################################################
+# Copyright (c) 1996 John T. Beck <john@beck.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by John T. Beck.
+# 4. The name of John Beck may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY JOHN T. BECK ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL JOHN T. BECK BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This copyright notice derived from material copyrighted by the Regents
+# of the University of California.
+#
+# Contributions accepted.
+#############################################################################
+# Further disclaimer: the etrn.pl script was highly leveraged from the
+# expn.pl script which is (C) 1993 David Muir Sharnoff.
+#############################################################################
+
+$port = 'smtp';
+$av0 = $0;
+select(STDERR);
+
+$0 = "$av0 - running hostname";
+chop($name = `hostname || uname -n`);
+
+$0 = "$av0 - lookup host FQDN and IP addr";
+($hostname,$aliases,$type,$len,$thisaddr) = gethostbyname($name);
+
+push(@hosts,$hostname);
+
+$0 = "$av0 - parsing sendmail.cf";
+open(CF, "</etc/sendmail.cf") || die "open /etc/sendmail.cf: $!";
+while (<CF>){
+ if (/^Fw.*$/){ # look for a line starting with "Fw"
+ $cwfile = $_;
+ chop($cwfile);
+ $optional = /^Fw-o/;
+ $cwfile =~ s,^Fw[^/]*,,; # extract the file name
+ }
+}
+close(CF);
+
+$0 = "$av0 - reading $cwfile";
+if (open(CW, "<$cwfile")){
+ while (<CW>){
+ $thishost = $_;
+ chop($thishost);
+ push(@hosts, $thishost) unless $thishost =~ $hostname;
+ }
+ close(CW);
+} else {
+ die "open $cwfile: $!" unless optional;
+}
+
+$0 = "$av0 - parsing args";
+$usage = "Usage: $av0 [-wd] host";
+for $a (@ARGV) {
+ die $usage if $a eq "-";
+ while ($a =~ s/^(-.*)([wd])/$1/) {
+ eval '$'."flag_$2 += 1";
+ }
+ next if $a eq "-";
+ die $usage if $a =~ /^-/;
+ $server = $a;
+}
+$watch = $flag_w;
+$debug = $flag_d;
+
+die $usage unless $server;
+
+$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);
+
+# look it up
+$0 = "$av0 - gethostbyname($server)";
+
+($name,$aliases,$type,$len,$thataddr) = gethostbyname($server);
+
+# get a connection
+$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)) {
+ $0 = "$av0 - $server: could not connect: $!\n";
+}
+select((select(S),$| = 1)[0]); # don't buffer output to S
+
+# read the greeting
+$0 = "$av0 - talking to $server";
+&alarm("greeting with $server",'');
+while(<S>) {
+ alarm(0);
+ print if $watch;
+ if (/^(\d+)([- ])/) {
+ if ($1 != 220) {
+ $0 = "$av0 - bad numeric response from $server";
+ &alarm("giving up after bad response from $server",'');
+ &read_response($2,$watch);
+ alarm(0);
+ print STDERR "$server: NOT 220 greeting: $_"
+ if ($debug || $watch);
+ }
+ last if ($2 eq " ");
+ } else {
+ $0 = "$av0 - bad response from $server";
+ print STDERR "$server: NOT 220 greeting: $_"
+ if ($debug || $watch);
+ close(S);
+ }
+ &alarm("greeting with $server",'');
+}
+alarm(0);
+
+# if this causes problems, remove it
+$0 = "$av0 - sending helo to $server";
+&alarm("sending ehlo to $server","");
+&ps("ehlo $hostname");
+$etrn_support = 0;
+while(<S>) {
+ if (/^250([- ])ETRN(.+)$/){
+ $etrn_support = 1;
+ }
+ print if $watch;
+ last if /^\d+ /;
+}
+alarm(0);
+
+if ($etrn_support){
+ print "ETRN supported\n" if ($debug)
+ &alarm("sending etrn to $server",'');
+ while (@hosts) {
+ $server = shift(@hosts);
+ &ps("etrn $server");
+ while(<S>) {
+ print if $watch;
+ last if /^\d+ /;
+ }
+ sleep(1);
+ }
+} else {
+ print "\nETRN not supported\n\n"
+}
+
+&alarm("sending 'quit' to $server",'');
+$0 = "$av0 - sending 'quit' to $server";
+&ps("quit");
+while(<S>) {
+ print if $watch;
+ last if /^\d+ /;
+}
+close(S);
+alarm(0);
+
+select(STDOUT);
+exit(0);
+
+# print to the server (also to stdout, if -w)
+sub ps
+{
+ local($p) = @_;
+ print ">>> $p\n" if $watch;
+ print S "$p\n";
+}
+
+sub alarm
+{
+ local($alarm_action,$alarm_redirect,$alarm_user) = @_;
+ alarm(3600);
+ $SIG{ALRM} = 'handle_alarm';
+}
+
+sub handle_alarm
+{
+ &giveup($alarm_redirect,"Timed out during $alarm_action",$alarm_user);
+}
+
+# read the rest of the current smtp daemon's response (and toss it away)
+sub read_response
+{
+ local($done,$watch) = @_;
+ local(@resp);
+ print $s if $watch;
+ while(($done eq "-") && ($s = <S>) && ($s =~ /^\d+([- ])/)) {
+ print $s if $watch;
+ $done = $1;
+ push(@resp,$s);
+ }
+ return @resp;
+}
+# to pass perl -w:
+@tp;
+$flag_a;
+$flag_d;
+&handle_alarm;
+################### BEGIN PERL/TROFF TRANSITION
+.00 ;
+
+'di
+.nr nl 0-1
+.nr % 0
+.\\"'; __END__
+.\" ############## END PERL/TROFF TRANSITION
+.TH ETRN 1 "November 16, 1996"
+.AT 3
+.SH NAME
+etrn \- start mail queue run
+.SH SYNOPSIS
+.B etrn
+.RI [ -w ]
+.RI [ -d ]
+.IR hostname
+.SH DESCRIPTION
+.B etrn
+will use the SMTP
+.B etrn
+command to start mail delivery from the host given on the command line.
+.SH OPTIONS
+.LP
+The normal mode of operation for
+.B etrn
+is to do all of its work silently.
+The following options make it more verbose.
+It is not necessary to make it verbose to see what it is
+doing because as it works, it changes its
+.BR argv [0]
+variable to reflect its current activity.
+The
+.IR -w ,
+watch, flag will cause
+.B etrn
+to show you its conversations with the mail daemons.
+The
+.IR -d ,
+debug, flag will expose many of the inner workings so that
+it is possible to eliminate bugs.
+.SH ENVIRONMENT
+No enviroment variables are used.
+.SH FILES
+.B /etc/sendmail.cf
+.SH SEE ALSO
+.BR sendmail (8),
+RFC 1985.
+.SH BUGS
+Not all mail daemons will implement
+.B etrn .
+.LP
+It is assumed that you are running domain names.
+.SH CREDITS
+Leveraged from David Muir Sharnoff's expn.pl script.
+.SH AVAILABILITY
+The latest version of
+.B etrn
+is available in the contrib directory of the sendmail
+distribution through anonymous ftp at
+.IR ftp://ftp.sendmail.org/ucb/src/sendmail/ .
+.SH AUTHOR
+.I John T. Beck\ \ \ \ <john@beck.org>
diff --git a/usr.sbin/sendmail/doc/op/op.me b/usr.sbin/sendmail/doc/op/op.me
index 4bbcf88..4237497 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.98 (Berkeley) 11/16/96
+.\" @(#)op.me 8.100 (Berkeley) 12/1/96
.\"
.\" eqn op.me | pic | troff -me
.eh 'SMM:08-%''Sendmail Installation and Operation Guide'
@@ -68,7 +68,7 @@ Eric Allman
InReference, Inc.
eric@Sendmail.ORG
.sp
-Version 8.98
+Version 8.100
.sp
For Sendmail Version 8.8
.)l
@@ -5845,7 +5845,7 @@ to the list of recognized vendors by editing the routine
.i setvendor
in
.i conf.c .
-Please send e-mail to sendmail@CS.Berkeley.EDU
+Please send e-mail to sendmail@Sendmail.ORG
to register your vendor dialect.
.)f
You may use
@@ -6619,12 +6619,12 @@ you can set this flag to turn off special processing
of UNIX-style
.q "From "
lines.
-.ip QUEUE
+.ip QUEUE\(dg
This flag should be set to compile in the queueing code.
If this is not set,
mailers must accept the mail immediately
or it will be returned to the sender.
-.ip SMTP
+.ip SMTP\(dg
If set,
the code to handle user and server SMTP will be compiled in.
This is only necessary if your machine has some mailer
@@ -7156,7 +7156,7 @@ If you are porting to a new environment
you may need to add some new tweaks.\**
.(f
\**If you do, please send updates to
-sendmail@CS.Berkeley.EDU.
+sendmail@Sendmail.ORG.
.)f
.sh 2 "Configuration in src/daemon.c"
.pp
@@ -7686,7 +7686,7 @@ I appreciate their contribution as well.
.pp
Special thanks are reserved for Michael Corrigan and Christophe Wolfhugel,
who besides being wonderful guinea pigs and contributors
-have also consented to be added to the ``sendmail@CS.Berkeley.EDU'' list
+have also consented to be added to the ``sendmail@Sendmail.ORG'' list
and, by answering the bulk of the questions sent to that list,
have freed me up to do other work.
.++ A
@@ -8150,7 +8150,7 @@ A transcript of the current session.
.\"Eric Allman
.\"InReference, Inc.
.\".sp
-.\"Version 8.98
+.\"Version 8.100
.\".ce 0
.bp 2
.rs
diff --git a/usr.sbin/sendmail/mail.local/mail.local.c b/usr.sbin/sendmail/mail.local/mail.local.c
index 1f28229..32c5eba 100644
--- a/usr.sbin/sendmail/mail.local/mail.local.c
+++ b/usr.sbin/sendmail/mail.local/mail.local.c
@@ -38,7 +38,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mail.local.c 8.33 (Berkeley) 11/13/96";
+static char sccsid[] = "@(#)mail.local.c 8.34 (Berkeley) 11/24/96";
#endif /* not lint */
/*
@@ -646,7 +646,7 @@ vwarn(fmt, ap)
{
char fmtbuf[10240];
- (void) sprintf(fmtbuf, fmt, ap);
+ (void) vsprintf(fmtbuf, fmt, ap);
syslog(LOG_ERR, "%s", fmtbuf);
}
#endif
diff --git a/usr.sbin/sendmail/makemap/makemap.c b/usr.sbin/sendmail/makemap/makemap.c
index 5ac2df6..2e289a8 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.18 (Berkeley) 11/13/96";
+static char sccsid[] = "@(#)makemap.c 8.19 (Berkeley) 11/18/96";
#endif /* not lint */
#include <stdio.h>
@@ -237,6 +237,7 @@ main(argc, argv)
break;
case T_HASH:
+ bzero(&hinfo, sizeof hinfo);
if (allowreplace)
putflags = 0;
else
diff --git a/usr.sbin/sendmail/src/READ_ME b/usr.sbin/sendmail/src/READ_ME
index afeac1b..72e9a18 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.130 (Berkeley) 11/10/96
+# @(#)READ_ME 8.132 (Berkeley) 12/1/96
#
This directory contains the source files for sendmail.
@@ -175,6 +175,10 @@ LDAPMAP Lightweight Directory Lookup Protocol support. You will
>>> OVERRIDE calls to ndbm routines -- in particular, if you leave ndbm.h
>>> in, you can find yourself using the new db package even if you don't
>>> define NEWDB.
+>>>
+>>> Further note: DO NOT remove your existing /usr/include/ndbm.h --
+>>> you need that one. But do not install an updated ndbm.h in
+>>> /usr/include, /usr/local/include, or anywhere else.
If NEWDB and NDBM are defined (but not NIS), then sendmail will read
NDBM format alias files, but the next time a newaliases is run the
@@ -790,6 +794,23 @@ Ultrix
IDENT on in the configuration file by setting the "ident" timeout
to 30 seconds.
+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:
+
+ 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 file in the
+ obj.SunOS.5.5.1.* directory that reads:
+
+ #undef __P
+ #include "/usr/include/resolv.h"
+
+ ... And then file a bug report with Sun.
+
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
@@ -1377,4 +1398,4 @@ version.c The version number and information about this
Eric Allman
-(Version 8.130, last update 11/10/96 11:15:30)
+(Version 8.132, last update 12/1/96 09:34:37)
diff --git a/usr.sbin/sendmail/src/clock.c b/usr.sbin/sendmail/src/clock.c
index 39862f1..281ee60 100644
--- a/usr.sbin/sendmail/src/clock.c
+++ b/usr.sbin/sendmail/src/clock.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)clock.c 8.13 (Berkeley) 2/21/96";
+static char sccsid[] = "@(#)clock.c 8.16 (Berkeley) 11/27/96";
#endif /* not lint */
# include "sendmail.h"
@@ -98,8 +98,8 @@ setevent(intvl, func, arg)
*evp = ev;
if (tTd(5, 5))
- printf("setevent: intvl=%ld, for=%ld, func=%x, arg=%d, ev=%x\n",
- intvl, now + intvl, func, arg, ev);
+ printf("setevent: intvl=%ld, for=%ld, func=%lx, arg=%d, ev=%lx\n",
+ intvl, now + intvl, (u_long) func, arg, (u_long) ev);
tick(0);
return (ev);
@@ -124,7 +124,7 @@ clrevent(ev)
register EVENT **evp;
if (tTd(5, 5))
- printf("clrevent: ev=%x\n", ev);
+ printf("clrevent: ev=%lx\n", (u_long) ev);
if (ev == NULL)
return;
@@ -191,8 +191,9 @@ tick(arg)
ev = EventQueue;
EventQueue = EventQueue->ev_link;
if (tTd(5, 6))
- printf("tick: ev=%x, func=%x, arg=%d, pid=%d\n", ev,
- ev->ev_func, ev->ev_arg, ev->ev_pid);
+ printf("tick: ev=%lx, func=%lx, arg=%d, pid=%d\n",
+ (u_long) ev, (u_long) ev->ev_func,
+ ev->ev_arg, ev->ev_pid);
/* we must be careful in here because ev_func may not return */
f = ev->ev_func;
@@ -211,17 +212,7 @@ tick(arg)
/* restore signals so that we can take ticks while in ev_func */
(void) setsignal(SIGALRM, tick);
-#ifdef SIG_UNBLOCK
- /* unblock SIGALRM signal */
- sigemptyset(&ss);
- sigaddset(&ss, SIGALRM);
- sigprocmask(SIG_UNBLOCK, &ss, NULL);
-#else
-#if HASSIGSETMASK
- /* reset 4.2bsd signal mask to allow future alarms */
- (void) sigsetmask(sigblock(0) & ~sigmask(SIGALRM));
-#endif /* HASSIGSETMASK */
-#endif /* SIG_UNBLOCK */
+ (void) releasesignal(SIGALRM);
/* call ev_func */
errno = olderrno;
@@ -262,12 +253,17 @@ SLEEP_T
sleep(intvl)
unsigned int intvl;
{
+ int was_held;
+
if (intvl == 0)
return (SLEEP_T) 0;
SleepDone = FALSE;
(void) setevent((time_t) intvl, endsleep, 0);
+ was_held = releasesignal(SIGALRM);
while (!SleepDone)
pause();
+ if (was_held > 0)
+ blocksignal(SIGALRM);
return (SLEEP_T) 0;
}
diff --git a/usr.sbin/sendmail/src/collect.c b/usr.sbin/sendmail/src/collect.c
index 48b5b89..c5e1ceb 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.60 (Berkeley) 11/15/96";
+static char sccsid[] = "@(#)collect.c 8.61 (Berkeley) 11/24/96";
#endif /* not lint */
# include <errno.h>
@@ -90,18 +90,18 @@ collect(fp, smtpmode, requeueflag, hdrp, e)
HDR **hdrp;
register ENVELOPE *e;
{
- register FILE *tf;
- bool ignrdot = smtpmode ? FALSE : IgnrDot;
- time_t dbto = smtpmode ? TimeOuts.to_datablock : 0;
- register char *bp;
- int c = '\0';
- bool inputerr = FALSE;
+ register FILE *volatile tf;
+ volatile bool ignrdot = smtpmode ? FALSE : IgnrDot;
+ volatile time_t dbto = smtpmode ? TimeOuts.to_datablock : 0;
+ register char *volatile bp;
+ volatile int c = '\0';
+ volatile bool inputerr = FALSE;
bool headeronly;
- char *buf;
- int buflen;
- int istate;
- int mstate;
- u_char *pbp;
+ char *volatile buf;
+ volatile int buflen;
+ volatile int istate;
+ volatile int mstate;
+ u_char *volatile pbp;
u_char peekbuf[8];
char dfname[20];
char bufbuf[MAXLINE];
@@ -205,7 +205,7 @@ collect(fp, smtpmode, requeueflag, hdrp, e)
{
if (istate == IS_BOL)
fprintf(TrafficLogFile, "%05d <<< ",
- getpid());
+ (int) getpid());
if (c == EOF)
fprintf(TrafficLogFile, "[EOF]\n");
else
@@ -647,7 +647,7 @@ tferror(tf, e)
st.st_size);
else
fprintf(tf, "\n*** Mail of at least %ld bytes could not be accepted\n",
- st.st_size);
+ (long) st.st_size);
fprintf(tf, "*** at %s due to lack of disk space for temp file.\n",
MyHostName);
avail = freediskspace(QueueDir, &bsize);
diff --git a/usr.sbin/sendmail/src/conf.c b/usr.sbin/sendmail/src/conf.c
index 6f3fd95..f4a2219 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.315 (Berkeley) 11/10/96";
+static char sccsid[] = "@(#)conf.c 8.325 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -1089,34 +1089,83 @@ setsignal(sig, handler)
#endif
}
/*
-** RELEASESIGNAL -- release a held signal
+** BLOCKSIGNAL -- hold a signal to prevent delivery
**
** Parameters:
-** sig -- the signal to release.
+** sig -- the signal to block.
**
** Returns:
-** 0 on success.
+** 1 signal was previously blocked
+** 0 signal was not previously blocked
** -1 on failure.
*/
int
-releasesignal(sig)
+blocksignal(sig)
int sig;
{
#ifdef BSD4_3
# ifndef sigmask
# define sigmask(s) (1 << ((s) - 1))
# endif
- return sigsetmask(sigblock(0) & ~sigmask(sig));
+ return (sigblock(sigmask(sig)) & sigmask(sig)) != 0;
#else
# ifdef ALTOS_SYSTEM_V
- sigrelse(sig) ;
+ sigfunc_t handler;
+
+ handler = sigset(sig, SIG_HOLD);
+ if (handler == SIG_ERR)
+ return -1;
+ else
+ return handler == SIG_HOLD;
# else
- sigset_t sset;
+ sigset_t sset, oset;
sigemptyset(&sset);
sigaddset(&sset, sig);
- return sigprocmask(SIG_UNBLOCK, &sset, NULL);
+ if (sigprocmask(SIG_BLOCK, &sset, &oset) < 0)
+ return -1;
+ else
+ return sigismember(&oset, sig);
+# endif
+#endif
+}
+ /*
+** RELEASESIGNAL -- release a held signal
+**
+** Parameters:
+** sig -- the signal to release.
+**
+** Returns:
+** 1 signal was previously blocked
+** 0 signal was not previously blocked
+** -1 on failure.
+*/
+
+int
+releasesignal(sig)
+ int sig;
+{
+#ifdef BSD4_3
+ return (sigsetmask(sigblock(0) & ~sigmask(sig)) & sigmask(sig)) != 0;
+#else
+# ifdef ALTOS_SYSTEM_V
+ sigfunc_t handler;
+
+ handler = sigset(sig, SIG_HOLD);
+ if (sigrelse(sig) < 0)
+ return -1;
+ else
+ return handler == SIG_HOLD;
+# else
+ sigset_t sset, oset;
+
+ sigemptyset(&sset);
+ sigaddset(&sset, sig);
+ if (sigprocmask(SIG_UNBLOCK, &sset, &oset) < 0)
+ return -1;
+ else
+ return sigismember(&oset, sig);
# endif
#endif
}
@@ -1258,6 +1307,7 @@ init_vendor_macros(e)
#define LA_IRIX6 11 /* special IRIX 6.2 implementation */
#define LA_KSTAT 12 /* special Solaris kstat(3k) implementation */
#define LA_DEVSHORT 13 /* read short from a device */
+#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
/* do guesses based on general OS type */
#ifndef LA_TYPE
@@ -1380,7 +1430,8 @@ getla()
(void) fcntl(kmem, F_SETFD, 1);
}
if (tTd(3, 20))
- printf("getla: symbol address = %#x\n", Nl[X_AVENRUN].n_value);
+ printf("getla: symbol address = %#lx\n",
+ (u_long) Nl[X_AVENRUN].n_value);
if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, SEEK_SET) == -1 ||
read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
{
@@ -1884,6 +1935,37 @@ getla()
#endif /* LA_TYPE == LA_DEVSHORT */
+#if LA_TYPE == LA_ALPHAOSF
+# include <sys/table.h>
+
+int getla()
+{
+ int ave = 0;
+ struct tbl_loadavg tab;
+
+ if (table(TBL_LOADAVG, 0, &tab, 1, sizeof(tab)) == -1)
+ {
+ if (tTd(3, 1))
+ printf("getla: table %s\n", errstring(errno));
+ return (-1);
+ }
+
+ if (tTd(3, 1))
+ printf("getla: scale = %d\n", tab.tl_lscale);
+
+ if (tab.tl_lscale)
+ ave = (tab.tl_avenrun.l[0] + (tab.tl_lscale/2)) / tab.tl_lscale;
+ else
+ ave = (int) (tab.tl_avenrun.d[0] + 0.5);
+
+ if (tTd(3, 1))
+ printf("getla: %d\n", ave);
+
+ return ave;
+}
+
+#endif
+
#if LA_TYPE == LA_ZERO
int
@@ -2063,6 +2145,8 @@ refuseconnections(port)
if (MaxChildren > 0 && CurChildren >= MaxChildren)
{
+ extern void proc_list_probe __P((void));
+
proc_list_probe();
if (CurChildren >= MaxChildren)
{
@@ -2876,7 +2960,7 @@ static void dopr_outch __P(( int c ));
static void
dopr( buffer, format, args )
char *buffer;
- char *format;
+ const char *format;
va_list args;
{
int ch;
@@ -3848,6 +3932,11 @@ vendor_pre_defaults(e)
#ifdef SUN_EXTENSIONS
sun_pre_defaults(e);
#endif
+#ifdef apollo
+ /* stupid domain/os can't even open /etc/sendmail.cf without this */
+ setuserenv("ISP", NULL);
+ setuserenv("SYSTYPE", NULL);
+#endif
}
@@ -3926,6 +4015,7 @@ int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
#endif
+#if DAEMON
bool
validate_connection(sap, hostname, e)
SOCKADDR *sap;
@@ -3941,6 +4031,8 @@ validate_connection(sap, hostname, e)
#endif
return TRUE;
}
+
+#endif
/*
** STRTOL -- convert string to long integer
**
@@ -4190,14 +4282,26 @@ struct passwd *
sm_getpwnam(user)
char *user;
{
+#ifdef _AIX4
+ extern struct passwd *_getpwnam_shadow(const char *, const int);
+
+ return _getpwnam_shadow(user, 0);
+#else
return getpwnam(user);
+#endif
}
struct passwd *
sm_getpwuid(uid)
UID_T uid;
{
+#if defined(_AIX4) && 0
+ extern struct passwd *_getpwuid_shadow(const int, const int);
+
+ return _getpwuid_shadow(uid,0);
+#else
return getpwuid(uid);
+#endif
}
/*
** SECUREWARE_SETUP_SECURE -- Convex SecureWare setup
@@ -4617,9 +4721,6 @@ char *OsCompileOptions[] =
#if HASSETVBUF
"HASSETVBUF",
#endif
-#if HASSIGSETMASK
- "HASSIGSETMASK",
-#endif
#if HASSNPRINTF
"HASSNPRINTF",
#endif
diff --git a/usr.sbin/sendmail/src/conf.h b/usr.sbin/sendmail/src/conf.h
index cf7cbe5..39a92f5 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.272 (Berkeley) 11/16/96
+ * @(#)conf.h 8.279 (Berkeley) 12/1/96
*/
/*
@@ -443,6 +443,7 @@ typedef int pid_t;
# undef WEXITSTATUS
# undef HASUNAME
# define setpgid setpgrp
+# define MODE_T int
typedef int pid_t;
extern char *getenv();
@@ -476,6 +477,7 @@ extern char *getenv();
# define HASINITGROUPS 1 /* has initgroups(3) call */
# define IP_SRCROUTE 0 /* does not have <netinet/ip_var.h> */
# define HASGETUSERSHELL 0 /* does not have getusershell(3) */
+# define HASSNPRINTF 1 /* has snprintf(3) */
# ifndef IDENTPROTO
# define IDENTPROTO 0 /* TCP/IP implementation is broken */
# endif
@@ -574,7 +576,7 @@ extern long dgux_inet_addr();
# ifndef HASFLOCK
# define HASFLOCK 1 /* has flock(2) call */
# endif
-# define LA_TYPE LA_INT
+# define LA_TYPE LA_ALPHAOSF
# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
# define _PATH_VENDOR_CF "/var/adm/sendmail/sendmail.cf"
# ifndef _PATH_SENDMAILPID
@@ -1435,7 +1437,6 @@ extern int syslog(int, char *, ...);
# define HASUNAME 1 /* use System V uname(2) system call */
# define HASINITGROUPS 1 /* has initgroups(3) function */
# define HASSETVBUF 1 /* has setvbuf(3) function */
-# define HASSIGSETMASK 0 /* does not have sigsetmask(2) function */
# ifndef HASGETUSERSHELL
# define HASGETUSERSHELL 0 /* does not have getusershell(3) function */
# endif
@@ -1489,6 +1490,7 @@ extern struct group *getgrent(), *getgrnam(), *getgrgid();
# define setpgid setpgrp
# undef WIFEXITED
# undef WEXITSTATUS
+# define MODE_T int /* system include files have no mode_t */
typedef int pid_t;
typedef int (*sigfunc_t)();
# define SIGFUNC_DEFINED
@@ -1842,15 +1844,6 @@ extern int errno;
# define SECUREWARE 0 /* assume no SecureWare C2 auditing hooks */
#endif
-/* heuristic setting of HASSETSIGMASK; can override above */
-#ifndef HASSIGSETMASK
-# ifdef SIGVTALRM
-# define HASSETSIGMASK 1
-# else
-# define HASSETSIGMASK 0
-# endif
-#endif
-
/*
** If no type for argument two of getgroups call is defined, assume
** it's an integer -- unfortunately, there seem to be several choices
@@ -1918,6 +1911,9 @@ extern int errno;
/* pseudo-code used in server SMTP */
# define EX_QUIT 22 /* drop out of server immediately */
+/* pseudo-code used for mci_setstat */
+# define EX_NOTSTICKY -5 /* don't save persistent status */
+
/*
** These are used in a few cases where we need some special
@@ -1980,9 +1976,15 @@ extern int h_errno;
*/
#if NETINET || NETISO
-# define SMTP 1 /* enable user and server SMTP */
-# define QUEUE 1 /* enable queueing */
-# define DAEMON 1 /* include the daemon (requires IPC & SMTP) */
+# ifndef SMTP
+# define SMTP 1 /* enable user and server SMTP */
+# endif
+# ifndef QUEUE
+# define QUEUE 1 /* enable queueing */
+# endif
+# ifndef DAEMON
+# define DAEMON 1 /* include the daemon (requires IPC & SMTP) */
+# endif
#endif
diff --git a/usr.sbin/sendmail/src/convtime.c b/usr.sbin/sendmail/src/convtime.c
index 807ae6c..65994f8 100644
--- a/usr.sbin/sendmail/src/convtime.c
+++ b/usr.sbin/sendmail/src/convtime.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)convtime.c 8.7 (Berkeley) 9/15/96";
+static char sccsid[] = "@(#)convtime.c 8.8 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -149,7 +149,10 @@ pintvl(intvl, brief)
hr = intvl % 24;
intvl /= 24;
if (brief)
+ {
dy = intvl;
+ wk = 0;
+ }
else
{
dy = intvl % 7;
diff --git a/usr.sbin/sendmail/src/daemon.c b/usr.sbin/sendmail/src/daemon.c
index 283d7e4..c8516fc 100644
--- a/usr.sbin/sendmail/src/daemon.c
+++ b/usr.sbin/sendmail/src/daemon.c
@@ -37,28 +37,29 @@
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.148 (Berkeley) 11/8/96 (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.156 (Berkeley) 12/1/96 (with daemon mode)";
#else
-static char sccsid[] = "@(#)daemon.c 8.148 (Berkeley) 11/8/96 (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.156 (Berkeley) 12/1/96 (without daemon mode)";
#endif
#endif /* not lint */
-#ifdef DAEMON
-
+#if DAEMON || defined(SOCK_STREAM)
# include <arpa/inet.h>
-
-#if NAMED_BIND
-# include <resolv.h>
-# ifndef NO_DATA
-# define NO_DATA NO_ADDRESS
+# if NAMED_BIND
+# include <resolv.h>
+# ifndef NO_DATA
+# define NO_DATA NO_ADDRESS
+# endif
# endif
#endif
-#if IP_SRCROUTE
-# include <netinet/in_systm.h>
-# include <netinet/ip.h>
-# include <netinet/ip_var.h>
-#endif
+#if DAEMON
+
+# if IP_SRCROUTE
+# include <netinet/in_systm.h>
+# include <netinet/ip.h>
+# include <netinet/ip_var.h>
+# endif
/*
** DAEMON.C -- routines to use when running as a daemon.
@@ -195,10 +196,13 @@ getrequests(e)
{
register pid_t pid;
auto int lotherend;
+ int savederrno;
+ int pipefd[2];
extern bool refuseconnections();
extern int getla();
/* see if we are rejecting connections */
+ (void) blocksignal(SIGALRM);
if (refuseconnections(ntohs(DaemonAddr.sin.sin_port)))
{
if (DaemonSocket >= 0)
@@ -254,6 +258,7 @@ getrequests(e)
if (SetNonBlocking(DaemonSocket, FALSE) < 0)
log an error here;
#endif
+ (void) releasesignal(SIGALRM);
do
{
errno = 0;
@@ -261,8 +266,11 @@ getrequests(e)
t = accept(DaemonSocket,
(struct sockaddr *)&RealHostAddr, &lotherend);
} while (t < 0 && errno == EINTR);
+ savederrno = errno;
+ (void) blocksignal(SIGALRM);
if (t < 0)
{
+ errno = savederrno;
syserr("getrequests: accept");
/* arrange to re-open the socket next time around */
@@ -280,10 +288,26 @@ getrequests(e)
if (tTd(15, 2))
printf("getrequests: forking (fd = %d)\n", t);
+ /*
+ ** Create a pipe to keep the child from writing to the
+ ** socket until after the parent has closed it. Otherwise
+ ** the parent may hang if the child has closed it first.
+ */
+
+ if (pipe(pipefd) < 0)
+ pipefd[0] = pipefd[1] = -1;
+
+ blocksignal(SIGCHLD);
pid = fork();
if (pid < 0)
{
syserr("daemon: cannot fork");
+ if (pipefd[0] != -1)
+ {
+ (void) close(pipefd[0]);
+ (void) close(pipefd[1]);
+ }
+ (void) releasesignal(SIGCHLD);
sleep(10);
(void) close(t);
continue;
@@ -302,13 +326,41 @@ getrequests(e)
** Verify calling user id if possible here.
*/
+ (void) releasesignal(SIGALRM);
+ (void) releasesignal(SIGCHLD);
(void) setsignal(SIGCHLD, SIG_DFL);
(void) setsignal(SIGHUP, intsig);
(void) close(DaemonSocket);
+ proc_list_clear();
+
+ /* don't schedule queue runs if we are told to ETRN */
+ QueueIntvl = 0;
setproctitle("startup with %s",
anynet_ntoa(&RealHostAddr));
+ if (pipefd[0] != -1)
+ {
+ auto char c;
+
+ /*
+ ** Wait for the parent to close the write end
+ ** of the pipe, which we will see as an EOF.
+ ** This guarantees that we won't write to the
+ ** socket until after the parent has closed
+ ** the pipe.
+ */
+
+ /* close the write end of the pipe */
+ (void) close(pipefd[1]);
+
+ /* we shouldn't be interrupted, but ... */
+ while (read(pipefd[0], &c, 1) < 0 &&
+ errno == EINTR)
+ continue;
+ (void) close(pipefd[0]);
+ }
+
/* determine host name */
p = hostnamebyanyaddr(&RealHostAddr);
if (strlen(p) > (SIZE_T) MAXNAME)
@@ -350,9 +402,18 @@ getrequests(e)
/* parent -- keep track of children */
proc_list_add(pid);
+ (void) releasesignal(SIGCHLD);
+
+ /* close the read end of the synchronization pipe */
+ if (pipefd[0] != -1)
+ (void) close(pipefd[0]);
/* close the port so that others will hang (for a while) */
(void) close(t);
+
+ /* release the child by closing the read end of the sync pipe */
+ if (pipefd[1] != -1)
+ (void) close(pipefd[1]);
}
if (tTd(15, 2))
printf("getreq: returning (null server)\n");
@@ -585,7 +646,9 @@ setdaemonoptions(p)
case 'P': /* port */
switch (DaemonAddr.sa.sa_family)
{
+#if NETISO
short port;
+#endif
#if NETINET
case AF_INET:
@@ -683,14 +746,14 @@ makeconnection(host, port, mci, e)
register MCI *mci;
ENVELOPE *e;
{
- register int i = 0;
- register int s;
- register struct hostent *hp = (struct hostent *)NULL;
+ register volatile int i = 0;
+ register volatile int s;
+ register struct hostent *volatile hp = (struct hostent *)NULL;
SOCKADDR addr;
int sav_errno;
- int addrlen;
- bool firstconnect;
- EVENT *ev;
+ volatile int addrlen;
+ volatile bool firstconnect;
+ EVENT *volatile ev = NULL;
/*
** Set up the address for the mailer.
@@ -1109,7 +1172,7 @@ getauthinfo(fd)
int fd;
{
int falen;
- register char *p;
+ register char *volatile p = NULL;
SOCKADDR la;
int lalen;
register struct servent *sp;
@@ -1545,6 +1608,94 @@ host_map_lookup(map, name, av, statp)
s->s_namecanon.nc_cname = newstr(cp);
return cp;
}
+
+# else /* DAEMON */
+/* code for systems without sophisticated networking */
+
+/*
+** MYHOSTNAME -- stub version for case of no daemon code.
+**
+** Can't convert to upper case here because might be a UUCP name.
+**
+** Mark, you can change this to be anything you want......
+*/
+
+char **
+myhostname(hostbuf, size)
+ char hostbuf[];
+ int size;
+{
+ register FILE *f;
+
+ hostbuf[0] = '\0';
+ f = fopen("/usr/include/whoami", "r");
+ if (f != NULL)
+ {
+ (void) fgets(hostbuf, size, f);
+ fixcrlf(hostbuf, TRUE);
+ (void) fclose(f);
+ }
+ return (NULL);
+}
+ /*
+** GETAUTHINFO -- get the real host name asociated with a file descriptor
+**
+** Parameters:
+** fd -- the descriptor
+**
+** Returns:
+** The host name associated with this descriptor, if it can
+** be determined.
+** NULL otherwise.
+**
+** Side Effects:
+** none
+*/
+
+char *
+getauthinfo(fd)
+ int fd;
+{
+ return NULL;
+}
+ /*
+** MAPHOSTNAME -- turn a hostname into canonical form
+**
+** Parameters:
+** map -- a pointer to the database map.
+** name -- a buffer containing a hostname.
+** avp -- a pointer to a (cf file defined) argument vector.
+** statp -- an exit status (out parameter).
+**
+** Returns:
+** mapped host name
+** FALSE otherwise.
+**
+** Side Effects:
+** Looks up the host specified in name. If it is not
+** the canonical name for that host, replace it with
+** the canonical name. If the name is unknown, or it
+** is already the canonical name, leave it unchanged.
+*/
+
+/*ARGSUSED*/
+char *
+host_map_lookup(map, name, avp, statp)
+ MAP *map;
+ char *name;
+ char **avp;
+ char *statp;
+{
+ register struct hostent *hp;
+
+ hp = sm_gethostbyname(name);
+ if (hp != NULL)
+ return hp->h_name;
+ *statp = EX_NOHOST;
+ return NULL;
+}
+
+#endif /* DAEMON */
/*
** ANYNET_NTOA -- convert a network address to printable form.
**
@@ -1555,6 +1706,8 @@ host_map_lookup(map, name, av, statp)
** A printable version of that sockaddr.
*/
+#ifdef SOCK_STREAM
+
#if NETLINK
# include <net/if_dl.h>
#endif
@@ -1659,9 +1812,11 @@ hostnamebyanyaddr(sap)
break;
#endif
+#if NETUNIX
case AF_UNIX:
hp = NULL;
break;
+#endif
default:
hp = sm_gethostbyaddr(sap->sa.sa_data,
@@ -1686,90 +1841,4 @@ hostnamebyanyaddr(sap)
}
}
-# else /* DAEMON */
-/* code for systems without sophisticated networking */
-
-/*
-** MYHOSTNAME -- stub version for case of no daemon code.
-**
-** Can't convert to upper case here because might be a UUCP name.
-**
-** Mark, you can change this to be anything you want......
-*/
-
-char **
-myhostname(hostbuf, size)
- char hostbuf[];
- int size;
-{
- register FILE *f;
-
- hostbuf[0] = '\0';
- f = fopen("/usr/include/whoami", "r");
- if (f != NULL)
- {
- (void) fgets(hostbuf, size, f);
- fixcrlf(hostbuf, TRUE);
- (void) fclose(f);
- }
- return (NULL);
-}
- /*
-** GETAUTHINFO -- get the real host name asociated with a file descriptor
-**
-** Parameters:
-** fd -- the descriptor
-**
-** Returns:
-** The host name associated with this descriptor, if it can
-** be determined.
-** NULL otherwise.
-**
-** Side Effects:
-** none
-*/
-
-char *
-getauthinfo(fd)
- int fd;
-{
- return NULL;
-}
- /*
-** MAPHOSTNAME -- turn a hostname into canonical form
-**
-** Parameters:
-** map -- a pointer to the database map.
-** name -- a buffer containing a hostname.
-** avp -- a pointer to a (cf file defined) argument vector.
-** statp -- an exit status (out parameter).
-**
-** Returns:
-** mapped host name
-** FALSE otherwise.
-**
-** Side Effects:
-** Looks up the host specified in name. If it is not
-** the canonical name for that host, replace it with
-** the canonical name. If the name is unknown, or it
-** is already the canonical name, leave it unchanged.
-*/
-
-/*ARGSUSED*/
-char *
-host_map_lookup(map, name, avp, statp)
- MAP *map;
- char *name;
- char **avp;
- char *statp;
-{
- register struct hostent *hp;
-
- hp = sm_gethostbyname(name);
- if (hp != NULL)
- return hp->h_name;
- *statp = EX_NOHOST;
- return NULL;
-}
-
-#endif /* DAEMON */
+#endif /* SOCK_STREAM */
diff --git a/usr.sbin/sendmail/src/deliver.c b/usr.sbin/sendmail/src/deliver.c
index c019d2b..576c166 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.251 (Berkeley) 11/11/96";
+static char sccsid[] = "@(#)deliver.c 8.260 (Berkeley) 12/1/96";
#endif /* not lint */
#include "sendmail.h"
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)deliver.c 8.251 (Berkeley) 11/11/96";
extern int h_errno;
#endif
-#ifdef SMTP
+#if SMTP
extern char SmtpError[];
#endif
@@ -131,7 +131,7 @@ sendall(e, mode)
if (e->e_hopcount > MaxHopCount)
{
errno = 0;
-#ifdef QUEUE
+#if QUEUE
queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
#endif
e->e_flags |= EF_FATALERRS|EF_PM_NOTIFY|EF_CLRQUEUE;
@@ -422,7 +422,7 @@ sendall(e, mode)
mode = SM_QUEUE;
}
-# ifdef QUEUE
+# if QUEUE
if ((mode == SM_QUEUE || mode == SM_DEFER || mode == SM_FORK ||
(mode != SM_VERIFY && SuperSafe)) &&
(!bitset(EF_INQUEUE, e->e_flags) || splitenv != NULL))
@@ -609,7 +609,7 @@ sendenvelope(e, mode)
bool didany;
if (tTd(13, 10))
- printf("sendenvelope(%s) e_flags=0x%x\n",
+ printf("sendenvelope(%s) e_flags=0x%lx\n",
e->e_id == NULL ? "[NOQUEUE]" : e->e_id,
e->e_flags);
#ifdef LOG
@@ -676,7 +676,7 @@ sendenvelope(e, mode)
{
extern int deliver __P((ENVELOPE *, ADDRESS *));
-# ifdef QUEUE
+# if QUEUE
/*
** Checkpoint the send list every few addresses
*/
@@ -847,7 +847,7 @@ deliver(e, firstto)
host = to->q_host;
CurEnv = e; /* just in case */
e->e_statmsg = NULL;
-#ifdef SMTP
+#if SMTP
SmtpError[0] = '\0';
#endif
xstart = curtime();
@@ -939,7 +939,7 @@ deliver(e, firstto)
if (*mvp == NULL)
{
/* running SMTP */
-# ifdef SMTP
+# if SMTP
clever = TRUE;
*pvp = NULL;
# else /* SMTP */
@@ -1231,7 +1231,7 @@ deliver(e, firstto)
else if (strcmp(m->m_mailer, "[IPC]") == 0 ||
strcmp(m->m_mailer, "[TCP]") == 0)
{
-#ifdef DAEMON
+#if DAEMON
register int i;
if (pv[0] == NULL || pv[1] == NULL || pv[1][0] == '\0')
@@ -1340,7 +1340,7 @@ tryhost:
mci_cache(mci);
if (TrafficLogFile != NULL)
fprintf(TrafficLogFile, "%05d === CONNECT %s\n",
- getpid(), hostbuf);
+ (int) getpid(), hostbuf);
break;
}
else
@@ -1385,7 +1385,7 @@ tryhost:
{
char **av;
- fprintf(TrafficLogFile, "%05d === EXEC", getpid());
+ fprintf(TrafficLogFile, "%05d === EXEC", (int) getpid());
for (av = pv; *av != NULL; av++)
fprintf(TrafficLogFile, " %s", *av);
fprintf(TrafficLogFile, "\n");
@@ -1440,7 +1440,7 @@ tryhost:
#endif
/* if this mailer speaks smtp, create a return pipe */
-#ifdef SMTP
+#if SMTP
if (clever)
{
if (pipe(rpvect) < 0)
@@ -1484,7 +1484,7 @@ tryhost:
shortenstring(e->e_to, 203), m->m_name);
(void) close(mpvect[0]);
(void) close(mpvect[1]);
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[0]);
@@ -1575,13 +1575,10 @@ tryhost:
new_ruid = stb.st_uid;
else if (ctladdr != NULL && ctladdr->q_uid != 0)
new_ruid = ctladdr->q_uid;
- else
- {
- if (m->m_uid == 0)
- new_ruid = DefUid;
- else
- new_ruid = m->m_uid;
- }
+ else if (m->m_uid != 0)
+ new_ruid = m->m_uid;
+ else if (!bitnset(M_SPECIFIC_UID, m->m_flags))
+ new_ruid = DefUid;
if (new_euid != NO_UID)
{
vendor_set_uid(new_euid);
@@ -1611,7 +1608,7 @@ tryhost:
if (tTd(11, 2))
printf("openmailer: running as r/euid=%d/%d\n",
- getuid(), geteuid());
+ (int) getuid(), (int) geteuid());
/* move into some "safe" directory */
if (m->m_execdir != NULL)
@@ -1636,7 +1633,7 @@ tryhost:
}
/* arrange to filter std & diag output of command */
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[0]);
@@ -1718,7 +1715,7 @@ tryhost:
syserr("deliver: cannot create mailer output channel, fd=%d",
mpvect[1]);
(void) close(mpvect[1]);
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[0]);
@@ -1728,7 +1725,7 @@ tryhost:
rcode = EX_OSERR;
goto give_up;
}
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[1]);
@@ -1757,9 +1754,9 @@ tryhost:
*/
if (bitnset(M_7BITS, m->m_flags) &&
- (!clever || mci->mci_state == MCIS_CLOSED))
+ (!clever || mci->mci_state == MCIS_OPENING))
mci->mci_flags |= MCIF_7BIT;
-#ifdef SMTP
+#if SMTP
if (clever && mci->mci_state != MCIS_CLOSED)
{
extern void smtpinit __P((MAILER *, MCI *, ENVELOPE *));
@@ -1814,7 +1811,7 @@ tryhost:
mci_dump_all(TRUE);
rcode = EX_SOFTWARE;
}
-#ifdef DAEMON
+#if DAEMON
else if (curhost != NULL && *curhost != '\0')
{
/* try next MX site */
@@ -1836,7 +1833,7 @@ tryhost:
rcode = endmailer(mci, e, pv);
}
else
-#ifdef SMTP
+#if SMTP
{
extern int smtpmailfrom __P((MAILER *, MCI *, ENVELOPE *));
extern int smtprcpt __P((ADDRESS *, MAILER *, MCI *, ENVELOPE *));
@@ -1886,11 +1883,13 @@ tryhost:
rcode = smtpdata(m, mci, e);
}
}
+# if DAEMON
if (rcode == EX_TEMPFAIL && curhost != NULL && *curhost != '\0')
{
/* try next MX site */
goto tryhost;
}
+# endif
}
#else /* not SMTP */
{
@@ -1915,8 +1914,8 @@ tryhost:
*/
give_up:
-#ifdef SMTP
-# if FFR_LMTP
+#if SMTP
+# if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
{
tobuf[0] = '\0';
@@ -1933,8 +1932,8 @@ tryhost:
if (bitset(QBADADDR|QQUEUEUP, to->q_flags))
continue;
-#ifdef SMTP
-# if FFR_LMTP
+#if SMTP
+# if _FFR_LMTP
/* if running LMTP, get the status for each address */
if (bitnset(M_LMTP, m->m_flags))
{
@@ -1988,8 +1987,8 @@ tryhost:
}
}
-#ifdef SMTP
-# if FFR_LMTP
+#if SMTP
+# if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
{
/*
@@ -2013,7 +2012,7 @@ tryhost:
markstats(e, tochain);
mci_store_persistent(mci);
-#ifdef SMTP
+#if SMTP
/* now close the connection */
if (clever && mci->mci_state != MCIS_CLOSED &&
!bitset(MCIF_CACHED, mci->mci_flags))
@@ -2196,7 +2195,7 @@ endmailer(mci, e, pv)
if (mci->mci_pid == 0)
return (EX_OK);
-#ifdef FFR_TIMEOUT_WAIT
+#ifdef _FFR_TIMEOUT_WAIT
put a timeout around the wait
#endif
@@ -2309,7 +2308,7 @@ giveresponse(stat, m, mci, ctladdr, xstart, e)
statmsg = errstring(errno);
else
{
-#ifdef SMTP
+#if SMTP
statmsg = SmtpError;
#else /* SMTP */
statmsg = NULL;
@@ -2465,7 +2464,7 @@ logdelivery(m, mci, stat, ctladdr, xstart, e)
/* relay: max 66 bytes for IPv4 addresses */
if (mci != NULL && mci->mci_host != NULL)
{
-# ifdef DAEMON
+# if DAEMON
extern SOCKADDR CurHostAddr;
# endif
@@ -2473,7 +2472,7 @@ logdelivery(m, mci, stat, ctladdr, xstart, e)
shortenstring(mci->mci_host, 40));
bp += strlen(bp);
-# ifdef DAEMON
+# if DAEMON
if (CurHostAddr.sa.sa_family != 0)
{
snprintf(bp, SPACELEFT(buf, bp), " [%s]",
@@ -2584,14 +2583,14 @@ logdelivery(m, mci, stat, ctladdr, xstart, e)
bp = buf;
if (mci != NULL && mci->mci_host != NULL)
{
-# ifdef DAEMON
+# if DAEMON
extern SOCKADDR CurHostAddr;
# endif
snprintf(bp, SPACELEFT(buf, bp), "relay=%.100s", mci->mci_host);
bp += strlen(bp);
-# ifdef DAEMON
+# if DAEMON
if (CurHostAddr.sa.sa_family != 0)
snprintf(bp, SPACELEFT(buf, bp), " [%.100s]",
anynet_ntoa(&CurHostAddr));
@@ -2787,6 +2786,7 @@ putbody(mci, e, separator)
register char *bp;
register char *pbp;
register int c;
+ register char *xp;
int padc;
char *buflim;
int pos = 0;
@@ -2811,8 +2811,6 @@ putbody(mci, e, separator)
pbp = peekbuf;
while (!ferror(mci->mci_out))
{
- register char *xp;
-
if (pbp > peekbuf)
c = *--pbp;
else if ((c = getc(e->e_dfp)) == EOF)
@@ -2822,6 +2820,11 @@ putbody(mci, e, separator)
switch (ostate)
{
case OS_HEAD:
+#ifdef _FFR_NONULLS
+ if (c == '\0' &&
+ bitnset(M_NONULLS, mci->mci_mailer->m_flags))
+ break;
+#endif
if (c != '\r' && c != '\n' && bp < buflim)
{
*bp++ = c;
@@ -2856,7 +2859,8 @@ putbody(mci, e, separator)
/* now copy out saved line */
if (TrafficLogFile != NULL)
{
- fprintf(TrafficLogFile, "%05d >>> ", getpid());
+ fprintf(TrafficLogFile, "%05d >>> ",
+ (int) getpid());
if (padc != EOF)
putc(padc, TrafficLogFile);
for (xp = buf; xp < bp; xp++)
@@ -2921,6 +2925,11 @@ putbody(mci, e, separator)
ostate = OS_CR;
continue;
}
+#ifdef _FFR_NONULLS
+ if (c == '\0' &&
+ bitnset(M_NONULLS, mci->mci_mailer->m_flags))
+ break;
+#endif
putch:
if (mci->mci_mailer->m_linelimit > 0 &&
pos > mci->mci_mailer->m_linelimit &&
@@ -2937,11 +2946,23 @@ putch:
*pbp++ = c;
continue;
}
- if (TrafficLogFile != NULL)
- putc(c, TrafficLogFile);
- putc(c, mci->mci_out);
- pos++;
- ostate = c == '\n' ? OS_HEAD : OS_INLINE;
+ if (c == '\n')
+ {
+ if (TrafficLogFile != NULL)
+ fputs(mci->mci_mailer->m_eol,
+ TrafficLogFile);
+ fputs(mci->mci_mailer->m_eol, mci->mci_out);
+ pos = 0;
+ ostate = OS_HEAD;
+ }
+ else
+ {
+ if (TrafficLogFile != NULL)
+ putc(c, TrafficLogFile);
+ putc(c, mci->mci_out);
+ pos++;
+ ostate = OS_INLINE;
+ }
break;
}
}
@@ -2949,12 +2970,21 @@ putch:
/* make sure we are at the beginning of a line */
if (bp > buf)
{
- *bp = '\0';
- fputs(buf, mci->mci_out);
+ if (TrafficLogFile != NULL)
+ {
+ for (xp = buf; xp < bp; xp++)
+ putc(*xp, TrafficLogFile);
+ }
+ for (xp = buf; xp < bp; xp++)
+ putc(*xp, mci->mci_out);
pos += bp - buf;
}
if (pos > 0)
+ {
+ if (TrafficLogFile != NULL)
+ fputs(mci->mci_mailer->m_eol, TrafficLogFile);
fputs(mci->mci_mailer->m_eol, mci->mci_out);
+ }
}
if (ferror(e->e_dfp))
diff --git a/usr.sbin/sendmail/src/envelope.c b/usr.sbin/sendmail/src/envelope.c
index 80e5ce6..6781522 100644
--- a/usr.sbin/sendmail/src/envelope.c
+++ b/usr.sbin/sendmail/src/envelope.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.96 (Berkeley) 11/11/96";
+static char sccsid[] = "@(#)envelope.c 8.99 (Berkeley) 12/1/96";
#endif /* not lint */
#include "sendmail.h"
@@ -110,7 +110,7 @@ dropenvelope(e, fulldrop)
{
extern void printenvflags();
- printf("dropenvelope %x: id=", e);
+ printf("dropenvelope %lx: id=", (u_long) e);
xputs(e->e_id);
printf(", flags=");
printenvflags(e);
@@ -168,8 +168,8 @@ dropenvelope(e, fulldrop)
queueit = TRUE;
#if XDEBUG
else if (bitset(QQUEUEUP, q->q_flags))
- syslog(LOG_DEBUG, "%s: q_flags = %x",
- e->e_id, q->q_flags);
+ syslog(LOG_DEBUG, "dropenvelope: %s: q_flags = %x, paddr = %s",
+ e->e_id, q->q_flags, q->q_paddr);
#endif
/* see if a notification is needed */
@@ -349,7 +349,7 @@ simpledrop:
}
else if (queueit || !bitset(EF_INQUEUE, e->e_flags))
{
-#ifdef QUEUE
+#if QUEUE
queueup(e, FALSE);
#else /* QUEUE */
syserr("554 dropenvelope: queueup");
diff --git a/usr.sbin/sendmail/src/err.c b/usr.sbin/sendmail/src/err.c
index 199fdd8..2e0f0b91 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.50 (Berkeley) 9/20/96";
+static char sccsid[] = "@(#)err.c 8.52 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -432,7 +432,7 @@ putoutmsg(msg, holdmsg, heldmsg)
else
fprintf(OutChannel, "%s\n", &msg[4]);
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(),
+ fprintf(TrafficLogFile, "%05d >>> %s\n", (int) getpid(),
(OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]);
if (msg[3] == ' ')
(void) fflush(OutChannel);
@@ -631,7 +631,7 @@ errstring(errnum)
extern char *sys_errlist[];
extern int sys_nerr;
# endif
-# ifdef SMTP
+# if SMTP
extern char *SmtpPhase;
# endif /* SMTP */
diff --git a/usr.sbin/sendmail/src/headers.c b/usr.sbin/sendmail/src/headers.c
index 94cc73a..ba1845d 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.100 (Berkeley) 9/15/96";
+static char sccsid[] = "@(#)headers.c 8.101 (Berkeley) 11/23/96";
#endif /* not lint */
# include <errno.h>
@@ -1267,8 +1267,14 @@ put_vanilla_header(h, v, mci)
{
register char *nlp;
register char *obp;
+ int putflags;
char obuf[MAXLINE];
+ putflags = 0;
+#ifdef _FFR_7BITHDRS
+ if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
+ putflags |= PXLF_STRIP8BIT;
+#endif
(void) snprintf(obuf, sizeof obuf, "%.200s: ", h->h_field);
obp = obuf + strlen(obuf);
while ((nlp = strchr(v, '\n')) != NULL)
@@ -1280,7 +1286,7 @@ put_vanilla_header(h, v, mci)
l = sizeof obuf - (obp - obuf);
snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v);
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
v += l + 1;
obp = obuf;
if (*v != ' ' && *v != '\t')
@@ -1288,7 +1294,7 @@ put_vanilla_header(h, v, mci)
}
snprintf(obp, SPACELEFT(obuf, obp), "%.*s",
sizeof obuf - (obp - obuf) - 1, v);
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
}
/*
** COMMAIZE -- output a header field, making a comma-translated list.
@@ -1319,6 +1325,7 @@ commaize(h, p, oldstyle, mci, e)
int opos;
int omax;
bool firstone = TRUE;
+ int putflags = 0;
char obuf[MAXLINE + 3];
/*
@@ -1329,6 +1336,11 @@ commaize(h, p, oldstyle, mci, e)
if (tTd(14, 2))
printf("commaize(%s: %s)\n", h->h_field, p);
+#ifdef _FFR_7BITHDRS
+ if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
+ putflags |= PXLF_STRIP8BIT;
+#endif
+
obp = obuf;
(void) snprintf(obp, SPACELEFT(obuf, obp), "%.200s: ", h->h_field);
opos = strlen(h->h_field) + 2;
@@ -1425,7 +1437,7 @@ commaize(h, p, oldstyle, mci, e)
if (opos > omax && !firstone)
{
snprintf(obp, SPACELEFT(obuf, obp), ",\n");
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
obp = obuf;
(void) strcpy(obp, " ");
opos = strlen(obp);
@@ -1444,7 +1456,7 @@ commaize(h, p, oldstyle, mci, e)
*p = savechar;
}
*obp = '\0';
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
}
/*
** COPYHEADER -- copy header list
diff --git a/usr.sbin/sendmail/src/main.c b/usr.sbin/sendmail/src/main.c
index 29b5ac1..fbd954a 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.215 (Berkeley) 11/16/96";
+static char sccsid[] = "@(#)main.c 8.223 (Berkeley) 12/1/96";
#endif /* not lint */
#define _DEFINE
@@ -103,11 +103,12 @@ static void obsolete();
extern void printmailer __P((MAILER *));
extern void tTflag __P((char *));
-#ifdef DAEMON
-#ifndef SMTP
-ERROR %%%% Cannot have daemon mode without SMTP %%%% ERROR
-#endif /* SMTP */
-#endif /* DAEMON */
+#if DAEMON && !SMTP
+ERROR %%%% Cannot have DAEMON mode without SMTP %%%% ERROR
+#endif /* DAEMON && !SMTP */
+#if SMTP && !QUEUE
+ERROR %%%% Cannot have SMTP mode without QUEUE %%%% ERROR
+#endif /* DAEMON && !SMTP */
#define MAXCONFIGLEVEL 7 /* highest config version level known */
@@ -134,7 +135,7 @@ main(argc, argv, envp)
struct passwd *pw;
struct stat stb;
struct hostent *hp;
- bool nullserver;
+ bool nullserver = FALSE;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
static char rnamebuf[MAXNAME]; /* holds RealUserName */
char *emptyenviron[1];
@@ -519,13 +520,13 @@ main(argc, argv, envp)
{
case MD_DAEMON:
case MD_FGDAEMON:
-# ifndef DAEMON
+# if !DAEMON
usrerr("Daemon mode not implemented");
ExitStat = EX_USAGE;
break;
# endif /* DAEMON */
case MD_SMTP:
-# ifndef SMTP
+# if !SMTP
usrerr("I don't speak SMTP");
ExitStat = EX_USAGE;
break;
@@ -653,7 +654,7 @@ main(argc, argv, envp)
break;
case 'q': /* run queue files at intervals */
-# ifdef QUEUE
+# if QUEUE
FullName = NULL;
queuemode = TRUE;
switch (optarg[0])
@@ -949,7 +950,8 @@ main(argc, argv, envp)
default:
/* arrange to exit cleanly on hangup signal */
- setsignal(SIGHUP, intsig);
+ if (setsignal(SIGHUP, SIG_IGN) == (sigfunc_t) SIG_DFL)
+ setsignal(SIGHUP, intsig);
break;
}
@@ -1046,10 +1048,6 @@ main(argc, argv, envp)
setbitn(M_RUNASRCPT, ProgMailer->m_flags);
if (FileMailer != NULL)
setbitn(M_RUNASRCPT, FileMailer->m_flags);
-
- /* propogate some envariables into children */
- setuserenv("ISP", NULL);
- setuserenv("SYSTYPE", NULL);
}
if (ConfigLevel < 7)
{
@@ -1104,7 +1102,7 @@ main(argc, argv, envp)
HostStatDir = NULL;
}
-# ifdef QUEUE
+# if QUEUE
if (queuemode && RealUid != 0 && bitset(PRIV_RESTRICTQRUN, PrivacyFlags))
{
struct stat stbuf;
@@ -1141,7 +1139,7 @@ main(argc, argv, envp)
{
case MD_PRINT:
/* print the queue */
-#ifdef QUEUE
+#if QUEUE
dropenvelope(CurEnv, TRUE);
printqueue();
endpwent();
@@ -1247,7 +1245,7 @@ main(argc, argv, envp)
}
}
-# ifdef QUEUE
+# if QUEUE
/*
** If collecting stuff from the queue, go start doing that.
*/
@@ -1255,7 +1253,7 @@ main(argc, argv, envp)
if (queuemode && OpMode != MD_DAEMON && QueueIntvl == 0)
{
(void) unsetenv("HOSTALIASES");
- runqueue(FALSE);
+ (void) runqueue(FALSE, Verbose);
finis();
}
# endif /* QUEUE */
@@ -1305,10 +1303,10 @@ main(argc, argv, envp)
xla_create_file();
#endif
-# ifdef QUEUE
+# if QUEUE
if (queuemode)
{
- runqueue(TRUE);
+ (void) runqueue(TRUE, FALSE);
if (OpMode != MD_DAEMON)
for (;;)
pause();
@@ -1316,7 +1314,7 @@ main(argc, argv, envp)
# endif /* QUEUE */
dropenvelope(CurEnv, TRUE);
-#ifdef DAEMON
+#if DAEMON
nullserver = getrequests(CurEnv);
/* drop privileges */
@@ -1337,7 +1335,7 @@ main(argc, argv, envp)
#endif /* DAEMON */
}
-# ifdef SMTP
+# if SMTP
/*
** If running SMTP protocol, start collecting and executing
** commands. This will never return.
@@ -1651,8 +1649,8 @@ disconnect(droplev, e)
int fd;
if (tTd(52, 1))
- printf("disconnect: In %d Out %d, e=%x\n",
- fileno(InChannel), fileno(OutChannel), e);
+ printf("disconnect: In %d Out %d, e=%lx\n",
+ fileno(InChannel), fileno(OutChannel), (u_long) e);
if (tTd(52, 100))
{
printf("don't\n");
@@ -1956,6 +1954,14 @@ sigusr1()
void
sighup()
{
+ if (SaveArgv[0][0] != '/')
+ {
+#ifdef LOG
+ if (LogLevel > 3)
+ syslog(LOG_INFO, "could not restart: need full path");
+#endif
+ exit(EX_OSFILE);
+ }
#ifdef LOG
if (LogLevel > 3)
syslog(LOG_INFO, "restarting %s on signal", SaveArgv[0]);
diff --git a/usr.sbin/sendmail/src/makesendmail b/usr.sbin/sendmail/src/makesendmail
index 1b266c3..838d891 100644
--- a/usr.sbin/sendmail/src/makesendmail
+++ b/usr.sbin/sendmail/src/makesendmail
@@ -32,7 +32,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# @(#)makesendmail 8.41 (Berkeley) 9/23/96
+# @(#)makesendmail 8.42 (Berkeley) 11/10/96
#
#
@@ -109,6 +109,13 @@ in
esac
# tweak operating system type and release
+node=`uname -n | sed -e 's/\//-/g' -e 's/ //g'`
+if [ "$os" = "$node" -a "$arch" = "i386" -a "$rel" = 3.2 -a "`uname -v`" = 2 ]
+then
+ # old versions of SCO UNIX set uname -s the same as uname -n
+ os=SCO_SV
+fi
+
case $os
in
DYNIX-ptx) os=PTX;;
diff --git a/usr.sbin/sendmail/src/map.c b/usr.sbin/sendmail/src/map.c
index 34e6fce..1b0f086 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.144 (Berkeley) 11/16/96";
+static char sccsid[] = "@(#)map.c 8.146 (Berkeley) 11/24/96";
#endif /* not lint */
#include "sendmail.h"
@@ -1323,7 +1323,8 @@ db_map_store(map, lhs, rhs)
data.size = data.size + old.size + 1;
data.data = buf;
if (tTd(38, 9))
- printf("db_map_store append=%s\n", data.data);
+ printf("db_map_store append=%s\n",
+ (char *) data.data);
}
}
stat = db->put(db, &key, &data, 0);
@@ -1344,7 +1345,7 @@ db_map_close(map)
register DB *db = map->map_db2;
if (tTd(38, 9))
- printf("db_map_close(%s, %s, %x)\n",
+ printf("db_map_close(%s, %s, %lx)\n",
map->map_mname, map->map_file, map->map_mflags);
if (bitset(MF_WRITABLE, map->map_mflags))
@@ -3406,7 +3407,7 @@ impl_map_close(map)
MAP *map;
{
if (tTd(38, 9))
- printf("impl_map_close(%s, %s, %x)\n",
+ printf("impl_map_close(%s, %s, %lx)\n",
map->map_mname, map->map_file, map->map_mflags);
#ifdef NEWDB
if (bitset(MF_IMPL_HASH, map->map_mflags))
@@ -3598,6 +3599,7 @@ prog_map_lookup(map, name, av, statp)
printf(" %s", argv[i]);
printf("\n");
}
+ (void) blocksignal(SIGCHLD);
pid = prog_open(argv, &fd, CurEnv);
if (pid < 0)
{
@@ -3646,6 +3648,7 @@ prog_map_lookup(map, name, av, statp)
/* wait for the process to terminate */
close(fd);
stat = waitfor(pid);
+ (void) releasesignal(SIGCHLD);
if (stat == -1)
{
diff --git a/usr.sbin/sendmail/src/mci.c b/usr.sbin/sendmail/src/mci.c
index 18e951a..a81e61de 100644
--- a/usr.sbin/sendmail/src/mci.c
+++ b/usr.sbin/sendmail/src/mci.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)mci.c 8.46 (Berkeley) 11/3/96";
+static char sccsid[] = "@(#)mci.c 8.54 (Berkeley) 12/1/96";
#endif /* not lint */
#include "sendmail.h"
@@ -114,8 +114,8 @@ mci_cache(mci)
mci_uncache(mcislot, TRUE);
if (tTd(42, 5))
- printf("mci_cache: caching %x (%s) in slot %d\n",
- mci, mci->mci_host, mcislot - MciCache);
+ printf("mci_cache: caching %lx (%s) in slot %d\n",
+ (u_long) mci, mci->mci_host, mcislot - MciCache);
#ifdef LOG
if (tTd(91, 100))
syslog(LOG_DEBUG, "%s: mci_cache: caching %x (%.100s) in slot %d",
@@ -214,8 +214,8 @@ mci_uncache(mcislot, doquit)
mci_unlock_host(mci);
if (tTd(42, 5))
- printf("mci_uncache: uncaching %x (%s) from slot %d (%d)\n",
- mci, mci->mci_host, mcislot - MciCache, doquit);
+ printf("mci_uncache: uncaching %lx (%s) from slot %d (%d)\n",
+ (u_long) mci, mci->mci_host, mcislot - MciCache, doquit);
#ifdef LOG
if (tTd(91, 100))
syslog(LOG_DEBUG, "%s: mci_uncache: uncaching %x (%.100s) from slot %d (%d)",
@@ -223,7 +223,7 @@ mci_uncache(mcislot, doquit)
mci, mci->mci_host, mcislot - MciCache, doquit);
#endif
-#ifdef SMTP
+#if SMTP
if (doquit)
{
message("Closing connection to %s", mci->mci_host);
@@ -289,7 +289,7 @@ mci_get(host, m)
register MCI *mci;
register STAB *s;
-#ifdef DAEMON
+#if DAEMON
extern SOCKADDR CurHostAddr;
/* clear CurHostAddr so we don't get a bogus address with this name */
@@ -314,7 +314,7 @@ mci_get(host, m)
mci->mci_exitstat, mci->mci_errno);
}
-#ifdef SMTP
+#if SMTP
if (mci->mci_state == MCIS_OPEN)
{
extern int smtpprobe __P((MCI *));
@@ -329,7 +329,7 @@ mci_get(host, m)
mci->mci_exitstat = EX_OK;
mci->mci_state = MCIS_CLOSED;
}
-# ifdef DAEMON
+# if DAEMON
else
{
/* get peer host address for logging reasons only */
@@ -377,7 +377,10 @@ mci_setstat(mci, xstat, dstat, rstat)
char *dstat;
char *rstat;
{
- mci->mci_exitstat = xstat;
+ /* protocol errors should never be interpreted as sticky */
+ if (xstat != EX_NOTSTICKY && xstat != EX_PROTOCOL)
+ mci->mci_exitstat = xstat;
+
mci->mci_status = dstat;
if (mci->mci_rstatus != NULL)
free(mci->mci_rstatus);
@@ -672,7 +675,6 @@ mci_load_persistent(mci)
{
int saveErrno = errno;
FILE *fp;
- int status;
char fname[MAXPATHLEN+1];
if (mci == NULL)
@@ -682,7 +684,7 @@ mci_load_persistent(mci)
return;
}
- if (HostStatDir == NULL || mci->mci_host == NULL)
+ if (IgnoreHostStatus || HostStatDir == NULL || mci->mci_host == NULL)
return;
if (tTd(56, 1))
@@ -750,7 +752,7 @@ mci_read_persistent(fp, mci)
syserr("mci_read_persistent: NULL mci");
if (tTd(56, 93))
{
- printf("mci_read_persistent: fp=%x, mci=", fp);
+ printf("mci_read_persistent: fp=%lx, mci=", (u_long) fp);
mci_dump(mci, FALSE);
}
@@ -760,6 +762,7 @@ mci_read_persistent(fp, mci)
mci->mci_rstatus = NULL;
rewind(fp);
+ ver = -1;
while (fgets(buf, sizeof buf, fp) != NULL)
{
p = strchr(buf, '\n');
@@ -806,6 +809,8 @@ mci_read_persistent(fp, mci)
return -1;
}
}
+ if (ver < 0)
+ return -1;
return 0;
}
/*
@@ -868,7 +873,6 @@ mci_store_persistent(mci)
fflush(mci->mci_statfile);
-cleanup:
errno = saveErrno;
return;
}
@@ -903,7 +907,7 @@ mci_traverse_persistent(action, pathname)
{
struct stat statbuf;
DIR *d;
- int ret = 0;
+ int ret;
if (pathname == NULL)
pathname = HostStatDir;
@@ -961,13 +965,17 @@ mci_traverse_persistent(action, pathname)
/*
** The following appears to be
- ** necessary during purgest, since
+ ** necessary during purges, since
** we modify the directory structure
*/
if (action == mci_purge_persistent)
rewinddir(d);
}
+
+ /* purge (or whatever) the directory proper */
+ *--newptr = '\0';
+ ret = (*action)(newpath, NULL);
closedir(d);
}
else if (S_ISREG(statbuf.st_mode))
@@ -1031,12 +1039,14 @@ mci_print_persistent(pathname, hostname)
{
static int initflag = FALSE;
FILE *fp;
- int status;
int width = Verbose ? 78 : 25;
bool locked;
- char *p;
MCI mcib;
+ /* skip directories */
+ if (hostname == NULL)
+ return 0;
+
if (!initflag)
{
initflag = TRUE;
@@ -1101,6 +1111,7 @@ mci_print_persistent(pathname, hostname)
** Parameters:
** pathname -- path to the status file.
** hostname -- name of host corresponding to that file.
+** NULL if this is a directory (domain).
**
** Returns:
** 0
@@ -1116,43 +1127,30 @@ mci_purge_persistent(pathname, hostname)
if (tTd(56, 1))
printf("mci_purge_persistent: purging %s\n", pathname);
- /* remove the file */
- if (unlink(pathname) < 0)
+ if (hostname != NULL)
{
- if (tTd(56, 2))
- printf("mci_purge_persistent: failed to unlink %s: %s\n",
- pathname, errstring(errno));
- return -1;
+ /* remove the file */
+ if (unlink(pathname) < 0)
+ {
+ if (tTd(56, 2))
+ printf("mci_purge_persistent: failed to unlink %s: %s\n",
+ pathname, errstring(errno));
+ }
}
-
- /*
- ** remove empty parent directories.
- */
-
- for (;;)
+ else
{
- while (*end != '/')
- end--;
- *(end--) = '\0';
-
+ /* remove the directory */
if (*end != '.')
- break;
+ return 0;
if (tTd(56, 1))
printf("mci_purge_persistent: dpurge %s\n", pathname);
if (rmdir(pathname) < 0)
{
- if (errno == ENOENT || errno == EEXIST)
- break; /* directory is not empty */
-#ifdef ENOTEMTPY
- if (errno == ENOTEMPTY)
- break; /* BSDism */
-#endif
if (tTd(56, 2))
printf("mci_purge_persistent: rmdir %s: %s\n",
pathname, errstring(errno));
- break;
}
}
diff --git a/usr.sbin/sendmail/src/mime.c b/usr.sbin/sendmail/src/mime.c
index 9ee726a..bdb91a2 100644
--- a/usr.sbin/sendmail/src/mime.c
+++ b/usr.sbin/sendmail/src/mime.c
@@ -36,7 +36,7 @@
# include <string.h>
#ifndef lint
-static char sccsid[] = "@(#)mime.c 8.49 (Berkeley) 10/30/96";
+static char sccsid[] = "@(#)mime.c 8.51 (Berkeley) 11/24/96";
#endif /* not lint */
/*
@@ -450,7 +450,7 @@ mime8to7(mci, header, e, boundaries, flags)
if (tTd(43, 8))
{
printf("mime8to7: %ld high bit(s) in %ld byte(s), cte=%s, type=%s/%s\n",
- sectionhighbits, sectionsize,
+ (long) sectionhighbits, (long) sectionsize,
cte == NULL ? "[none]" : cte,
type == NULL ? "[none]" : type,
subtype == NULL ? "[none]" : subtype);
@@ -959,7 +959,7 @@ mime7to8(mci, header, e)
char *cte;
char **pvp;
u_char *obp;
- u_char ch, *fbufp, *obufp;
+ u_char *fbufp;
char buf[MAXLINE];
u_char obuf[MAXLINE + 1];
u_char fbuf[MAXLINE + 1];
@@ -1010,7 +1010,6 @@ mime7to8(mci, header, e)
if (strcasecmp(cte, "base64") == 0)
{
- int nchar = 0;
int c1, c2, c3, c4;
fbufp = fbuf;
diff --git a/usr.sbin/sendmail/src/parseaddr.c b/usr.sbin/sendmail/src/parseaddr.c
index 3b466f9..a10c329 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.114 (Berkeley) 9/20/96";
+static char sccsid[] = "@(#)parseaddr.c 8.115 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -1045,7 +1045,7 @@ rewrite(pvp, ruleset, reclevel, e)
pp = m->first;
while (pp <= m->last)
{
- printf(" %x=\"", *pp);
+ printf(" %lx=\"", (u_long) *pp);
(void) fflush(stdout);
printf("%s\"", *pp++);
}
@@ -1873,7 +1873,7 @@ printaddr(a, follow)
while (a != NULL)
{
- printf("%x=", a);
+ printf("%lx=", (u_long) a);
(void) fflush(stdout);
/* find the mailer -- carefully */
@@ -1892,8 +1892,9 @@ printaddr(a, follow)
printf("\tuser `%s', ruser `%s'\n",
a->q_user,
a->q_ruser == NULL ? "<null>" : a->q_ruser);
- printf("\tnext=%x, alias %x, uid %d, gid %d\n",
- a->q_next, a->q_alias, a->q_uid, a->q_gid);
+ printf("\tnext=%lx, alias %lx, uid %d, gid %d\n",
+ (u_long) a->q_next, (u_long) a->q_alias,
+ (int) a->q_uid, (int) a->q_gid);
printf("\tflags=%lx<", a->q_flags);
firstone = TRUE;
for (qfp = AddressFlags; qfp->qf_name != NULL; qfp++)
diff --git a/usr.sbin/sendmail/src/queue.c b/usr.sbin/sendmail/src/queue.c
index 299a016..5d00b9f 100644
--- a/usr.sbin/sendmail/src/queue.c
+++ b/usr.sbin/sendmail/src/queue.c
@@ -35,17 +35,17 @@
# include "sendmail.h"
#ifndef lint
-#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 8.131 (Berkeley) 11/8/96 (with queueing)";
+#if QUEUE
+static char sccsid[] = "@(#)queue.c 8.145 (Berkeley) 12/2/96 (with queueing)";
#else
-static char sccsid[] = "@(#)queue.c 8.131 (Berkeley) 11/8/96 (without queueing)";
+static char sccsid[] = "@(#)queue.c 8.145 (Berkeley) 12/2/96 (without queueing)";
#endif
#endif /* not lint */
# include <errno.h>
# include <dirent.h>
-# ifdef QUEUE
+# if QUEUE
/*
** Work queue.
@@ -195,7 +195,7 @@ queueup(e, announce)
if (!bitset(EF_HAS_DF, e->e_flags))
{
- register FILE *dfp;
+ register FILE *dfp = NULL;
char dfname[20];
struct stat stbuf;
@@ -300,8 +300,9 @@ queueup(e, announce)
{
#if XDEBUG
if (bitset(QQUEUEUP, q->q_flags))
- syslog(LOG_DEBUG, "%s: q_flags = %x",
- e->e_id, q->q_flags);
+ syslog(LOG_DEBUG,
+ "dropenvelope: %s: q_flags = %x, paddr = %s",
+ e->e_id, q->q_flags, q->q_paddr);
#endif
continue;
}
@@ -474,7 +475,6 @@ printctladdr(a, tfp)
{
char *uname;
char *paddr;
- register struct passwd *pw;
register ADDRESS *q;
uid_t uid;
gid_t gid;
@@ -531,9 +531,10 @@ printctladdr(a, tfp)
** forkflag -- TRUE if the queue scanning should be done in
** a child process. We double-fork so it is not our
** child and we don't have to clean up after it.
+** verbose -- if TRUE, print out status information.
**
** Returns:
-** none.
+** TRUE if the queue run successfully began.
**
** Side Effects:
** runs things in the mail queue.
@@ -541,15 +542,17 @@ printctladdr(a, tfp)
ENVELOPE QueueEnvelope; /* the queue run envelope */
-void
-runqueue(forkflag)
+bool
+runqueue(forkflag, verbose)
bool forkflag;
+ bool verbose;
{
register ENVELOPE *e;
int njobs;
int sequenceno = 0;
extern ENVELOPE BlankEnvelope;
extern void clrdaemon __P((void));
+ extern void runqueueevent __P((bool));
/*
** If no work will ever be selected, don't even bother reading
@@ -562,15 +565,15 @@ runqueue(forkflag)
{
char *msg = "Skipping queue run -- load average too high";
- if (Verbose)
- printf("%s\n", msg);
+ if (verbose)
+ message("458 %s\n", msg);
#ifdef LOG
if (LogLevel > 8)
syslog(LOG_INFO, "runqueue: %s", msg);
#endif
if (forkflag && QueueIntvl != 0)
- (void) setevent(QueueIntvl, runqueue, TRUE);
- return;
+ (void) setevent(QueueIntvl, runqueueevent, TRUE);
+ return FALSE;
}
/*
@@ -584,27 +587,49 @@ runqueue(forkflag)
#ifdef SIGCHLD
extern void reapchild();
+ blocksignal(SIGCHLD);
(void) setsignal(SIGCHLD, reapchild);
#endif
pid = dofork();
+ if (pid == -1)
+ {
+ const char *msg = "Skipping queue run -- fork() failed";
+ const char *err = errstring(errno);
+
+ if (verbose)
+ message("458 %s: %s\n", msg, err);
+#ifdef LOG
+ if (LogLevel > 8)
+ syslog(LOG_INFO, "runqueue: %s: %s", msg, err);
+#endif
+ if (QueueIntvl != 0)
+ (void) setevent(QueueIntvl, runqueueevent, TRUE);
+ (void) releasesignal(SIGCHLD);
+ return FALSE;
+ }
if (pid != 0)
{
/* parent -- pick up intermediate zombie */
#ifndef SIGCHLD
(void) waitfor(pid);
#else
+ (void) blocksignal(SIGALRM);
proc_list_add(pid);
+ (void) releasesignal(SIGALRM);
+ releasesignal(SIGCHLD);
#endif /* SIGCHLD */
if (QueueIntvl != 0)
- (void) setevent(QueueIntvl, runqueue, TRUE);
- return;
+ (void) setevent(QueueIntvl, runqueueevent, TRUE);
+ return TRUE;
}
/* child -- double fork and clean up signals */
+ proc_list_clear();
#ifndef SIGCHLD
if (fork() != 0)
exit(EX_OK);
#else /* SIGCHLD */
+ releasesignal(SIGCHLD);
(void) setsignal(SIGCHLD, SIG_DFL);
#endif /* SIGCHLD */
(void) setsignal(SIGHUP, intsig);
@@ -623,7 +648,7 @@ runqueue(forkflag)
** Release any resources used by the daemon code.
*/
-# ifdef DAEMON
+# if DAEMON
clrdaemon();
# endif /* DAEMON */
@@ -660,7 +685,10 @@ runqueue(forkflag)
if (QueueLimitId != NULL || QueueLimitSender != NULL ||
QueueLimitRecipient != NULL)
- HostStatDir = NULL;
+ {
+ IgnoreHostStatus = TRUE;
+ MinQueueAge = 0;
+ }
/*
** Start making passes through the queue.
@@ -719,6 +747,20 @@ runqueue(forkflag)
/* exit without the usual cleanup */
e->e_id = NULL;
finis();
+ /*NOTREACHED*/
+ return TRUE;
+}
+
+
+/*
+** RUNQUEUEEVENT -- stub for use in setevent
+*/
+
+void
+runqueueevent(forkflag)
+ bool forkflag;
+{
+ (void) runqueue(forkflag, FALSE);
}
/*
** ORDERQ -- order the work queue.
@@ -1257,7 +1299,7 @@ workcmpf3(a, b)
if (a->w_ctime > b->w_ctime)
return 1;
else if (a->w_ctime < b->w_ctime)
- return 1;
+ return -1;
else
return 0;
}
@@ -1340,6 +1382,7 @@ dowork(id, forkflag, requeueflag, e)
disconnect(1, e);
OpMode = MD_DELIVER;
}
+ setproctitle("%s: from queue", id);
# ifdef LOG
if (LogLevel > 76)
syslog(LOG_DEBUG, "%s: dowork, pid=%d", e->e_id,
@@ -2054,7 +2097,8 @@ queuename(e, type)
e->e_id = newstr(&qf[2]);
define('i', e->e_id, e);
if (tTd(7, 1))
- printf("queuename: assigned id %s, env=%x\n", e->e_id, e);
+ printf("queuename: assigned id %s, env=%lx\n",
+ e->e_id, (u_long) e);
if (tTd(7, 9))
{
printf(" lockfd=");
diff --git a/usr.sbin/sendmail/src/readcf.c b/usr.sbin/sendmail/src/readcf.c
index c95a6f3..58c4a3a 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.176 (Berkeley) 11/10/96";
+static char sccsid[] = "@(#)readcf.c 8.181 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -1298,7 +1298,7 @@ printmailer(m)
m->m_mno, m->m_name,
m->m_mailer, m->m_se_rwset, m->m_sh_rwset,
m->m_re_rwset, m->m_rh_rwset, m->m_maxsize,
- m->m_uid, m->m_gid);
+ (int) m->m_uid, (int) m->m_gid);
for (j = '\0'; j <= '\177'; j++)
if (bitnset(j, m->m_flags))
(void) putchar(j);
@@ -1423,7 +1423,7 @@ struct optioninfo
{ "DefaultUser", 'u', FALSE },
{ "FallbackMXhost", 'V', FALSE },
{ "Verbose", 'v', TRUE },
- { "TryNullMXList", 'w', TRUE },
+ { "TryNullMXList", 'w', FALSE },
{ "QueueLA", 'x', FALSE },
{ "RefuseLA", 'X', FALSE },
{ "RecipientFactor", 'y', FALSE },
@@ -1465,7 +1465,7 @@ struct optioninfo
#define O_OPCHARS 0x92
{ "OperatorChars", O_OPCHARS, FALSE },
#define O_DONTINITGRPS 0x93
- { "DontInitGroups", O_DONTINITGRPS, TRUE },
+ { "DontInitGroups", O_DONTINITGRPS, FALSE },
#define O_SLFH 0x94
{ "SingleLineFromHeader", O_SLFH, TRUE },
#define O_ABH 0x95
@@ -1728,7 +1728,7 @@ setoption(opt, val, safe, sticky, e)
case SM_QUEUE: /* queue only */
case SM_DEFER: /* queue only and defer map lookups */
-#ifndef QUEUE
+#if !QUEUE
syserr("need QUEUE to set -odqueue or -oddefer");
#endif /* QUEUE */
/* fall through..... */
@@ -1849,7 +1849,7 @@ setoption(opt, val, safe, sticky, e)
}
if (tTd(8, 2))
printf("_res.options = %x, HasWildcardMX = %d\n",
- _res.options, HasWildcardMX);
+ (u_int) _res.options, HasWildcardMX);
#else
usrerr("name server (I option) specified but BIND not compiled in");
#endif
@@ -1906,7 +1906,7 @@ setoption(opt, val, safe, sticky, e)
/* 'N' available -- was "net name" */
case 'O': /* daemon options */
-#ifdef DAEMON
+#if DAEMON
setdaemonoptions(val);
#else
syserr("DaemonPortOptions (O option) set but DAEMON not compiled in");
diff --git a/usr.sbin/sendmail/src/recipient.c b/usr.sbin/sendmail/src/recipient.c
index dae5156..92e6bc3 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.116 (Berkeley) 8/17/96";
+static char sccsid[] = "@(#)recipient.c 8.118 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -474,8 +474,8 @@ recipient(a, sendq, aliaslevel, e)
if (tTd(29, 5))
{
- printf("recipient: testing local? cl=%d, rr5=%x\n\t",
- ConfigLevel, RewriteRules[5]);
+ printf("recipient: testing local? cl=%d, rr5=%lx\n\t",
+ ConfigLevel, (u_long) RewriteRules[5]);
printaddr(a, FALSE);
}
if (!bitset(QNOTREMOTE|QDONTSEND|QQUEUEUP|QVERIFIED, a->q_flags) &&
@@ -601,7 +601,7 @@ recipient(a, sendq, aliaslevel, e)
if (aliaslevel == 0)
{
int nrcpts = 0;
- ADDRESS *only;
+ ADDRESS *only = NULL;
for (q = *sendq; q != NULL; q = q->q_next)
{
@@ -907,7 +907,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
volatile gid_t savedgid, gid;
char *volatile uname;
int rval = 0;
- int sfflags = SFF_REGONLY;
+ volatile int sfflags = SFF_REGONLY;
struct stat st;
char buf[MAXLINE];
#ifdef _POSIX_CHOWN_RESTRICTED
@@ -932,7 +932,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
if (tTd(27, 2))
printf("include(%s)\n", fname);
if (tTd(27, 4))
- printf(" ruid=%d euid=%d\n", getuid(), geteuid());
+ printf(" ruid=%d euid=%d\n", (int) getuid(), (int) geteuid());
if (tTd(27, 14))
{
printf("ctladdr ");
@@ -940,7 +940,8 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
}
if (tTd(27, 9))
- printf("include: old uid = %d/%d\n", getuid(), geteuid());
+ printf("include: old uid = %d/%d\n",
+ (int) getuid(), (int) geteuid());
if (forwarding)
sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOSLINK;
@@ -985,7 +986,8 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
#endif
if (tTd(27, 9))
- printf("include: new uid = %d/%d\n", getuid(), geteuid());
+ printf("include: new uid = %d/%d\n",
+ (int) getuid(), (int) geteuid());
/*
** If home directory is remote mounted but server is down,
@@ -1013,7 +1015,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
/* don't use this :include: file */
if (tTd(27, 4))
printf("include: not safe (uid=%d): %s\n",
- uid, errstring(rval));
+ (int) uid, errstring(rval));
}
else
{
@@ -1053,7 +1055,8 @@ resetuid:
#endif
if (tTd(27, 9))
- printf("include: reset uid = %d/%d\n", getuid(), geteuid());
+ printf("include: reset uid = %d/%d\n",
+ (int) getuid(), (int) geteuid());
if (rval == EOPENTIMEOUT)
usrerr("451 open timeout on %s", fname);
@@ -1083,7 +1086,7 @@ resetuid:
ctladdr->q_flags |= ca->q_flags & QBOGUSSHELL;
ctladdr->q_ruser = ca->q_ruser;
}
- else
+ else if (!forwarding)
{
register struct passwd *pw;
diff --git a/usr.sbin/sendmail/src/savemail.c b/usr.sbin/sendmail/src/savemail.c
index cb06c8e..4abad53 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.100 (Berkeley) 9/27/96";
+static char sccsid[] = "@(#)savemail.c 8.101 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -481,8 +481,8 @@ returntosender(msg, returnq, flags, e)
if (tTd(6, 1))
{
- printf("\n*** Return To Sender: msg=\"%s\", depth=%d, e=%x, returnq=",
- msg, returndepth, e);
+ printf("\n*** Return To Sender: msg=\"%s\", depth=%d, e=%lx, returnq=",
+ msg, returndepth, (u_long) e);
printaddr(returnq, TRUE);
if (tTd(6, 20))
{
diff --git a/usr.sbin/sendmail/src/sendmail.h b/usr.sbin/sendmail/src/sendmail.h
index 2dc30e4..6aba9ab 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.209 (Berkeley) 11/8/96
+ * @(#)sendmail.h 8.216 (Berkeley) 12/1/96
*/
/*
@@ -41,7 +41,7 @@
# ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.209 11/8/96";
+static char SmailSccsId[] = "@(#)sendmail.h 8.216 12/1/96";
# endif
# else /* _DEFINE */
# define EXTERN extern
@@ -68,7 +68,7 @@ static char SmailSccsId[] = "@(#)sendmail.h 8.209 11/8/96";
# include <syslog.h>
# endif /* LOG */
-# ifdef DAEMON
+# if NETINET || NETUNIX || NETISO || NETNS || NETX25
# include <sys/socket.h>
# endif
# if NETUNIX
@@ -277,8 +277,10 @@ struct mailer
# define M_XDOT 'X' /* use hidden-dot algorithm */
# define M_LMTP 'z' /* run Local Mail Transport Protocol */
# define M_NOMX '0' /* turn off MX lookups */
+# define M_NONULLS '1' /* don't send null bytes */
# define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
# define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
+# define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
# define M_7BITS '7' /* use 7-bit path */
# define M_8BITS '8' /* force "just send 8" behaviour */
# define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */
@@ -984,7 +986,7 @@ extern int safefile __P((char *, UID_T, GID_T, char *, int, int, struct stat *))
** we are forced to declare a supertype here.
*/
-#ifdef DAEMON
+# if NETINET || NETUNIX || NETISO || NETNS || NETX25
union bigsockaddr
{
struct sockaddr sa; /* general version */
@@ -1011,6 +1013,9 @@ EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */
extern char *hostnamebyanyaddr __P((SOCKADDR *));
extern char *anynet_ntoa __P((SOCKADDR *));
+# if DAEMON
+extern bool validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
+# endif
#endif
@@ -1160,6 +1165,7 @@ EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */
EXTERN bool UserSubmission; /* initial (user) mail submission */
EXTERN uid_t RunAsUid; /* UID to become for bulk of run */
EXTERN gid_t RunAsGid; /* GID to become for bulk of run */
+EXTERN bool IgnoreHostStatus; /* ignore long term host status files */
EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */
EXTERN bool UnsafeGroupWrites; /* group-writable files are unsafe */
EXTERN bool SingleLineFromHeader; /* force From: header to be one line */
@@ -1315,6 +1321,7 @@ extern void shorten_hostname __P((char []));
extern int waitfor __P((pid_t));
extern void proc_list_add __P((pid_t));
extern void proc_list_drop __P((pid_t));
+extern void proc_list_clear __P((void));
extern void buffer_errors __P((void));
extern void flush_errors __P((bool));
extern void putline __P((char *, MCI *));
@@ -1336,7 +1343,7 @@ extern void stripquotes __P((char *));
extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern void unlockqueue __P((ENVELOPE *));
extern void xunlink __P((char *));
-extern void runqueue __P((bool));
+extern bool runqueue __P((bool, bool));
extern int getla __P((void));
extern void sendall __P((ENVELOPE *, int));
extern void queueup __P((ENVELOPE *, bool));
@@ -1349,12 +1356,12 @@ extern int mailfile __P((char *, ADDRESS *, int, ENVELOPE *));
extern void loseqfile __P((ENVELOPE *, char *));
extern int prog_open __P((char **, int *, ENVELOPE *));
extern bool getcanonname __P((char *, int, bool));
-extern bool validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
extern bool path_is_dir __P((char *, bool));
extern pid_t dowork __P((char *, bool, bool, ENVELOPE *));
extern const char *errstring __P((int));
extern sigfunc_t setsignal __P((int, sigfunc_t));
+extern int blocksignal __P((int));
extern int releasesignal __P((int));
extern struct hostent *sm_gethostbyname __P((char *));
extern struct hostent *sm_gethostbyaddr __P((char *, int, int));
diff --git a/usr.sbin/sendmail/src/srvrsmtp.c b/usr.sbin/sendmail/src/srvrsmtp.c
index 062acde..895cce5 100644
--- a/usr.sbin/sendmail/src/srvrsmtp.c
+++ b/usr.sbin/sendmail/src/srvrsmtp.c
@@ -35,16 +35,16 @@
# include "sendmail.h"
#ifndef lint
-#ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.125 (Berkeley) 11/8/96 (with SMTP)";
+#if SMTP
+static char sccsid[] = "@(#)srvrsmtp.c 8.131 (Berkeley) 12/1/96 (with SMTP)";
#else
-static char sccsid[] = "@(#)srvrsmtp.c 8.125 (Berkeley) 11/8/96 (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.131 (Berkeley) 12/1/96 (without SMTP)";
#endif
#endif /* not lint */
# include <errno.h>
-# ifdef SMTP
+# if SMTP
/*
** SMTP -- run the SMTP protocol.
@@ -128,7 +128,7 @@ smtp(nullserver, e)
bool nullserver;
register ENVELOPE *volatile e;
{
- register char *p;
+ register char *volatile p;
register struct cmd *c;
char *cmd;
auto ADDRESS *vrfyqueue;
@@ -146,6 +146,7 @@ smtp(nullserver, e)
volatile int badcommands = 0; /* count of bad commands */
volatile int nverifies = 0; /* count of VRFY/EXPN commands */
volatile int n_etrn = 0; /* count of ETRN commands */
+ bool ok;
char inp[MAXLINE];
char cmdbuf[MAXLINE];
extern ENVELOPE BlankEnvelope;
@@ -169,7 +170,7 @@ smtp(nullserver, e)
CurSmtpClient = CurHostName;
setproctitle("server %s startup", CurSmtpClient);
-#ifdef LOG
+#if defined(LOG) && DAEMON
if (LogLevel > 11)
{
/* log connection information */
@@ -880,9 +881,10 @@ smtp(nullserver, e)
shortenstring(id, 203));
#endif
QueueLimitRecipient = id;
- runqueue(TRUE);
+ ok = runqueue(TRUE, TRUE);
QueueLimitRecipient = NULL;
- message("250 Queuing for node %s started", p);
+ if (ok)
+ message("250 Queuing for node %s started", p);
break;
case CMDHELP: /* help -- give user info */
@@ -929,7 +931,7 @@ doquit:
message("250 Initial submission");
break;
-# ifdef SMTPDEBUG
+# if SMTPDEBUG
case CMDDBGQSHOW: /* show queues */
printf("Send Queue=");
printaddr(e->e_sendqueue, TRUE);
@@ -1271,23 +1273,21 @@ runinchild(label, e)
register ENVELOPE *e;
{
pid_t childpid;
- sigfunc_t chldsig;
if (!OneXact)
{
/*
** Disable child process reaping, in case ETRN has preceeded
- ** MAIL command.
+ ** MAIL command, and then fork.
*/
-#ifdef SIGCHLD
- chldsig = setsignal(SIGCHLD, SIG_IGN);
-#endif
+ (void) blocksignal(SIGCHLD);
childpid = dofork();
if (childpid < 0)
{
syserr("451 %s: cannot fork", label);
+ (void) releasesignal(SIGCHLD);
return (1);
}
if (childpid > 0)
@@ -1310,10 +1310,8 @@ runinchild(label, e)
finis();
}
-#ifdef SIGCHLD
/* restore the child signal */
- (void) setsignal(SIGCHLD, chldsig);
-#endif
+ (void) releasesignal(SIGCHLD);
return (1);
}
@@ -1323,6 +1321,8 @@ runinchild(label, e)
InChild = TRUE;
QuickAbort = FALSE;
clearenvelope(e, FALSE);
+ (void) setsignal(SIGCHLD, SIG_DFL);
+ (void) releasesignal(SIGCHLD);
}
}
diff --git a/usr.sbin/sendmail/src/stab.c b/usr.sbin/sendmail/src/stab.c
index 5f707b1..a9d8736 100644
--- a/usr.sbin/sendmail/src/stab.c
+++ b/usr.sbin/sendmail/src/stab.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)stab.c 8.9 (Berkeley) 10/17/96";
+static char sccsid[] = "@(#)stab.c 8.10 (Berkeley) 11/23/96";
#endif /* not lint */
# include "sendmail.h"
@@ -131,7 +131,7 @@ stab(name, type, op)
printf("entered\n");
/* determine size of new entry */
-#ifdef FFR_MEMORY_MISER
+#ifdef _FFR_MEMORY_MISER
if (type >= ST_MCI)
len = sizeof s->s_mci;
else
diff --git a/usr.sbin/sendmail/src/udb.c b/usr.sbin/sendmail/src/udb.c
index 7342417..8c34c23 100644
--- a/usr.sbin/sendmail/src/udb.c
+++ b/usr.sbin/sendmail/src/udb.c
@@ -36,9 +36,9 @@
#ifndef lint
#if USERDB
-static char sccsid [] = "@(#)udb.c 8.42 (Berkeley) 9/18/96 (with USERDB)";
+static char sccsid [] = "@(#)udb.c 8.46 (Berkeley) 12/1/96 (with USERDB)";
#else
-static char sccsid [] = "@(#)udb.c 8.42 (Berkeley) 9/18/96 (without USERDB)";
+static char sccsid [] = "@(#)udb.c 8.46 (Berkeley) 12/1/96 (without USERDB)";
#endif
#endif
@@ -210,6 +210,7 @@ udbexpand(a, sendq, aliaslevel, e)
#endif
user = userbuf;
+ userbuf[0] = '\0';
usersize = sizeof userbuf;
userleft = sizeof userbuf - 1;
@@ -240,7 +241,8 @@ udbexpand(a, sendq, aliaslevel, e)
}
if (tTd(28, 80))
printf("udbexpand: match %.*s: %.*s\n",
- key.size, key.data, info.size, info.data);
+ (int) key.size, (char *) key.data,
+ (int) info.size, (char *) info.data);
a->q_flags &= ~QSELFREF;
while (i == 0 && key.size == keylen &&
@@ -272,7 +274,7 @@ udbexpand(a, sendq, aliaslevel, e)
*p++ = ',';
userleft--;
}
- bcopy(info.data, user, info.size);
+ bcopy(info.data, p, info.size);
user[info.size] = '\0';
userleft -= info.size;
@@ -817,6 +819,7 @@ _udbx_init()
{
char *spec;
int nopts;
+ int l;
# if 0
auto int rcode;
int nmx;
@@ -934,9 +937,20 @@ _udbx_init()
#ifdef NEWDB
case '/': /* look up remote name */
- up->udb_dbname = spec;
+ l = strlen(spec);
+ if (l > 3 && strcmp(&spec[l - 3], ".db") == 0)
+ {
+ up->udb_dbname = spec;
+ }
+ else
+ {
+ up->udb_dbname = xalloc(l + 4);
+ strcpy(up->udb_dbname, spec);
+ strcat(up->udb_dbname, ".db");
+ }
errno = 0;
- up->udb_dbp = dbopen(spec, O_RDONLY, 0644, DB_BTREE, NULL);
+ up->udb_dbp = dbopen(up->udb_dbname, O_RDONLY,
+ 0644, DB_BTREE, NULL);
if (up->udb_dbp == NULL)
{
if (tTd(28, 1))
@@ -944,7 +958,8 @@ _udbx_init()
int saveerrno = errno;
printf("dbopen(%s): %s",
- spec, errstring(errno));
+ up->udb_dbname,
+ errstring(errno));
errno = saveerrno;
}
if (errno != ENOENT && errno != EACCES)
@@ -952,11 +967,16 @@ _udbx_init()
#ifdef LOG
if (LogLevel > 2)
syslog(LOG_ERR, "dbopen(%s): %s",
- spec, errstring(errno));
+ up->udb_dbname,
+ errstring(errno));
#endif
up->udb_type = UDB_EOLIST;
+ if (up->udb_dbname != spec)
+ free(up->udb_dbname);
goto tempfail;
}
+ if (up->udb_dbname != spec)
+ free(up->udb_dbname);
break;
}
up->udb_type = UDB_DBFETCH;
@@ -978,7 +998,7 @@ badspec:
{
switch (up->udb_type)
{
-#ifdef DAEMON
+#if DAEMON
case UDB_REMOTE:
printf("REMOTE: addr %s, timeo %d\n",
anynet_ntoa((SOCKADDR *) &up->udb_addr),
diff --git a/usr.sbin/sendmail/src/usersmtp.c b/usr.sbin/sendmail/src/usersmtp.c
index 1be0d84..7bd976b 100644
--- a/usr.sbin/sendmail/src/usersmtp.c
+++ b/usr.sbin/sendmail/src/usersmtp.c
@@ -35,17 +35,17 @@
# include "sendmail.h"
#ifndef lint
-#ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.75 (Berkeley) 11/6/96 (with SMTP)";
+#if SMTP
+static char sccsid[] = "@(#)usersmtp.c 8.79 (Berkeley) 12/1/96 (with SMTP)";
#else
-static char sccsid[] = "@(#)usersmtp.c 8.75 (Berkeley) 11/6/96 (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.79 (Berkeley) 12/1/96 (without SMTP)";
#endif
#endif /* not lint */
# include <sysexits.h>
# include <errno.h>
-# ifdef SMTP
+# if SMTP
/*
** USERSMTP -- run SMTP protocol from the user end.
@@ -155,7 +155,7 @@ smtpinit(m, mci, e)
** My mother taught me to always introduce myself.
*/
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitnset(M_ESMTP, m->m_flags) || bitnset(M_LMTP, m->m_flags))
#else
if (bitnset(M_ESMTP, m->m_flags))
@@ -163,7 +163,7 @@ smtpinit(m, mci, e)
mci->mci_flags |= MCIF_ESMTP;
tryhelo:
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
{
smtpmessage("LHLO %s", m, mci, MyHostName);
@@ -188,7 +188,7 @@ tryhelo:
goto tempfail1;
else if (REPLYTYPE(r) == 5)
{
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitset(MCIF_ESMTP, mci->mci_flags) &&
!bitnset(M_LMTP, m->m_flags))
#else
@@ -214,7 +214,7 @@ tryhelo:
if (p != NULL)
*p = '\0';
if (!bitnset(M_NOLOOPCHECK, m->m_flags) &&
-#if FFR_LMTP
+#if _FFR_LMTP
!bitnset(M_LMTP, m->m_flags) &&
#endif
strcasecmp(&SmtpReplyBuffer[4], MyHostName) == 0)
@@ -418,7 +418,7 @@ smtpmailfrom(m, mci, e)
extern char MsgBuf[];
usrerr("%s does not support 8BITMIME", mci->mci_host);
- mci_setstat(mci, EX_DATAERR, "5.6.3", MsgBuf);
+ mci_setstat(mci, EX_NOTSTICKY, "5.6.3", MsgBuf);
return EX_DATAERR;
}
@@ -505,25 +505,25 @@ smtpmailfrom(m, mci, e)
else if (r == 501)
{
/* syntax error in arguments */
- mci_setstat(mci, EX_DATAERR, "5.5.2", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.5.2", SmtpReplyBuffer);
return EX_DATAERR;
}
else if (r == 553)
{
/* mailbox name not allowed */
- mci_setstat(mci, EX_DATAERR, "5.1.3", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.1.3", SmtpReplyBuffer);
return EX_DATAERR;
}
else if (r == 552)
{
/* exceeded storage allocation */
- mci_setstat(mci, EX_UNAVAILABLE, "5.2.2", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.2.2", SmtpReplyBuffer);
return EX_UNAVAILABLE;
}
else if (REPLYTYPE(r) == 5)
{
/* unknown error */
- mci_setstat(mci, EX_UNAVAILABLE, "5.0.0", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.0.0", SmtpReplyBuffer);
return EX_UNAVAILABLE;
}
@@ -654,6 +654,7 @@ smtprcpt(to, m, mci, e)
}
#endif
+ mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
return EX_PROTOCOL;
}
/*
@@ -719,6 +720,7 @@ smtpdata(m, mci, e)
}
#endif
smtprset(m, mci, e);
+ mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
return (EX_PROTOCOL);
}
@@ -770,14 +772,14 @@ smtpdata(m, mci, e)
/* terminate the message */
fprintf(mci->mci_out, ".%s", m->m_eol);
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> .\n", getpid());
+ fprintf(TrafficLogFile, "%05d >>> .\n", (int) getpid());
if (Verbose)
nmessage(">>> .");
/* check for the results of the transaction */
SmtpPhase = mci->mci_phase = "client DATA status";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
return EX_OK;
#endif
@@ -833,7 +835,7 @@ datatimeout()
** The exit status corresponding to the reply code.
*/
-#if FFR_LMTP
+#if _FFR_LMTP
int
smtpgetstat(m, mci, e)
@@ -1183,7 +1185,8 @@ smtpmessage(f, m, mci, va_alist)
if (tTd(18, 1) || Verbose)
nmessage(">>> %s", SmtpMsgBuffer);
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(), SmtpMsgBuffer);
+ fprintf(TrafficLogFile, "%05d >>> %s\n",
+ (int) getpid(), SmtpMsgBuffer);
if (mci->mci_out != NULL)
{
fprintf(mci->mci_out, "%s%s", SmtpMsgBuffer,
diff --git a/usr.sbin/sendmail/src/util.c b/usr.sbin/sendmail/src/util.c
index 822aaf35..eae587ba 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.109 (Berkeley) 11/16/96";
+static char sccsid[] = "@(#)util.c 8.113 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -215,7 +215,7 @@ printav(av)
while (*av != NULL)
{
if (tTd(0, 44))
- printf("\n\t%08x=", *av);
+ printf("\n\t%08lx=", (u_long) *av);
else
(void) putchar(' ');
xputs(*av++);
@@ -423,7 +423,6 @@ buildfname(gecos, login, buf, buflen)
{
register char *p;
register char *bp = buf;
- int l;
if (*gecos == '*')
gecos++;
@@ -507,7 +506,7 @@ safefile(fn, uid, gid, uname, flags, mode, st)
if (tTd(44, 4))
printf("safefile(%s, uid=%d, gid=%d, flags=%x, mode=%o):\n",
- fn, uid, gid, flags, mode);
+ fn, (int) uid, (int) gid, flags, mode);
errno = 0;
if (st == NULL)
st = &fstbuf;
@@ -635,8 +634,8 @@ safefile(fn, uid, gid, uname, flags, mode, st)
}
ret = errno;
if (tTd(44, 4))
- printf("\t[final dir %s uid %d mode %o] %s\n",
- fn, stbuf.st_uid, stbuf.st_mode,
+ printf("\t[final dir %s uid %d mode %lo] %s\n",
+ fn, (int) stbuf.st_uid, (u_long) stbuf.st_mode,
errstring(ret));
*p = '/';
st->st_mode = ST_MODE_NOFILE;
@@ -664,6 +663,12 @@ safefile(fn, uid, gid, uname, flags, mode, st)
printf("\t[exec bits %o]\tEPERM]\n", st->st_mode);
return EPERM;
}
+ if (st->st_nlink > 1)
+ {
+ if (tTd(44, 4))
+ printf("\t[link count %d]\tEPERM\n", st->st_nlink);
+ return EPERM;
+ }
if (uid == 0 && !bitset(SFF_ROOTOK, flags))
mode >>= 6;
@@ -690,8 +695,9 @@ safefile(fn, uid, gid, uname, flags, mode, st)
mode >>= 3;
}
if (tTd(44, 4))
- printf("\t[uid %d, stat %o, mode %o] ",
- st->st_uid, st->st_mode, mode);
+ printf("\t[uid %d, nlink %d, stat %lo, mode %lo] ",
+ (int) st->st_uid, (int) st->st_nlink,
+ (u_long) st->st_mode, (u_long) mode);
if ((st->st_uid == uid || st->st_uid == 0 ||
!bitset(SFF_MUSTOWN, flags)) &&
(st->st_mode & mode) == mode)
@@ -966,7 +972,7 @@ putxline(l, mci, pxflags)
p = &l[strlen(l)];
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> ", getpid());
+ fprintf(TrafficLogFile, "%05d >>> ", (int) getpid());
/* check for line overflow */
while (mci->mci_mailer->m_linelimit > 0 &&
@@ -998,7 +1004,7 @@ putxline(l, mci, pxflags)
(void) putc(' ', mci->mci_out);
if (TrafficLogFile != NULL)
fprintf(TrafficLogFile, "%s!\n%05d >>> ",
- l, getpid());
+ l, (int) getpid());
*q = svchar;
l = q;
slop = 1;
@@ -1087,7 +1093,7 @@ xfclose(fp, a, b)
char *a, *b;
{
if (tTd(53, 99))
- printf("xfclose(%x) %s %s\n", fp, a, b);
+ printf("xfclose(%lx) %s %s\n", (u_long) fp, a, b);
#if XDEBUG
if (fileno(fp) == 1)
syserr("xfclose(%s %s): fd = 1", a, b);
@@ -1178,11 +1184,11 @@ sfgets(buf, siz, fp, timeout, during)
{
buf[0] = '\0';
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< [EOF]\n", getpid());
+ fprintf(TrafficLogFile, "%05d <<< [EOF]\n", (int) getpid());
return (NULL);
}
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< %s", getpid(), buf);
+ fprintf(TrafficLogFile, "%05d <<< %s", (int) getpid(), buf);
if (SevenBitInput)
{
for (p = buf; *p != '\0'; p++)
@@ -2273,6 +2279,25 @@ proc_list_drop(pid)
CurChildren--;
}
/*
+** PROC_LIST_CLEAR -- clear the process list
+**
+** Parameters:
+** none.
+**
+** Returns:
+** none.
+*/
+
+void
+proc_list_clear()
+{
+ int i;
+
+ for (i = 0; i < ProcListSize; i++)
+ ProcListVec[i] = NO_PID;
+ CurChildren = 0;
+}
+ /*
** PROC_LIST_PROBE -- probe processes in the list to see if they still exist
**
** Parameters:
diff --git a/usr.sbin/sendmail/src/version.c b/usr.sbin/sendmail/src/version.c
index 8a53f29..617e11a 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.3.2 (Berkeley) 11/16/96";
+static char sccsid[] = "@(#)version.c 8.8.4.4 (Berkeley) 12/2/96";
#endif /* not lint */
-char Version[] = "8.8.3";
+char Version[] = "8.8.4";
diff --git a/usr.sbin/sendmail/test/Results b/usr.sbin/sendmail/test/Results
index 9645d73..e889cad 100644
--- a/usr.sbin/sendmail/test/Results
+++ b/usr.sbin/sendmail/test/Results
@@ -25,6 +25,7 @@ Solaris 2.1
Solaris 2.2 FAIL 93.07.19 Bill Wisner
Solaris 2.3 FAIL 95.11.22 Scott J. Kramer <sjk@lux.com>
Solaris 2.5 OK 96.02.29 Carson Gaspar <carson@lehman.com>
+Solaris 2.5.1 OK 96.11.29 Gregory Neil Shapiro <gshapiro@wpi.edu>
OSF/1 T1.3-4 OK 93.07.19 eric (on DEC Alpha)
OSF/1 1.3 OK 94.12.10 Jeff A. Earickson (on Intel Paragon)
@@ -75,6 +76,7 @@ OPSYS VERSION STATUS DATE TESTER/NOTES
Solaris 2.3 OK 95.11.22 Scott J. Kramer <sjk@lux.com>
Solaris 2.4 OK 95.09.22 Thomas 'Mike' Michlmayr <mike@cosy.sbg.ac.at>
Solaris 2.5 OK 96.02.29 Carson Gaspar <carson@lehman.com>
+Solaris 2.5.1 OK 96.11.29 Gregory Neil Shapiro <gshapiro@wpi.edu>
Linux 1.2.13 FAIL 95.11.02 Sven Neuhaus <sven@ping.de>
Linux 2.0.17 FAIL 96.09.03 Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
OpenPOWER on IntegriCloud