summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sendmail
diff options
context:
space:
mode:
authorjbeck <none@none>2008-05-06 15:38:08 -0700
committerjbeck <none@none>2008-05-06 15:38:08 -0700
commitd4660949aa62dd6a963f4913b7120b383cf473c4 (patch)
treeb6919c6cad1694779435c3b1c314dcb04e56dc69 /usr/src/cmd/sendmail
parentec923578dda4b00379ef69992f7046a207e57328 (diff)
downloadillumos-joyent-d4660949aa62dd6a963f4913b7120b383cf473c4.tar.gz
PSARC 2008/042 automated building of sendmail configuration files
PSARC 2008/298 sendmail local daemon mode PSARC 2008/299 makemap -t/-u clarification 6330693 teach sendmail start method to build config files automatically 6690390 etrn can use the new common Perl build rule 6690815 sendmail needs a local daemon mode 6697415 upgrade sendmail to 8.14.3 --HG-- rename : usr/src/cmd/sendmail/cf/cf/local.mc => deleted_files/usr/src/cmd/sendmail/cf/cf/local.mc
Diffstat (limited to 'usr/src/cmd/sendmail')
-rw-r--r--usr/src/cmd/sendmail/aux/Makefile6
-rw-r--r--usr/src/cmd/sendmail/aux/makemap.c7
-rw-r--r--usr/src/cmd/sendmail/cf/Makefile8
-rw-r--r--usr/src/cmd/sendmail/cf/README6
-rw-r--r--usr/src/cmd/sendmail/cf/cf/Makefile4
-rw-r--r--usr/src/cmd/sendmail/cf/cf/local.mc44
-rw-r--r--usr/src/cmd/sendmail/cf/m4/proto.m412
-rw-r--r--usr/src/cmd/sendmail/cf/m4/version.m46
-rw-r--r--usr/src/cmd/sendmail/cf/sh/makeinfo.sh10
-rw-r--r--usr/src/cmd/sendmail/include/libmilter/mfapi.h6
-rw-r--r--usr/src/cmd/sendmail/lib/smtp-sendmail82
-rw-r--r--usr/src/cmd/sendmail/lib/smtp-sendmail.xml14
-rw-r--r--usr/src/cmd/sendmail/libmilter/engine.c9
-rw-r--r--usr/src/cmd/sendmail/libmilter/worker.c6
-rw-r--r--usr/src/cmd/sendmail/src/Makefile6
-rw-r--r--usr/src/cmd/sendmail/src/collect.c5
-rw-r--r--usr/src/cmd/sendmail/src/conf.c23
-rw-r--r--usr/src/cmd/sendmail/src/daemon.c18
-rw-r--r--usr/src/cmd/sendmail/src/envelope.c16
-rw-r--r--usr/src/cmd/sendmail/src/main.c14
-rw-r--r--usr/src/cmd/sendmail/src/mci.c29
-rw-r--r--usr/src/cmd/sendmail/src/parseaddr.c9
-rw-r--r--usr/src/cmd/sendmail/src/queue.c8
-rw-r--r--usr/src/cmd/sendmail/src/ratectrl.c4
-rw-r--r--usr/src/cmd/sendmail/src/readcf.c20
-rw-r--r--usr/src/cmd/sendmail/src/sendmail.h20
-rw-r--r--usr/src/cmd/sendmail/src/sfsasl.c28
-rw-r--r--usr/src/cmd/sendmail/src/sm_resolve.c6
-rw-r--r--usr/src/cmd/sendmail/src/srvrsmtp.c53
-rw-r--r--usr/src/cmd/sendmail/src/usersmtp.c5
-rw-r--r--usr/src/cmd/sendmail/src/util.c9
-rw-r--r--usr/src/cmd/sendmail/src/version.c6
32 files changed, 326 insertions, 173 deletions
diff --git a/usr/src/cmd/sendmail/aux/Makefile b/usr/src/cmd/sendmail/aux/Makefile
index af6aa7c2a8..d33d07e754 100644
--- a/usr/src/cmd/sendmail/aux/Makefile
+++ b/usr/src/cmd/sendmail/aux/Makefile
@@ -18,7 +18,7 @@
#
# CDDL HEADER END
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -117,10 +117,6 @@ mailstats: mailstats.o ../libsmutil/libsmutil.a ../libsm/libsm.a
../libsm/libsm.a
$(POST_PROCESS)
-etrn%: etrn%.pl
- $(CP) -f $< $@
- $(CHMOD) +x $@
-
install: all $(ROOTPROG) $(ROOTLIB)/mail.local $(ROOTLIB)/smrsh \
$(ROOTUSRSBIN)/makemap $(ROOTUSRSBIN)/etrn $(ROOTUSRSBIN)/editmap
diff --git a/usr/src/cmd/sendmail/aux/makemap.c b/usr/src/cmd/sendmail/aux/makemap.c
index 7ebd7353ef..d887386ffc 100644
--- a/usr/src/cmd/sendmail/aux/makemap.c
+++ b/usr/src/cmd/sendmail/aux/makemap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002, 2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002, 2004, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
@@ -22,7 +22,7 @@ SM_IDSTR(copyright,
Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n")
-SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.178 2007/05/11 18:45:39 ca Exp $")
+SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.179 2008/04/14 02:06:16 ca Exp $")
#include <sys/types.h>
@@ -380,9 +380,10 @@ main(argc, argv)
break;
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
- "%.*s\t%.*s\n",
+ "%.*s%c%.*s\n",
(int) db_key.size,
(char *) db_key.data,
+ (sep != '\0') ? sep : '\t',
(int) db_val.size,
(char *)db_val.data);
diff --git a/usr/src/cmd/sendmail/cf/Makefile b/usr/src/cmd/sendmail/cf/Makefile
index dc4316acb2..09ee107a73 100644
--- a/usr/src/cmd/sendmail/cf/Makefile
+++ b/usr/src/cmd/sendmail/cf/Makefile
@@ -20,7 +20,7 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -30,9 +30,9 @@
include ../../Makefile.cmd
-CFS= sendmail.cf submit.cf local.cf
+CFS= sendmail.cf submit.cf
-SUBCFS= cf/sendmail.cf cf/submit.cf cf/local.cf
+SUBCFS= cf/sendmail.cf cf/submit.cf
COMMONM4FILES= m4/version.m4 m4/cf.m4 m4/cfhead.m4 m4/proto.m4 \
ostype/solaris8.m4 domain/solaris-generic.m4 \
@@ -46,8 +46,6 @@ ROOTETCMAILCF = $(ROOTETCMAIL)/cf
BUILDPARTS = $(ROOTETCMAILCF)/README \
$(ROOTETCMAILCF)/cf/Makefile \
- $(ROOTETCMAILCF)/cf/local.cf \
- $(ROOTETCMAILCF)/cf/local.mc \
$(ROOTETCMAILCF)/cf/sendmail.cf \
$(ROOTETCMAILCF)/cf/sendmail.mc \
$(ROOTETCMAILCF)/cf/submit.cf \
diff --git a/usr/src/cmd/sendmail/cf/README b/usr/src/cmd/sendmail/cf/README
index 0370892206..8f6e7984ed 100644
--- a/usr/src/cmd/sendmail/cf/README
+++ b/usr/src/cmd/sendmail/cf/README
@@ -866,7 +866,9 @@ virtusertable A domain-specific form of aliasing, allowing multiple
MASQUERADE_DOMAIN_FILE, see below). If VIRTUSER_DOMAIN or
VIRTUSER_DOMAIN_FILE is used, then the entries of class
{VirtHost} are added to class {R}, i.e., relaying is allowed
- to (and from) those domains. The default map definition is:
+ to (and from) those domains, which by default includes also
+ all subdomains (see relay_hosts_only). The default map
+ definition is:
hash /etc/mail/virtusertable
@@ -4306,5 +4308,5 @@ M4 DIVERSIONS
8 DNS based blacklists
9 special local rulesets (1 and 2)
-$Revision: 8.722 $, Last updated $Date: 2007/04/03 21:26:58 $
+$Revision: 8.724 $, Last updated $Date: 2008/02/15 23:05:32 $
ident "%Z%%M% %I% %E% SMI"
diff --git a/usr/src/cmd/sendmail/cf/cf/Makefile b/usr/src/cmd/sendmail/cf/cf/Makefile
index 80eb5deeab..b2ad71b2aa 100644
--- a/usr/src/cmd/sendmail/cf/cf/Makefile
+++ b/usr/src/cmd/sendmail/cf/cf/Makefile
@@ -22,7 +22,7 @@
#
# Makefile for configuration files.
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# @(#)Makefile 8.15 (Berkeley) 3/29/98
@@ -49,7 +49,7 @@ RM= /usr/bin/rm -f
test ! -f $@ || $(MV) $@ $@.prev
$(M4) ${CFDIR}/m4/cf.m4 $*.mc > $@
-ALL= sendmail.cf submit.cf local.cf
+ALL= sendmail.cf submit.cf
all: $(ALL)
diff --git a/usr/src/cmd/sendmail/cf/cf/local.mc b/usr/src/cmd/sendmail/cf/cf/local.mc
deleted file mode 100644
index 0ccf2f935f..0000000000
--- a/usr/src/cmd/sendmail/cf/cf/local.mc
+++ /dev/null
@@ -1,44 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 1983 Eric P. Allman
-# Copyright (c) 1988, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# This is a configuration file for SunOS 5.8 (a.k.a. Solaris 8) and later
-# subsidiary machines. It has support for local and SMTP mail. The
-# confFALLBACK_SMARTHOST macro is enabled, which means that messages will
-# be sent to that host (which is set to mailhost.$m [$m is the local domain])
-# if MX records are unavailable. A short-cut rule is also defined, which
-# says if the recipient host is in the local domain, send to it directly
-# instead of the smart host.
-#
-# Furthermore, this configuration file defines IPv4 localhost-binding
-# addresses for the MTA and MSA daemons causing the daemons to listen to
-# traffic from the local-host only.
-#
-# This configuration file will be chosen by the sendmail start method if
-# the config/local_only property of svc:/network/smtp:sendmail is set to
-# "true". To have the daemons listen to external connections, set
-# config/local_only to "false" and restart sendmail.
-#
-# If you want to customize this file in any other way, copy it to a name
-# appropriate for your environment and do the modifications there.
-
-divert(0)dnl
-VERSIONID(`%W% (Sun) %G%')
-OSTYPE(`solaris8')dnl
-DOMAIN(`solaris-generic')dnl
-define(`confFALLBACK_SMARTHOST', `mailhost$?m.$m$.')dnl
-FEATURE(`no_default_msa')dnl
-DAEMON_OPTIONS(`NAME=NoMTA4, Family=inet, Addr=127.0.0.1')dnl
-DAEMON_OPTIONS(`Name=MSA4, Family=inet, Addr=127.0.0.1, Port=587, M=E')dnl
-MAILER(`local')dnl
-MAILER(`smtp')dnl
-
-LOCAL_NET_CONFIG
-R$* < @ $* .$m. > $* $#esmtp $@ $2.$m $: $1 < @ $2.$m. > $3
diff --git a/usr/src/cmd/sendmail/cf/m4/proto.m4 b/usr/src/cmd/sendmail/cf/m4/proto.m4
index 692f2e6f30..c3561723c6 100644
--- a/usr/src/cmd/sendmail/cf/m4/proto.m4
+++ b/usr/src/cmd/sendmail/cf/m4/proto.m4
@@ -18,7 +18,7 @@ divert(-1)
#
divert(0)
-VERSIONID(`$Id: proto.m4,v 8.732 2007/04/20 00:53:30 ca Exp $')
+VERSIONID(`$Id: proto.m4,v 8.734 2008/01/24 23:42:01 ca Exp $')
# level CF_LEVEL config file format
V`'CF_LEVEL/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Sun')
@@ -1961,7 +1961,7 @@ R<MX><$+><:$*<TEMP>:><$*> $#error $@ 4.1.2 $: "450 MX lookup failure for "$1
# Recursively run badmx check on each mx.
R<MX><$*><:$+:$*><:$*> <MX><$1><:$3><: $4 $(badmx $2 $):>
# See if any of them fail.
-R<MX><$*><$*><$*<BADMX>:$*> $#error $@ 5.1.2 $:"550 Illegal MX record for recipient host "$1
+R<MX><$*><$*><$*<BADMX>:$*> $#error $@ 5.1.2 $:"550 Illegal MX record for host "$1
# Reverse the mxlists so we can use the same argument order again.
R<MX><$*><$*><$*> $:<MX><$1><$3><$2>
R<MX><$*><:$+:$*><:$*> <MX><$1><:$3><:$4 $(dnsA $2 $) :>
@@ -1970,7 +1970,7 @@ R<MX><$*><:$+:$*><:$*> <MX><$1><:$3><:$4 $(dnsA $2 $) :>
R<MX><$*><$*><$*> $:<MX><$1><$3><$2>
R<MX><$*><:$+:$*><:$*> <MX><$1><:$3><:$4 $(BadMXIP $2 $) :>
-R<MX><$*><$*><$*<BADMXIP>:$*> $#error $@ 5.1.2 $:"550 Invalid MX record for recipient host "$1',
+R<MX><$*><$*><$*<BADMXIP>:$*> $#error $@ 5.1.2 $:"550 Invalid MX record for host "$1',
`dnl')
@@ -2691,9 +2691,9 @@ dnl MAIL: called from check_mail
dnl STARTTLS: called from smtp() after STARTTLS has been accepted
Stls_client
ifdef(`_LOCAL_TLS_CLIENT_', `dnl
-R$* $: $1 $| $>"Local_tls_client" $1
-R$* $| $#$* $#$2
-R$* $| $* $: $1', `dnl')
+R$* $: $1 <?> $>"Local_tls_client" $1
+R$* <?> $#$* $#$2
+R$* <?> $* $: $1', `dnl')
ifdef(`_ACCESS_TABLE_', `dnl
dnl store name of other side
R$* $: $(macro {TLS_Name} $@ $&{server_name} $) $1
diff --git a/usr/src/cmd/sendmail/cf/m4/version.m4 b/usr/src/cmd/sendmail/cf/m4/version.m4
index ce70aefff7..68e51c3041 100644
--- a/usr/src/cmd/sendmail/cf/m4/version.m4
+++ b/usr/src/cmd/sendmail/cf/m4/version.m4
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+# Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
@@ -12,8 +12,8 @@ divert(-1)
#
# ident "%Z%%M% %I% %E% SMI"
#
-VERSIONID(`$Id: version.m4,v 8.186 2007/10/31 16:04:13 ca Exp $')
+VERSIONID(`$Id: version.m4,v 8.195 2008/04/17 17:04:30 ca Exp $')
#
divert(0)
# Configuration version number
-DZ8.14.2`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.14.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/usr/src/cmd/sendmail/cf/sh/makeinfo.sh b/usr/src/cmd/sendmail/cf/sh/makeinfo.sh
index 0a1deead5c..6f684b4a55 100644
--- a/usr/src/cmd/sendmail/cf/sh/makeinfo.sh
+++ b/usr/src/cmd/sendmail/cf/sh/makeinfo.sh
@@ -4,8 +4,8 @@
# Copyright (c) 1988, 1993
# The Regents of the University of California. All rights reserved.
#
-# Copyright (c) 1998
-# Sun Microsystems, Inc. All rights reserved.
+# Copyright 1998, 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -89,7 +89,11 @@ if [ $quiet -eq 1 ]
then
echo '#####' built on `date`
else
- echo '#####' built by $user@$host on `date`
+ if [ -n "$user" ]; then
+ echo '#####' built by $user@$host on `date`
+ else
+ echo '#####' built automatically @$host on `date`
+ fi
echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//'
echo "define(\`__HOST__', $host)dnl"
diff --git a/usr/src/cmd/sendmail/include/libmilter/mfapi.h b/usr/src/cmd/sendmail/include/libmilter/mfapi.h
index 69f97ef5dd..72feadc014 100644
--- a/usr/src/cmd/sendmail/include/libmilter/mfapi.h
+++ b/usr/src/cmd/sendmail/include/libmilter/mfapi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2004, 2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2004, 2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -7,7 +7,7 @@
* the sendmail distribution.
*
*
- * $Id: mfapi.h,v 8.77 2006/11/02 02:44:07 ca Exp $
+ * $Id: mfapi.h,v 8.78 2008/02/28 22:30:34 ca Exp $
*/
/*
@@ -24,7 +24,7 @@ extern "C" {
#endif
#ifndef SMFI_VERSION
-#define SMFI_VERSION 0x01000000 /* libmilter version number */
+#define SMFI_VERSION 0x01000001 /* libmilter version number */
#endif /* ! SMFI_VERSION */
#define SM_LM_VRS_MAJOR(v) (((v) & 0x7f000000) >> 24)
diff --git a/usr/src/cmd/sendmail/lib/smtp-sendmail b/usr/src/cmd/sendmail/lib/smtp-sendmail
index 4811c9d06e..a95468b5f5 100644
--- a/usr/src/cmd/sendmail/lib/smtp-sendmail
+++ b/usr/src/cmd/sendmail/lib/smtp-sendmail
@@ -19,7 +19,7 @@
#
# CDDL HEADER END
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -32,6 +32,11 @@ SERVER_PID_FILE="/var/run/sendmail.pid"
CLIENT_PID_FILE="/var/spool/clientmqueue/sm-client.pid"
DEFAULT_FILE="/etc/default/sendmail"
ALIASES_FILE="/etc/mail/aliases"
+SENDMAIL_CF="/etc/mail/sendmail.cf"
+SUBMIT_CF="/etc/mail/submit.cf"
+SENDMAIL="/usr/lib/sendmail"
+PATH="/usr/bin:/usr/sbin:/usr/ccs/bin"
+export PATH
check_queue_interval_syntax()
{
@@ -54,6 +59,58 @@ check_and_kill()
[ $? -eq 0 ] && kill $PID
}
+exist_or_exit()
+{
+ if [ ! -f $1 ]; then
+ echo "$1 does not exist"
+ exit $SMF_EXIT_ERR_CONFIG
+ fi
+}
+
+turn_m4_crank()
+{
+ # expected to be called with two arguments: .cf path & path to m4 file
+ [ $# -lt 2 ] && return
+ cf_path=$1
+ m4_path=$2
+ case "$m4_path" in
+ /*) ;; # absolute path
+ *) return;;
+ esac
+ if [ "$m4_path" = "_DONT_TOUCH_THIS" ]; then
+ if [ -f "${cf_path}.old" ]; then
+ mv "$cf_path" "${cf_path}.new"
+ [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+ mv "${cf_path}.old" "$cf_path"
+ [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+ fi
+ #
+ # If ${cf_path}.old does not exist, assume it was taken care
+ # of on a previous run.
+ #
+ else
+ exist_or_exit "$m4_path"
+ cd `dirname "$m4_path"`
+ base=`basename "$m4_path"`
+ name=`basename "$m4_path" .mc`
+ info=`svcprop -p config/include_info $SMF_FMRI 2>/dev/null`
+ if [ "$info" = "true" ]; then
+ m4flags=""
+ else
+ m4flags="-DSUN_HIDE_INTERNAL_DETAILS"
+ fi
+ m4 $m4flags /etc/mail/cf/m4/cf.m4 "$base" > "${name}.cf"
+ [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+ cmp -s "${name}.cf" "$cf_path" || (
+ cp "${name}.cf" "${cf_path}.tmp" &&
+ chown root:bin "${cf_path}.tmp" &&
+ chmod 444 "${cf_path}.tmp" &&
+ mv "${cf_path}.tmp" "$cf_path"
+ )
+ [ $? -ne 0 ] && exit $SMF_EXIT_ERR_CONFIG
+ fi
+}
+
case "$1" in
'refresh')
[ -f $SERVER_PID_FILE ] && kill -1 `head -1 $SERVER_PID_FILE`
@@ -61,9 +118,7 @@ case "$1" in
;;
'start')
- if [ ! -f /usr/lib/sendmail -o ! -f /etc/mail/sendmail.cf ]; then
- exit $SMF_EXIT_ERR_CONFIG
- fi
+ exist_or_exit $SENDMAIL
if [ ! -d /var/spool/mqueue ]; then
/usr/bin/mkdir -m 0750 /var/spool/mqueue
/usr/bin/chown root:bin /var/spool/mqueue
@@ -93,12 +148,23 @@ case "$1" in
CLIENTQUEUEINTERVAL=$answer
local=`/usr/bin/svcprop -p config/local_only $SMF_FMRI 2>/dev/null`
- if [ $? = 0 -a "$local" = "true" ]; then
- OPTIONS="$OPTIONS -C /etc/mail/local.cf"
+ if [ $? -eq 0 -a "$local" = "true" ]; then
+ MODE="-bl"
+ fi
+ sendmail_path=`svcprop -p config/path_to_sendmail_mc $SMF_FMRI \
+ 2>/dev/null`
+ if [ $? -eq 0 -a -n "$sendmail_path" ]; then
+ turn_m4_crank $SENDMAIL_CF $sendmail_path
+ fi
+ exist_or_exit $SENDMAIL_CF
+ submit_path=`svcprop -p config/path_to_submit_mc $SMF_FMRI 2>/dev/null`
+ if [ $? -eq 0 -a -n "$submit_path" ]; then
+ turn_m4_crank $SUBMIT_CF $submit_path
fi
+ exist_or_exit $SUBMIT_CF
- /usr/lib/sendmail $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
- /usr/lib/sendmail -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS &
+ $SENDMAIL $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
+ $SENDMAIL -Ac -q$CLIENTQUEUEINTERVAL $CLIENTOPTIONS &
#
# ETRN_HOSTS should be of the form
diff --git a/usr/src/cmd/sendmail/lib/smtp-sendmail.xml b/usr/src/cmd/sendmail/lib/smtp-sendmail.xml
index 4246ff654d..0fabe38405 100644
--- a/usr/src/cmd/sendmail/lib/smtp-sendmail.xml
+++ b/usr/src/cmd/sendmail/lib/smtp-sendmail.xml
@@ -20,7 +20,7 @@
CDDL HEADER END
- Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ Copyright 2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
ident "%Z%%M% %I% %E% SMI"
@@ -156,10 +156,14 @@
</property_group>
<property_group name='config' type='application'>
- <propval
- name='local_only'
- type='boolean'
- value='false' />
+ <propval name='include_info'
+ type='boolean' value='false' />
+ <propval name='local_only'
+ type='boolean' value='false' />
+ <propval name='path_to_sendmail_mc'
+ type='astring' value='' />
+ <propval name='path_to_submit_mc'
+ type='astring' value='' />
<propval name='value_authorization' type='astring'
value='solaris.smf.value.sendmail' />
</property_group>
diff --git a/usr/src/cmd/sendmail/libmilter/engine.c b/usr/src/cmd/sendmail/libmilter/engine.c
index 9e32ccbc82..b10a926dd3 100644
--- a/usr/src/cmd/sendmail/libmilter/engine.c
+++ b/usr/src/cmd/sendmail/libmilter/engine.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2004, 2006, 2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2004, 2006-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: engine.c,v 8.159 2007/04/23 22:22:50 ca Exp $")
+SM_RCSID("@(#)$Id: engine.c,v 8.162 2008/02/27 01:34:14 ca Exp $")
#include "libmilter.h"
@@ -1003,6 +1003,7 @@ st_optionneg(g)
(long) ctx->ctx_id, ctx->ctx_mta_pflags, i);
return _SMFIS_ABORT;
}
+ fix_stm(ctx);
if (ctx->ctx_dbg > 3)
sm_dprintf("[%ld] milter_negotiate:"
@@ -1727,9 +1728,9 @@ mi_rd_socket_ready (sd)
int n;
int nerr = 0;
#if SM_CONF_POLL
- struct pollfd pfd;
+ struct pollfd pfd;
#else /* SM_CONF_POLL */
- fd_set rd_set, exc_set;
+ fd_set rd_set, exc_set;
#endif /* SM_CONF_POLL */
do
diff --git a/usr/src/cmd/sendmail/libmilter/worker.c b/usr/src/cmd/sendmail/libmilter/worker.c
index 348ea41543..929c94ca92 100644
--- a/usr/src/cmd/sendmail/libmilter/worker.c
+++ b/usr/src/cmd/sendmail/libmilter/worker.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2004, 2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2003-2004, 2007 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -13,7 +13,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: worker.c,v 8.9 2006/12/18 18:26:51 ca Exp $")
+SM_RCSID("@(#)$Id: worker.c,v 8.10 2007/12/03 22:06:05 ca Exp $")
#include "libmilter.h"
@@ -265,8 +265,6 @@ mi_pool_controller_init()
return MI_FAILURE;
}
- POOL_LEV_DPRINTF(4, ("PIPE r=[%d] w=[%d]", RD_PIPE, WR_PIPE));
-
(void) smutex_init(&Tskmgr.tm_w_mutex);
(void) scond_init(&Tskmgr.tm_w_cond);
diff --git a/usr/src/cmd/sendmail/src/Makefile b/usr/src/cmd/sendmail/src/Makefile
index 0130839df5..fe552e9f47 100644
--- a/usr/src/cmd/sendmail/src/Makefile
+++ b/usr/src/cmd/sendmail/src/Makefile
@@ -48,8 +48,8 @@ LDFLAGS += -R$(SFW_ROOT)/lib $(MAPFILES:%=-M%)
CRYPTOLIBS= -lssl -lcrypto
# EXPORT DELETE END
LDLIBS += ../libsmutil/libsmutil.a ../libsm/libsm.a -lresolv -lsocket \
- -lnsl ../db/libdb.a -lldap -lsldap -lwrap -L$(ROOTSFWLIB) \
- $(CRYPTOLIBS)
+ -lnsl ../db/libdb.a -lldap -lsldap -lwrap -lumem \
+ -L$(ROOTSFWLIB) $(CRYPTOLIBS)
INCPATH= -I. -I../include -I../db -I$(ROOTSFWINCLUDE)
@@ -58,7 +58,7 @@ CRYPTOENVDEF= -DSTARTTLS
# EXPORT DELETE END
ENVDEF= -DNETINET6 -DTCPWRAPPERS $(CRYPTOENVDEF)
SUNENVDEF= -DSUN_EXTENSIONS -DVENDOR_DEFAULT=VENDOR_SUN \
- -DSUN_INIT_DOMAIN -DSUN_SIMPLIFIED_LDAP
+ -DSUN_INIT_DOMAIN -DSUN_SIMPLIFIED_LDAP -D_FFR_LOCAL_DAEMON
CPPFLAGS = $(INCPATH) $(ENVDEF) $(SUNENVDEF) $(DBMDEF) $(CPPFLAGS.sm)
diff --git a/usr/src/cmd/sendmail/src/collect.c b/usr/src/cmd/sendmail/src/collect.c
index 4440709b8a..6c26e4075b 100644
--- a/usr/src/cmd/sendmail/src/collect.c
+++ b/usr/src/cmd/sendmail/src/collect.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -15,7 +15,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: collect.c,v 8.280 2006/11/29 00:20:40 ca Exp $")
+SM_RCSID("@(#)$Id: collect.c,v 8.282 2008/01/31 18:48:29 ca Exp $")
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
@@ -310,6 +310,7 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
dbto = smtpmode ? ((int) TimeOuts.to_datablock * 1000)
: SM_TIME_FOREVER;
sm_io_setinfo(fp, SM_IO_WHAT_TIMEOUT, &dbto);
+ set_tls_rd_tmo(TimeOuts.to_datablock);
c = SM_IO_EOF;
inputerr = false;
headeronly = hdrp != NULL;
diff --git a/usr/src/cmd/sendmail/src/conf.c b/usr/src/cmd/sendmail/src/conf.c
index 688f07d54f..cb5337e012 100644
--- a/usr/src/cmd/sendmail/src/conf.c
+++ b/usr/src/cmd/sendmail/src/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -20,7 +20,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: conf.c,v 8.1136 2007/10/10 00:06:45 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.1141 2008/04/14 02:09:35 ca Exp $")
SM_IDSTR(i2, "%W% (Sun) %G%")
#include <sm/sendmail.h>
@@ -1521,7 +1521,7 @@ getla()
sm_dprintf("getla: symbol address = %#lx\n",
(unsigned 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))
+ read(kmem, (char *) avenrun, sizeof(avenrun)) != sizeof(avenrun))
{
/* thank you Ian */
if (tTd(3, 1))
@@ -1843,7 +1843,7 @@ getla(void)
if (lseek(kmem, CAST_SYSMP(sysmp(MP_KERNADDR, MPKA_AVENRUN)), SEEK_SET)
== -1 ||
- read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
+ read(kmem, (char *) avenrun, sizeof(avenrun)) != sizeof(avenrun))
{
if (tTd(3, 1))
sm_dprintf("getla: lseek or read: %s\n",
@@ -1951,6 +1951,13 @@ getla()
}
r = read(afd, &avenrun, sizeof(avenrun));
+ if (r != sizeof(avenrun))
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "can't read %s: %s", _PATH_AVENRUN,
+ r == -1 ? sm_errstring(errno) : "short read");
+ return -1;
+ }
if (tTd(3, 5))
sm_dprintf("getla: avenrun = %d\n", avenrun);
@@ -6032,6 +6039,10 @@ char *FFRCompileOptions[] =
/* DefaultAuthInfo doesn't really work in 8.13 anymore. */
"_FFR_ALLOW_SASLINFO",
#endif /* _FFR_ALLOW_SASLINFO */
+#if _FFR_BADRCPT_SHUTDOWN
+ /* shut down connection (421) if there are too many bad RCPTs */
+ "_FFR_BADRCPT_SHUTDOWN",
+#endif /* _FFR_BADRCPT_SHUTDOWN */
#if _FFR_BESTMX_BETTER_TRUNCATION
/* Better truncation of list of MX records for dns map. */
"_FFR_BESTMX_BETTER_TRUNCATION",
@@ -6172,6 +6183,10 @@ char *FFRCompileOptions[] =
/* Ignore extensions offered in response to HELO */
"_FFR_IGNORE_EXT_ON_HELO",
#endif /* _FFR_IGNORE_EXT_ON_HELO */
+#if _FFR_LOCAL_DAEMON
+ /* Local daemon mode (-bl) which only accepts loopback connections */
+ "_FFR_LOCAL_DAEMON",
+#endif /* _FFR_LOCAL_DAEMON */
#if _FFR_MAXDATASIZE
/*
** It is possible that a header is larger than MILTER_CHUNK_SIZE,
diff --git a/usr/src/cmd/sendmail/src/daemon.c b/usr/src/cmd/sendmail/src/daemon.c
index 1d3c41a934..0a8d580185 100644
--- a/usr/src/cmd/sendmail/src/daemon.c
+++ b/usr/src/cmd/sendmail/src/daemon.c
@@ -16,7 +16,7 @@
#include <sendmail.h>
#include "map.h"
-SM_RCSID("@(#)$Id: daemon.c,v 8.678 2007/03/08 00:33:40 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.680 2008/02/14 00:20:26 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -1259,7 +1259,8 @@ setupdaemon(daemonaddr)
#if NETINET
case AF_INET:
if (daemonaddr->sin.sin_addr.s_addr == 0)
- daemonaddr->sin.sin_addr.s_addr = INADDR_ANY;
+ daemonaddr->sin.sin_addr.s_addr =
+ LocalDaemon ? htonl(INADDR_LOOPBACK) : INADDR_ANY;
port = daemonaddr->sin.sin_port;
break;
#endif /* NETINET */
@@ -1267,7 +1268,8 @@ setupdaemon(daemonaddr)
#if NETINET6
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&daemonaddr->sin6.sin6_addr))
- daemonaddr->sin6.sin6_addr = in6addr_any;
+ daemonaddr->sin6.sin6_addr =
+ LocalDaemon ? in6addr_loopback : in6addr_any;
port = daemonaddr->sin6.sin6_port;
break;
#endif /* NETINET6 */
@@ -2206,7 +2208,8 @@ makeconnection(host, port, mci, e, enough)
#if NETINET
case AF_INET:
if (clt_addr.sin.sin_addr.s_addr == 0)
- clt_addr.sin.sin_addr.s_addr = INADDR_ANY;
+ clt_addr.sin.sin_addr.s_addr = LocalDaemon ?
+ htonl(INADDR_LOOPBACK) : INADDR_ANY;
else
clt_bind = true;
if (clt_addr.sin.sin_port != 0)
@@ -2217,7 +2220,8 @@ makeconnection(host, port, mci, e, enough)
#if NETINET6
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&clt_addr.sin6.sin6_addr))
- clt_addr.sin6.sin6_addr = in6addr_any;
+ clt_addr.sin6.sin6_addr = LocalDaemon ?
+ in6addr_loopback : in6addr_any;
else
clt_bind = true;
socksize = sizeof(struct sockaddr_in6);
@@ -3276,7 +3280,7 @@ myhostname(hostbuf, size)
if (strchr(hostbuf, '.') == NULL &&
!getcanonname(hostbuf, size, true, NULL))
{
- sm_syslog(LOG_CRIT, NOQID,
+ sm_syslog(LocalDaemon ? LOG_WARNING : LOG_CRIT, NOQID,
"My unqualified host name (%s) unknown; sleeping for retry",
hostbuf);
message("My unqualified host name (%s) unknown; sleeping for retry",
@@ -3284,7 +3288,7 @@ myhostname(hostbuf, size)
(void) sleep(60);
if (!getcanonname(hostbuf, size, true, NULL))
{
- sm_syslog(LOG_ALERT, NOQID,
+ sm_syslog(LocalDaemon ? LOG_WARNING : LOG_ALERT, NOQID,
"unable to qualify my own domain name (%s) -- using short name",
hostbuf);
message("WARNING: unable to qualify my own domain name (%s) -- using short name",
diff --git a/usr/src/cmd/sendmail/src/envelope.c b/usr/src/cmd/sendmail/src/envelope.c
index 6dc981b4fc..316bb3dda3 100644
--- a/usr/src/cmd/sendmail/src/envelope.c
+++ b/usr/src/cmd/sendmail/src/envelope.c
@@ -15,7 +15,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: envelope.c,v 8.304 2007/04/18 17:15:49 ca Exp $")
+SM_RCSID("@(#)$Id: envelope.c,v 8.305 2008/03/31 16:32:13 ca Exp $")
/*
** CLRSESSENVELOPE -- clear session oriented data in an envelope
@@ -77,7 +77,7 @@ newenvelope(e, parent, rpool)
register ENVELOPE *parent;
SM_RPOOL_T *rpool;
{
- int sendmode, dm;
+ int sendmode;
/*
** This code used to read:
@@ -88,16 +88,8 @@ newenvelope(e, parent, rpool)
** This meant macvalue() could go into an infinite loop.
*/
- dm = DM_NOTSET;
if (parent != NULL)
- {
- char *str;
-
sendmode = parent->e_sendmode;
- str = macvalue(macid("{deliveryMode}"), parent);
- if (str != NULL)
- dm = (int) str[0];
- }
else
sendmode = DM_NOTSET;
@@ -146,9 +138,7 @@ newenvelope(e, parent, rpool)
if (CurEnv->e_xfp != NULL)
(void) sm_io_flush(CurEnv->e_xfp, SM_TIME_DEFAULT);
if (sendmode != DM_NOTSET)
- e->e_sendmode = sendmode;
- if (dm != DM_NOTSET)
- set_delivery_mode(dm, e);
+ set_delivery_mode(sendmode, e);
return e;
}
diff --git a/usr/src/cmd/sendmail/src/main.c b/usr/src/cmd/sendmail/src/main.c
index 8675a3e238..bd91c0f1bc 100644
--- a/usr/src/cmd/sendmail/src/main.c
+++ b/usr/src/cmd/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -35,7 +35,7 @@ SM_UNUSED(static char copyright[]) =
#pragma ident "%Z%%M% %I% %E% SMI"
-SM_RCSID("@(#)$Id: main.c,v 8.963 2007/06/29 20:07:37 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.967 2008/03/31 16:32:13 ca Exp $")
SM_IDSTR(i2, "%W% (Sun) %G%")
#if NETINET || NETINET6
@@ -311,6 +311,9 @@ main(argc, argv, envp)
ExitStat = EX_OK;
SubmitMode = SUBMIT_UNKNOWN;
+#if _FFR_LOCAL_DAEMON
+ LocalDaemon = false;
+#endif /* _FFR_LOCAL_DAEMON */
#if XDEBUG
checkfd012("after openlog");
#endif /* XDEBUG */
@@ -410,6 +413,13 @@ main(argc, argv, envp)
OpMode = j;
break;
+#if _FFR_LOCAL_DAEMON
+ case MD_LOCAL:
+ OpMode = MD_DAEMON;
+ LocalDaemon = true;
+ break;
+#endif /* _FFR_LOCAL_DAEMON */
+
case MD_FREEZE:
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Frozen configurations unsupported\n");
diff --git a/usr/src/cmd/sendmail/src/mci.c b/usr/src/cmd/sendmail/src/mci.c
index f32fbf4dc9..292ceefaf2 100644
--- a/usr/src/cmd/sendmail/src/mci.c
+++ b/usr/src/cmd/sendmail/src/mci.c
@@ -15,7 +15,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: mci.c,v 8.218 2006/08/15 23:24:57 ca Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.221 2007/11/13 23:44:25 gshapiro Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -1145,16 +1145,27 @@ mci_traverse_persistent(action, pathname)
pathname, sm_errstring(errno));
return -1;
}
- len = sizeof(newpath) - MAXNAMLEN - 3;
+
+ /*
+ ** Reserve space for trailing '/', at least one
+ ** character, and '\0'
+ */
+
+ len = sizeof(newpath) - 3;
if (sm_strlcpy(newpath, pathname, len) >= len)
{
+ int save_errno = errno;
+
if (tTd(56, 2))
sm_dprintf("mci_traverse: path \"%s\" too long",
pathname);
+ (void) closedir(d);
+ errno = save_errno;
return -1;
}
newptr = newpath + strlen(newpath);
*newptr++ = '/';
+ len = sizeof(newpath) - (newptr - newpath);
/*
** repeat until no file has been removed
@@ -1171,9 +1182,17 @@ mci_traverse_persistent(action, pathname)
if (e->d_name[0] == '.')
continue;
- (void) sm_strlcpy(newptr, e->d_name,
- sizeof(newpath) -
- (newptr - newpath));
+ if (sm_strlcpy(newptr, e->d_name, len) >= len)
+ {
+ /* Skip truncated copies */
+ if (tTd(56, 4))
+ {
+ *newptr = '\0';
+ sm_dprintf("mci_traverse: path \"%s%s\" too long",
+ newpath, e->d_name);
+ }
+ continue;
+ }
if (StopRequest)
stop_sendmail();
diff --git a/usr/src/cmd/sendmail/src/parseaddr.c b/usr/src/cmd/sendmail/src/parseaddr.c
index 68e02a1341..4be088e32f 100644
--- a/usr/src/cmd/sendmail/src/parseaddr.c
+++ b/usr/src/cmd/sendmail/src/parseaddr.c
@@ -15,7 +15,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: parseaddr.c,v 8.401 2007/09/27 23:33:59 ca Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.403 2008/02/08 02:27:35 ca Exp $")
#include <sm/sendmail.h>
#include "map.h"
@@ -1462,6 +1462,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
size_t trsize;
char *replac;
int endtoken;
+ bool external;
STAB *map;
char *mapname;
char **key_rvp;
@@ -1577,6 +1578,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
true);
argvect[0] = cbuf;
replac = map_lookup(map, cbuf, argvect, &rstat, e);
+ external = replac != NULL;
/* if no replacement, use default */
if (replac == NULL && default_rvp != NULL)
@@ -1601,7 +1603,8 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
{
/* scan the new replacement */
xpvp = prescan(replac, '\0', pvpbuf,
- sizeof(pvpbuf), NULL, NULL,
+ sizeof(pvpbuf), NULL,
+ external ? NULL : IntTokenTab,
false);
if (xpvp == NULL)
{
@@ -2265,7 +2268,7 @@ cataddr(pvp, evp, buf, sz, spacesub, external)
{
char *q;
- natomtok = (ExtTokenTab[**pvp & 0xff] == ATM);
+ natomtok = (IntTokenTab[**pvp & 0xff] == ATM);
if (oatomtok && natomtok)
{
*p++ = spacesub;
diff --git a/usr/src/cmd/sendmail/src/queue.c b/usr/src/cmd/sendmail/src/queue.c
index 9a5fc07123..f9cee5ba1e 100644
--- a/usr/src/cmd/sendmail/src/queue.c
+++ b/usr/src/cmd/sendmail/src/queue.c
@@ -16,7 +16,7 @@
#include <sendmail.h>
#include <sm/sem.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.975 2007/06/18 20:08:40 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.977 2008/02/15 23:19:58 ca Exp $")
#include <dirent.h>
@@ -4516,7 +4516,7 @@ readqf(e, openonly)
(void) sm_io_close(qfp, SM_TIME_DEFAULT);
return false;
}
-
+
#if _FFR_QF_PARANOIA
/* Check to make sure key fields were read */
if (e->e_from.q_mailer == NULL)
@@ -6598,8 +6598,8 @@ init_sem(owner)
if (SemId < 0)
{
sm_syslog(LOG_ERR, NOQID,
- "func=init_sem, sem_key=%ld, sm_sem_start=%d",
- (long) SemKey, SemId);
+ "func=init_sem, sem_key=%ld, sm_sem_start=%d, error=%s",
+ (long) SemKey, SemId, sm_errstring(-SemId));
return;
}
#endif /* SM_CONF_SEM */
diff --git a/usr/src/cmd/sendmail/src/ratectrl.c b/usr/src/cmd/sendmail/src/ratectrl.c
index 17a1bf02a0..d860647072 100644
--- a/usr/src/cmd/sendmail/src/ratectrl.c
+++ b/usr/src/cmd/sendmail/src/ratectrl.c
@@ -47,7 +47,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sendmail.h>
-SM_RCSID("@(#)$Id: ratectrl.c,v 8.11 2006/08/15 23:24:57 ca Exp $")
+SM_RCSID("@(#)$Id: ratectrl.c,v 8.12 2008/02/11 22:56:05 ca Exp $")
/*
** stuff included - given some warnings (inet_ntoa)
@@ -116,7 +116,7 @@ connection_rate_check(hostaddr, e)
/* update server connection rate */
totalrate = total_rate(now, e == NULL);
#if RATECTL_DEBUG
- sm_syslog(LOG_INFO, NOQID, "global connection rate: %d", globalRate);
+ sm_syslog(LOG_INFO, NOQID, "global connection rate: %d", totalrate);
#endif /* RATECTL_DEBUG */
/* update client connection rate */
diff --git a/usr/src/cmd/sendmail/src/readcf.c b/usr/src/cmd/sendmail/src/readcf.c
index 49105a6c6c..9d0d205333 100644
--- a/usr/src/cmd/sendmail/src/readcf.c
+++ b/usr/src/cmd/sendmail/src/readcf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -16,7 +16,7 @@
#include <sendmail.h>
#include <sm/sendmail.h>
-SM_RCSID("@(#)$Id: readcf.c,v 8.664 2007/07/10 17:01:22 ca Exp $")
+SM_RCSID("@(#)$Id: readcf.c,v 8.666 2008/02/14 17:25:14 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -2251,6 +2251,12 @@ static struct optioninfo
# define O_ADDR_TYPE_MODES 0xe0
{ "AddrTypeModes", O_ADDR_TYPE_MODES, OI_NONE },
#endif /* _FFR_ADDR_TYPE_MODES */
+#if _FFR_BADRCPT_SHUTDOWN
+# define O_RCPTSHUTD 0xe1
+ { "BadRcptShutdown", O_RCPTSHUTD, OI_SAFE },
+# define O_RCPTSHUTDG 0xe2
+ { "BadRcptShutdownGood", O_RCPTSHUTDG, OI_SAFE },
+#endif /* _FFR_BADRCPT_SHUTDOWN */
{ NULL, '\0', OI_NONE }
};
@@ -3819,6 +3825,16 @@ setoption(opt, val, safe, sticky, e)
break;
#endif /* _FFR_ADDR_TYPE_MODES */
+#if _FFR_BADRCPT_SHUTDOWN
+ case O_RCPTSHUTD:
+ BadRcptShutdown = atoi(val);
+ break;
+
+ case O_RCPTSHUTDG:
+ BadRcptShutdownGood = atoi(val);
+ break;
+#endif /* _FFR_BADRCPT_SHUTDOWN */
+
default:
if (tTd(37, 1))
{
diff --git a/usr/src/cmd/sendmail/src/sendmail.h b/usr/src/cmd/sendmail/src/sendmail.h
index 66a126ccf4..5a0df3798d 100644
--- a/usr/src/cmd/sendmail/src/sendmail.h
+++ b/usr/src/cmd/sendmail/src/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -54,7 +54,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1052 2007/10/05 23:06:30 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1059 2008/02/15 23:19:58 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -1553,6 +1553,7 @@ extern void stabapply __P((void (*)(STAB *, int), int));
#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */
#define MD_DAEMON 'd' /* run as a daemon */
#define MD_FGDAEMON 'D' /* run daemon in foreground */
+#define MD_LOCAL 'l' /* like daemon, but localhost only */
#define MD_VERIFY 'v' /* verify: don't collect or deliver */
#define MD_TEST 't' /* test mode: resolve addrs only */
#define MD_INITALIAS 'i' /* initialize alias database */
@@ -1563,6 +1564,12 @@ extern void stabapply __P((void (*)(STAB *, int), int));
#define MD_PURGESTAT 'H' /* purge persistent host stat info */
#define MD_QUEUERUN 'q' /* queue run */
+#if _FFR_LOCAL_DAEMON
+EXTERN bool LocalDaemon;
+#else /* _FFR_LOCAL_DAEMON */
+# define LocalDaemon false
+#endif /* _FFR_LOCAL_DAEMON */
+
/* Note: see also include/sendmail/pathnames.h: GET_CLIENT_CF */
/* values for e_sendmode -- send modes */
@@ -2231,6 +2238,10 @@ EXTERN char InetMode; /* default network for daemon mode */
EXTERN char OpMode; /* operation mode, see below */
EXTERN char SpaceSub; /* substitution for <lwsp> */
EXTERN int BadRcptThrottle; /* Throttle rejected RCPTs per SMTP message */
+#if _FFR_BADRCPT_SHUTDOWN
+EXTERN int BadRcptShutdown; /* Shutdown connection for rejected RCPTs */
+EXTERN int BadRcptShutdownGood; /* above even when there are good RCPTs */
+#endif /* _FFR_BADRCPT_SHUTDOWN */
EXTERN int CheckpointInterval; /* queue file checkpoint interval */
EXTERN int ConfigLevel; /* config file level */
EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */
@@ -2592,6 +2603,11 @@ extern void setoption __P((int, char *, bool, bool, ENVELOPE *));
extern sigfunc_t setsignal __P((int, sigfunc_t));
extern void sm_setuserenv __P((const char *, const char *));
extern void settime __P((ENVELOPE *));
+#if STARTTLS
+extern void set_tls_rd_tmo __P((int));
+#else /* STARTTLS */
+#define set_tls_rd_tmo(rd_tmo)
+#endif /* STARTTLS */
extern char *sfgets __P((char *, int, SM_FILE_T *, time_t, char *));
extern char *shortenstring __P((const char *, size_t));
extern char *shorten_hostname __P((char []));
diff --git a/usr/src/cmd/sendmail/src/sfsasl.c b/usr/src/cmd/sendmail/src/sfsasl.c
index 833817276f..2e55a913bf 100644
--- a/usr/src/cmd/sendmail/src/sfsasl.c
+++ b/usr/src/cmd/sendmail/src/sfsasl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: sfsasl.c,v 8.115 2006/04/18 21:34:07 ca Exp $")
+SM_RCSID("@(#)$Id: sfsasl.c,v 8.117 2008/01/31 18:48:29 ca Exp $")
#include <stdlib.h>
#include <sendmail.h>
#include <sm/time.h>
@@ -677,6 +677,26 @@ tls_retry(ssl, rfd, wfd, tlsstart, timeout, err, where)
#endif /* ETIMEDOUT */
/*
+** SET_TLS_RD_TMO -- read secured information for the caller
+**
+** Parameters:
+** rd_tmo -- read timeout
+**
+** Results:
+** none
+** This is a hack: there is no way to pass it in
+*/
+
+static int tls_rd_tmo = -1;
+
+void
+set_tls_rd_tmo(rd_tmo)
+ int rd_tmo;
+{
+ tls_rd_tmo = rd_tmo;
+}
+
+/*
** TLS_READ -- read secured information for the caller
**
** Parameters:
@@ -727,7 +747,9 @@ tls_read(fp, buf, size)
rfd = SSL_get_rfd(so->con);
wfd = SSL_get_wfd(so->con);
try = tls_retry(so->con, rfd, wfd, tlsstart,
- TimeOuts.to_datablock, ssl_err, "read");
+ (tls_rd_tmo < 0) ? TimeOuts.to_datablock
+ : tls_rd_tmo,
+ ssl_err, "read");
if (try > 0)
goto retry;
errno = SM_ERR_TIMEOUT;
diff --git a/usr/src/cmd/sendmail/src/sm_resolve.c b/usr/src/cmd/sendmail/src/sm_resolve.c
index bb308640d5..255cfa3aa8 100644
--- a/usr/src/cmd/sendmail/src/sm_resolve.c
+++ b/usr/src/cmd/sendmail/src/sm_resolve.c
@@ -48,7 +48,7 @@
# if NAMED_BIND
# include "sm_resolve.h"
-SM_RCSID("$Id: sm_resolve.c,v 8.35 2007/06/25 16:20:14 ca Exp $")
+SM_RCSID("$Id: sm_resolve.c,v 8.36 2008/02/11 23:04:16 ca Exp $")
static struct stot
{
@@ -170,7 +170,7 @@ parse_dns_reply(data, len)
int len;
{
unsigned char *p;
- ushort ans_cnt, ui;
+ unsigned short ans_cnt, ui;
int status;
size_t l;
char host[MAXHOSTNAMELEN];
@@ -200,7 +200,7 @@ parse_dns_reply(data, len)
return NULL;
}
- ans_cnt = ntohs((ushort) r->dns_r_h.ancount);
+ ans_cnt = ntohs((unsigned short) r->dns_r_h.ancount);
p += status;
GETSHORT(r->dns_r_q.dns_q_type, p);
diff --git a/usr/src/cmd/sendmail/src/srvrsmtp.c b/usr/src/cmd/sendmail/src/srvrsmtp.c
index 764715ba92..f81c29da3e 100644
--- a/usr/src/cmd/sendmail/src/srvrsmtp.c
+++ b/usr/src/cmd/sendmail/src/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -19,7 +19,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.967 2007/10/01 16:22:14 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.975 2008/03/31 16:32:13 ca Exp $")
#include <sm/time.h>
#include <sm/fdset.h>
@@ -639,6 +639,9 @@ smtp(nullserver, d_flags, e)
# define p_addr_st NULL
#endif /* MILTER */
size_t inplen;
+#if _FFR_BADRCPT_SHUTDOWN
+ int n_badrcpts_adj;
+#endif /* _FFR_BADRCPT_SHUTDOWN */
SevenBitInput_Saved = SevenBitInput;
smtp.sm_nrcpts = 0;
@@ -905,6 +908,8 @@ smtp(nullserver, d_flags, e)
#endif /* SASL */
#if STARTTLS
+
+ set_tls_rd_tmo(TimeOuts.to_nextcommand);
#endif /* STARTTLS */
#if MILTER
@@ -944,6 +949,7 @@ smtp(nullserver, d_flags, e)
/* arrange to ignore send list */
e->e_sendqueue = NULL;
+ lognullconnection = false;
goto doquit;
}
}
@@ -1056,10 +1062,10 @@ smtp(nullserver, d_flags, e)
if (select(fd + 1, FDSET_CAST &readfds,
NULL, NULL, &timeout) > 0 &&
FD_ISSET(fd, &readfds) &&
- (eoftest = sm_io_getc(InChannel, SM_TIME_DEFAULT))
+ (eoftest = sm_io_getc(InChannel, SM_TIME_DEFAULT))
!= SM_IO_EOF)
{
- sm_io_ungetc(InChannel, SM_TIME_DEFAULT,
+ sm_io_ungetc(InChannel, SM_TIME_DEFAULT,
eoftest);
gettimeofday(&ep, NULL);
timersub(&ep, &bp, &tp);
@@ -2525,6 +2531,36 @@ smtp(nullserver, d_flags, e)
milter_rcpt_added = false;
smtp.sm_e_nrcpts_orig = e->e_nrcpts;
#endif
+#if _FFR_BADRCPT_SHUTDOWN
+ /*
+ ** hack to deal with hack, see below:
+ ** n_badrcpts is increased is limit is reached.
+ */
+
+ n_badrcpts_adj = (BadRcptThrottle > 0 &&
+ n_badrcpts > BadRcptThrottle &&
+ LogLevel > 5)
+ ? n_badrcpts - 1 : n_badrcpts;
+ if (BadRcptShutdown > 0 &&
+ n_badrcpts_adj >= BadRcptShutdown &&
+ (BadRcptShutdownGood == 0 ||
+ smtp.sm_nrcpts == 0 ||
+ (n_badrcpts_adj * 100 /
+ (smtp.sm_nrcpts + n_badrcpts) >=
+ BadRcptShutdownGood)))
+ {
+ if (LogLevel > 5)
+ sm_syslog(LOG_INFO, e->e_id,
+ "%s: Possible SMTP RCPT flood, shutting down connection.",
+ CurSmtpClient);
+ message("421 4.7.0 %s Too many bad recipients; closing connection",
+ MyHostName);
+
+ /* arrange to ignore any current send list */
+ e->e_sendqueue = NULL;
+ goto doquit;
+ }
+#endif /* _FFR_BADRCPT_SHUTDOWN */
if (BadRcptThrottle > 0 &&
n_badrcpts >= BadRcptThrottle)
{
@@ -3777,17 +3813,10 @@ smtp_data(smtp, e)
dropenvelope(ee, true, false);
}
}
- sm_rpool_free(e->e_rpool);
-
- /*
- ** At this point, e == &MainEnvelope, but if we did splitting,
- ** then CurEnv may point to an envelope structure that was just
- ** freed with the rpool. So reset CurEnv *before* calling
- ** newenvelope.
- */
CurEnv = e;
features = e->e_features;
+ sm_rpool_free(e->e_rpool);
newenvelope(e, e, sm_rpool_new_x(NULL));
e->e_flags = BlankEnvelope.e_flags;
e->e_features = features;
diff --git a/usr/src/cmd/sendmail/src/usersmtp.c b/usr/src/cmd/sendmail/src/usersmtp.c
index 746ac7c1d4..4af74a4751 100644
--- a/usr/src/cmd/sendmail/src/usersmtp.c
+++ b/usr/src/cmd/sendmail/src/usersmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -15,7 +15,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: usersmtp.c,v 8.470 2007/10/17 21:35:30 ca Exp $")
+SM_RCSID("@(#)$Id: usersmtp.c,v 8.472 2008/01/31 18:48:29 ca Exp $")
#include <sysexits.h>
@@ -3079,6 +3079,7 @@ reply(m, mci, e, timeout, pfunc, enhstat, rtype)
*/
bufp = SmtpReplyBuffer;
+ set_tls_rd_tmo(timeout);
for (;;)
{
register char *p;
diff --git a/usr/src/cmd/sendmail/src/util.c b/usr/src/cmd/sendmail/src/util.c
index 01114a90b8..d23c798231 100644
--- a/usr/src/cmd/sendmail/src/util.c
+++ b/usr/src/cmd/sendmail/src/util.c
@@ -15,7 +15,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: util.c,v 8.413 2007/09/26 23:29:11 ca Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.414 2007/11/02 17:30:38 ca Exp $")
#include <sm/sendmail.h>
#include <sysexits.h>
@@ -2825,9 +2825,10 @@ count_open_connections(hostaddr)
return 0;
/*
- ** Initialize to 1 instead of 0 because this code gets called
- ** before proc_list_add() gets called, so we (the daemon child
- ** for this connection) don't count ourselves.
+ ** This code gets called before proc_list_add() gets called,
+ ** so we (the daemon child for this connection) have not yet
+ ** counted ourselves. Hence initialize the counter to 1
+ ** instead of 0 to compensate.
*/
n = 1;
diff --git a/usr/src/cmd/sendmail/src/version.c b/usr/src/cmd/sendmail/src/version.c
index 46bee6f60f..61db41f068 100644
--- a/usr/src/cmd/sendmail/src/version.c
+++ b/usr/src/cmd/sendmail/src/version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -15,6 +15,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: version.c,v 8.199 2007/10/31 16:04:12 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.208 2008/04/17 17:04:30 ca Exp $")
-char Version[] = "8.14.2+Sun";
+char Version[] = "8.14.3+Sun";