summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-04-08 16:00:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-04-08 16:00:53 +0000
commitb4985b1540669c7865a4cd7397adfa3b47c7cbf6 (patch)
tree016e3c7bcb09820dd16db4e4decc0e50a1bf4574 /gnu
parent719e664dd6e1dc5bf87f7e10bdf74a71024fde04 (diff)
update to sendmail 8.13.4
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.sbin/sendmail/RELEASE_NOTES56
-rw-r--r--gnu/usr.sbin/sendmail/cf/README18
-rw-r--r--gnu/usr.sbin/sendmail/cf/m4/version.m44
-rw-r--r--gnu/usr.sbin/sendmail/doc/op/op.me23
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/conf.h22
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/sem.h59
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/shm.h5
-rw-r--r--gnu/usr.sbin/sendmail/libsm/Makefile4
-rw-r--r--gnu/usr.sbin/sendmail/libsm/ldap.c30
-rw-r--r--gnu/usr.sbin/sendmail/libsm/sem.c201
-rw-r--r--gnu/usr.sbin/sendmail/libsm/shm.c38
-rw-r--r--gnu/usr.sbin/sendmail/libsm/t-sem.c344
-rw-r--r--gnu/usr.sbin/sendmail/libsm/t-shm.c10
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/README7
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS3
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/collect.c5
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/conf.c44
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/daemon.c92
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/deliver.c16
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/domain.c9
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/envelope.c4
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/map.c42
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/mci.c55
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/milter.c28
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/parseaddr.c19
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/queue.c303
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/sendmail.h12
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c42
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/tls.c7
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/usersmtp.c12
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/version.c4
31 files changed, 1269 insertions, 249 deletions
diff --git a/gnu/usr.sbin/sendmail/RELEASE_NOTES b/gnu/usr.sbin/sendmail/RELEASE_NOTES
index 6bdec4f2068..681da0f22c5 100644
--- a/gnu/usr.sbin/sendmail/RELEASE_NOTES
+++ b/gnu/usr.sbin/sendmail/RELEASE_NOTES
@@ -1,11 +1,65 @@
SENDMAIL RELEASE NOTES
- $Sendmail: RELEASE_NOTES,v 8.1709 2005/01/12 04:32:31 ca Exp $
+ $Sendmail: RELEASE_NOTES,v 8.1730 2005/03/28 00:31:23 gshapiro Exp $
This listing shows the version of the sendmail binary, the version
of the sendmail configuration files, the date of release, and a
summary of the changes in that release.
+8.13.4/8.13.4 2005/03/27
+ The bug fixes in 8.13.3 for connection handling uncovered a
+ different error which could result in connections that
+ stay in CLOSE_WAIT state due to a variable that was not
+ properly initialized. Problem noted by Michael Sims.
+ Deal with empty hostnames in hostsignature(). This bug could lead
+ to an endless loop when doing LMTP deliveries to another
+ host. Problem first reported by Martin Lathoud and
+ tracked down by Gael Roualland.
+ Make sure return parameters are initialized in getmxrr(). Problem
+ found by Gael Roualland using valgrind.
+ If shared memory is used and the RunAsUser option is set, then the
+ owner and group of the shared memory segment is set to
+ the ids specified RunAsUser and the access mode is set
+ to 0660 to allow for updates by sendmail processes.
+ The number of queue entries that is (optionally) kept in shared
+ memory was wrong in some cases, e.g., envelope splitting
+ and bounce generation.
+ Undo a change made in 8.13.0 to silently truncate long strings
+ in address rewriting because the message can be triggered
+ for header checks where long strings are legitimate.
+ Problem reported by Mary Verge DeSisto, and tracked
+ down with the help of John Beck of Sun Microsystems.
+ The internal stab map did not obey the -m flag. Patch from
+ Rob McMahon of Warwick University, England.
+ The socket map did not obey the -f flag. Problem noted by
+ Dan Ringdahl, forwarded by Andrzej Filip.
+ The addition of LDAP recursion in 8.13.0 broke enforcement of
+ the LDAP map -1 argument which tells the MTA to only
+ return success if and only if a single LDAP match is found.
+ Add additional error checks in the MTA for milter communication
+ to avoid a possible segmentation fault. Based on patch
+ by Joe Maimon.
+ Do not trigger an assertion if X509_digest() returns success but
+ does not assign a value to its output parameter. Based
+ on patch by Brian Kantor.
+ Add more checks when resetting internal AUTH data (applies only
+ to Cyrus SASL version 2). Otherwise an SMTP session might
+ be dropped after an AUTH failure.
+ Portability:
+ Add LA_LONGLONG as valid LA_TYPE type for systems that use
+ "long long" to read load average data, e.g.,
+ AIX 5.1 in 32 bit mode. Note: this has to be set
+ "by hand", it is not (yet) automatically detected.
+ Problem noted by Burak Bilen.
+ Use socklen_t for accept(), etc. on AIX 5.x. This should
+ fix problems when compiling in 64 bit mode.
+ Problem first reported by Harry Meiert of
+ University of Bremen.
+ New Files:
+ include/sm/sem.h
+ libsm/sem.c
+ libsm/t-sem.c
+
8.13.3/8.13.3 2005/01/11
Enhance handling of I/O errors, especially EOF, when STARTTLS
is active.
diff --git a/gnu/usr.sbin/sendmail/cf/README b/gnu/usr.sbin/sendmail/cf/README
index 8fb4e404080..0d389c010be 100644
--- a/gnu/usr.sbin/sendmail/cf/README
+++ b/gnu/usr.sbin/sendmail/cf/README
@@ -1593,7 +1593,7 @@ The four mailers are:
uucp-old (obsolete name: "uucp")
This is the oldest, the worst (but the closest to UUCP) way of
- sending messages accros UUCP connections. It does bangify
+ sending messages across UUCP connections. It does bangify
everything and prepends $U (your UUCP name) to the sender's
address (which can already be a bang path itself). It can
only send to one address at a time, so it spends a lot of
@@ -2662,7 +2662,7 @@ blacklists, use the access_db feature and add:
to the access map, where 10.1 is your local network. You may
want to use "RELAY" instead of "OK" to allow also relaying
-instead of just disabling the DNS lookups in the backlists.
+instead of just disabling the DNS lookups in the blacklists.
The features described above make use of the check_relay, check_mail,
@@ -2870,12 +2870,12 @@ the previous paragraph. Example:
| STARTTLS |
+----------+
-In this text, cert will be used as an abreviation for X.509 certificate,
+In this text, cert will be used as an abbreviation for X.509 certificate,
DN (CN) is the distinguished (common) name of a cert, and CA is a
certification authority, which signs (issues) certs.
For STARTTLS to be offered by sendmail you need to set at least
-this variables (the file names and paths are just examples):
+these variables (the file names and paths are just examples):
define(`confCACERT_PATH', `/etc/mail/certs/')
define(`confCACERT', `/etc/mail/certs/CA.cert.pem')
@@ -4127,12 +4127,8 @@ confAUTH_OPTIONS AuthOptions [undefined] If this option is 'A'
then the AUTH= parameter for the
MAIL FROM command is only issued
when authentication succeeded.
- Other values (which should be listed
- one after the other without any
- intervening characters except for
- space or comma) are a, c, d, f, p,
- and y. See doc/op/op.me for
- details.
+ See doc/op/op.me for more options
+ and details.
confAUTH_MAX_BITS AuthMaxBits [INT_MAX] Limit the maximum encryption
strength for the security layer in
SMTP AUTH (SASL). Default is
@@ -4587,4 +4583,4 @@ M4 DIVERSIONS
8 DNS based blacklists
9 special local rulesets (1 and 2)
-$Revision: 1.22 $, Last updated $Date: 2004/09/18 04:08:34 $
+$Revision: 1.23 $, Last updated $Date: 2005/04/08 16:00:49 $
diff --git a/gnu/usr.sbin/sendmail/cf/m4/version.m4 b/gnu/usr.sbin/sendmail/cf/m4/version.m4
index 6d8c4e11dd3..f92b0af51a8 100644
--- a/gnu/usr.sbin/sendmail/cf/m4/version.m4
+++ b/gnu/usr.sbin/sendmail/cf/m4/version.m4
@@ -11,8 +11,8 @@ divert(-1)
# the sendmail distribution.
#
#
-VERSIONID(`$Sendmail: version.m4,v 8.127 2005/01/12 04:32:32 ca Exp $')
+VERSIONID(`$Sendmail: version.m4,v 8.132 2005/03/25 18:44:45 ca Exp $')
#
divert(0)
# Configuration version number
-DZ8.13.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.13.4`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/gnu/usr.sbin/sendmail/doc/op/op.me b/gnu/usr.sbin/sendmail/doc/op/op.me
index 1bd9f40c093..f69ab88b057 100644
--- a/gnu/usr.sbin/sendmail/doc/op/op.me
+++ b/gnu/usr.sbin/sendmail/doc/op/op.me
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1983, 1993
@@ -9,7 +9,7 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Sendmail: op.me,v 8.699 2004/06/03 18:29:01 ca Exp $
+.\" $Sendmail: op.me,v 8.704 2005/02/01 00:40:57 ca Exp $
.\"
.\" eqn op.me | pic | troff -me
.\"
@@ -90,7 +90,7 @@ Sendmail, Inc.
.de Ve
Version \\$2
..
-.Ve $Revision: 1.22 $
+.Ve $Revision: 1.23 $
.rm Ve
.sp
For Sendmail Version 8.13
@@ -1621,7 +1621,7 @@ the
.i address
part of the triple is looked up as the key
(i.e., the left hand side)
-into the alias database.
+in the alias database.
If there is a match, the address is deleted from the send queue
and all addresses on the right hand side of the alias
are added in place of the alias that was found.
@@ -3916,6 +3916,11 @@ The complete syntax for ruleset 0 is:
This specifies the
{mailer, host, user}
3-tuple necessary to direct the mailer.
+Note: the third element (
+.i user
+) is often also called
+.i address
+part.
If the mailer is local
the host part may be omitted\**.
.(f
@@ -4781,7 +4786,8 @@ command line flag or by the SMTP server code.
Sender's host name.
Set from the
.b \-p
-command line flag or by the SMTP server code.
+command line flag or by the SMTP server code
+(in which case it is set to the EHLO/HELO parameter).
.ip $t
A numeric representation of the current time in the format YYYYMMDDHHmm
(4 digit year 1900-9999, 2 digit month 01-12, 2 digit day 01-31,
@@ -5514,7 +5520,7 @@ set to be the set of all names
this host is known by.
This can be used to match local hostnames.
.ip $={persistentMacros}
-set to the macros would should be saved across queue runs.
+set to the macros that should be saved across queue runs.
Care should be taken when adding macro names to this class.
.pp
.i Sendmail
@@ -5596,7 +5602,8 @@ Run Extended SMTP (ESMTP) protocol (defined in RFCs 1869, 1652, and 1870).
This flag defaults on if the SMTP greeting message includes the word
.q ESMTP .
.ip A
-Look up the user part of the address in the alias database.
+Look up the user (address) part of the resolved mailer triple,
+in the alias database.
Normally this is only set for local mailers.
.ip b
Force a blank line on the end of a message.
@@ -11310,7 +11317,7 @@ replace it with a blank sheet for double-sided output.
.\".sz 10
.\"Eric Allman
.\".sp
-.\"Version $Revision: 1.22 $
+.\"Version $Revision: 1.23 $
.\".ce 0
.bp 3
.ce
diff --git a/gnu/usr.sbin/sendmail/include/sm/conf.h b/gnu/usr.sbin/sendmail/include/sm/conf.h
index ccea501625a..158ed95c22e 100644
--- a/gnu/usr.sbin/sendmail/include/sm/conf.h
+++ b/gnu/usr.sbin/sendmail/include/sm/conf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Sendmail: conf.h,v 1.118 2004/08/20 20:30:32 ca Exp $
+ * $Sendmail: conf.h,v 1.120 2005/03/22 22:07:53 ca Exp $
*/
/*
@@ -161,6 +161,8 @@ extern void hard_syslog();
# ifdef _AIX5
# define _AIX4 40300
+# define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
+# define SOCKOPT_LEN_T socklen_t /* arg#5 to getsockopt */
# if _AIX5 >= 50200
# define HASUNSETENV 1 /* has unsetenv(3) call */
# endif /* _AIX5 >= 50200 */
@@ -175,10 +177,14 @@ extern void hard_syslog();
# define BSD4_4_SOCKADDR /* has sa_len */
# define USESETEUID 1 /* seteuid(2) works */
# define TZ_TYPE TZ_NAME /* use tzname[] vector */
-# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
+# ifndef SOCKOPT_LEN_T
+# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
+# endif /* SOCKOPT_LEN_T */
# if _AIX4 >= 40200
# define HASSETREUID 1 /* setreuid(2) works as of AIX 4.2 */
-# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
+# ifndef SOCKADDR_LEN_T
+# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
+# endif /* SOCKADDR_LEN_T */
# endif /* _AIX4 >= 40200 */
# if defined(_ILS_MACROS) /* IBM versions aren't side-effect clean */
# undef isascii
@@ -208,7 +214,9 @@ extern void hard_syslog();
# define GIDSET_T gid_t
# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# define LA_TYPE LA_INT
+# ifndef LA_TYPE
+# define LA_TYPE LA_INT
+# endif /* LA_TYPE */
# define FSHIFT 16
# define LA_AVENRUN "avenrun"
# if !defined(_AIX4) || _AIX4 < 40300
@@ -1125,7 +1133,7 @@ typedef short pid_t;
# define _SCO_unix_4_2
# else /* ! _SCO_unix_4_2 */
# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
-# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
+# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
# endif /* ! _SCO_unix_4_2 */
# endif /* _SCO_DS >= 1 */
@@ -1819,7 +1827,7 @@ extern struct passwd * sendmail_mpe_getpwuid __P((uid_t));
# define HASWAITPID 1
# define HASGETDTABLESIZE 1
# define GIDSET_T gid_t
-# define SOCKADDR_LEN_T size_t
+# define SOCKADDR_LEN_T size_t
# define SOCKOPT_LEN_T size_t
# ifndef _PATH_UNIX
# define _PATH_UNIX "/stand/unix"
diff --git a/gnu/usr.sbin/sendmail/include/sm/sem.h b/gnu/usr.sbin/sendmail/include/sm/sem.h
new file mode 100644
index 00000000000..d8d645924c1
--- /dev/null
+++ b/gnu/usr.sbin/sendmail/include/sm/sem.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000-2001, 2005 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ * $Sendmail: sem.h,v 1.9 2005/02/17 22:08:58 ca Exp $
+ */
+
+#ifndef SM_SEM_H
+# define SM_SEM_H 1
+
+#include <sm/gen.h>
+
+/* key for semaphores */
+# define SM_SEM_KEY (41L)
+# define SM_SEM_NO_ID (-1)
+# define SM_NO_SEM(id) ((id) < 0)
+
+# if SM_CONF_SEM > 0
+# include <sys/types.h>
+# include <sys/ipc.h>
+# include <sys/sem.h>
+
+# if SM_CONF_SEM == 2
+union semun
+{
+ int val;
+ struct semid_ds *buf;
+ ushort *array;
+};
+# endif /* SM_CONF_SEM == 2 */
+
+# ifndef SEM_A
+# define SEM_A 0200
+# endif /* SEM_A */
+# ifndef SEM_R
+# define SEM_R 0400
+# endif /* SEM_R */
+
+# define SM_NSEM 1
+
+extern int sm_sem_start __P((key_t, int, int, bool));
+extern int sm_sem_stop __P((int));
+extern int sm_sem_acq __P((int, int, int));
+extern int sm_sem_rel __P((int, int, int));
+extern int sm_sem_get __P((int, int));
+
+# else /* SM_CONF_SEM > 0 */
+# define sm_sem_start(key, nsem, semflg, owner) 0
+# define sm_sem_stop(semid) 0
+# define sm_sem_acq(semid, semnum, timeout) 0
+# define sm_sem_rel(semid, semnum, timeout) 0
+# define sm_sem_get(semid, semnum) 0
+# endif /* SM_CONF_SEM > 0 */
+
+#endif /* ! SM_SEM_H */
diff --git a/gnu/usr.sbin/sendmail/include/sm/shm.h b/gnu/usr.sbin/sendmail/include/sm/shm.h
index 1270a7ed0b5..d91a4ee7652 100644
--- a/gnu/usr.sbin/sendmail/include/sm/shm.h
+++ b/gnu/usr.sbin/sendmail/include/sm/shm.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2003, 2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Sendmail: shm.h,v 1.10 2003/05/17 18:34:54 ca Exp $
+ * $Sendmail: shm.h,v 1.11 2005/01/13 22:57:04 ca Exp $
*/
#ifndef SM_SHM_H
@@ -28,6 +28,7 @@
extern void *sm_shmstart __P((key_t, int , int , int *, bool));
extern int sm_shmstop __P((void *, int, bool));
+extern int sm_shmsetowner __P((int, uid_t, gid_t, mode_t));
/* for those braindead systems... (e.g., SunOS 4) */
diff --git a/gnu/usr.sbin/sendmail/libsm/Makefile b/gnu/usr.sbin/sendmail/libsm/Makefile
index 81adb502101..48ba667a65e 100644
--- a/gnu/usr.sbin/sendmail/libsm/Makefile
+++ b/gnu/usr.sbin/sendmail/libsm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.5 2004/12/16 00:21:30 millert Exp $
+# $OpenBSD: Makefile,v 1.6 2005/04/08 16:00:50 millert Exp $
LIB= sm
SRCS= assert.c debug.c errstring.c exc.c heap.c match.c rpool.c strdup.c \
@@ -9,7 +9,7 @@ SRCS= assert.c debug.c errstring.c exc.c heap.c match.c rpool.c strdup.c \
strio.c ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c \
vsnprintf.c wbuf.c wsetup.c string.c stringf.c \
xtrap.c strto.c test.c path.c strcasecmp.c strrevcmp.c signal.c \
- clock.c config.c shm.c mbdb.c strexit.c cf.c ldap.c niprop.c
+ clock.c config.c shm.c sem.c mbdb.c strexit.c cf.c ldap.c niprop.c
ENVDEF= -DNOT_SENDMAIL
# This is not a library that gets installed so only build the .a version
diff --git a/gnu/usr.sbin/sendmail/libsm/ldap.c b/gnu/usr.sbin/sendmail/libsm/ldap.c
index d7bea04be88..d285d89e1aa 100644
--- a/gnu/usr.sbin/sendmail/libsm/ldap.c
+++ b/gnu/usr.sbin/sendmail/libsm/ldap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2001-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: ldap.c,v 1.60 2004/08/03 20:42:21 ca Exp $")
+SM_RCSID("@(#)$Sendmail: ldap.c,v 1.62 2005/02/24 00:30:01 ca Exp $")
#if LDAPMAP
# include <sys/types.h>
@@ -589,7 +589,9 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result,
LDAPMessage *entry;
/* If we don't want multiple values and we have one, break */
- if ((char) delim == '\0' && *result != NULL)
+ if ((char) delim == '\0' &&
+ !bitset(SM_LDAP_SINGLEMATCH, flags) &&
+ *result != NULL)
break;
/* Cycle through all entries */
@@ -767,19 +769,17 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result,
if (*result != NULL)
{
/* already have a value */
+ if (bitset(SM_LDAP_SINGLEMATCH,
+ flags))
+ {
+ /* only wanted one match */
+ SM_LDAP_ERROR_CLEANUP();
+ errno = ENOENT;
+ return EX_NOTFOUND;
+ }
break;
}
- if (bitset(SM_LDAP_SINGLEMATCH,
- flags) &&
- *result != NULL)
- {
- /* only wanted one match */
- SM_LDAP_ERROR_CLEANUP();
- errno = ENOENT;
- return EX_NOTFOUND;
- }
-
if (lmap->ldap_attrsonly == LDAPMAP_TRUE)
{
*result = sm_rpool_strdup_x(rpool,
@@ -990,7 +990,9 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result,
}
/* We don't want multiple values and we have one */
- if ((char) delim == '\0' && *result != NULL)
+ if ((char) delim == '\0' &&
+ !bitset(SM_LDAP_SINGLEMATCH, flags) &&
+ *result != NULL)
break;
}
save_errno = sm_ldap_geterrno(lmap->ldap_ld);
diff --git a/gnu/usr.sbin/sendmail/libsm/sem.c b/gnu/usr.sbin/sendmail/libsm/sem.c
new file mode 100644
index 00000000000..bb1691ca844
--- /dev/null
+++ b/gnu/usr.sbin/sendmail/libsm/sem.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2000-2001, 2005 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ */
+
+#include <sm/gen.h>
+SM_RCSID("@(#)$Sendmail: sem.c,v 1.12 2005/03/25 21:27:02 ca Exp $")
+
+#if SM_CONF_SEM
+# include <stdlib.h>
+# include <unistd.h>
+# include <sm/sem.h>
+# include <sm/heap.h>
+
+/*
+** SM_SEM_START -- initialize semaphores
+**
+** Parameters:
+** key -- key for semaphores.
+** nsem -- number of semaphores.
+** semflg -- flag for semget(), if 0, use a default.
+** owner -- create semaphores.
+**
+** Returns:
+** id for semaphores.
+** < 0 on failure.
+*/
+
+int
+sm_sem_start(key, nsem, semflg, owner)
+ key_t key;
+ int nsem;
+ int semflg;
+ bool owner;
+{
+ int semid, i;
+ unsigned short *semvals;
+
+ semvals = NULL;
+ if (semflg == 0)
+ semflg = (SEM_A|SEM_R)|((SEM_A|SEM_R) >> 3);
+ if (owner)
+ semflg |= IPC_CREAT|IPC_EXCL;
+ semid = semget(key, nsem, semflg);
+ if (semid < 0)
+ goto error;
+
+ if (owner)
+ {
+ union semun semarg;
+
+ semvals = (unsigned short *) sm_malloc(nsem * sizeof semvals);
+ if (semvals == NULL)
+ goto error;
+ semarg.array = semvals;
+
+ /* initialize semaphore values to be available */
+ for (i = 0; i < nsem; i++)
+ semvals[i] = 1;
+ if (semctl(semid, 0, SETALL, semarg) < 0)
+ goto error;
+ }
+ return semid;
+
+error:
+ if (semvals != NULL)
+ sm_free(semvals);
+ if (semid >= 0)
+ sm_sem_stop(semid);
+ return -1;
+}
+
+/*
+** SM_SEM_STOP -- stop using semaphores.
+**
+** Parameters:
+** semid -- id for semaphores.
+**
+** Returns:
+** 0 on success.
+** < 0 on failure.
+*/
+
+int
+sm_sem_stop(semid)
+ int semid;
+{
+ return semctl(semid, 0, IPC_RMID, NULL);
+}
+
+/*
+** SM_SEM_ACQ -- acquire semaphore.
+**
+** Parameters:
+** semid -- id for semaphores.
+** semnum -- number of semaphore.
+** timeout -- how long to wait for operation to succeed.
+**
+** Returns:
+** 0 on success.
+** < 0 on failure.
+*/
+
+int
+sm_sem_acq(semid, semnum, timeout)
+ int semid;
+ int semnum;
+ int timeout;
+{
+ int r;
+ struct sembuf semops[1];
+
+ semops[0].sem_num = semnum;
+ semops[0].sem_op = -1;
+ semops[0].sem_flg = SEM_UNDO |
+ (timeout != SM_TIME_FOREVER ? 0 : IPC_NOWAIT);
+ if (timeout == SM_TIME_IMMEDIATE || timeout == SM_TIME_FOREVER)
+ return semop(semid, semops, 1);
+ do
+ {
+ r = semop(semid, semops, 1);
+ if (r == 0)
+ return r;
+ sleep(1);
+ --timeout;
+ } while (timeout > 0);
+ return r;
+}
+
+/*
+** SM_SEM_REL -- release semaphore.
+**
+** Parameters:
+** semid -- id for semaphores.
+** semnum -- number of semaphore.
+** timeout -- how long to wait for operation to succeed.
+**
+** Returns:
+** 0 on success.
+** < 0 on failure.
+*/
+
+int
+sm_sem_rel(semid, semnum, timeout)
+ int semid;
+ int semnum;
+ int timeout;
+{
+ int r;
+ struct sembuf semops[1];
+
+#if PARANOID
+ /* XXX should we check whether the value is already 0 ? */
+ SM_REQUIRE(sm_get_sem(semid, semnum) > 0);
+#endif /* PARANOID */
+
+ semops[0].sem_num = semnum;
+ semops[0].sem_op = 1;
+ semops[0].sem_flg = SEM_UNDO |
+ (timeout != SM_TIME_FOREVER ? 0 : IPC_NOWAIT);
+ if (timeout == SM_TIME_IMMEDIATE || timeout == SM_TIME_FOREVER)
+ return semop(semid, semops, 1);
+ do
+ {
+ r = semop(semid, semops, 1);
+ if (r == 0)
+ return r;
+ sleep(1);
+ --timeout;
+ } while (timeout > 0);
+ return r;
+}
+
+/*
+** SM_SEM_GET -- get semaphore value.
+**
+** Parameters:
+** semid -- id for semaphores.
+** semnum -- number of semaphore.
+**
+** Returns:
+** value of semaphore on success.
+** < 0 on failure.
+*/
+
+int
+sm_sem_get(semid, semnum)
+ int semid;
+ int semnum;
+{
+ int semval;
+
+ if ((semval = semctl(semid, semnum, GETVAL, NULL)) < 0)
+ return -1;
+ return semval;
+}
+#endif /* SM_CONF_SEM */
diff --git a/gnu/usr.sbin/sendmail/libsm/shm.c b/gnu/usr.sbin/sendmail/libsm/shm.c
index d4e6838843c..91e7a87bd0b 100644
--- a/gnu/usr.sbin/sendmail/libsm/shm.c
+++ b/gnu/usr.sbin/sendmail/libsm/shm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2001, 2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2001, 2003, 2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: shm.c,v 1.16 2003/06/13 21:18:08 ca Exp $")
+SM_RCSID("@(#)$Sendmail: shm.c,v 1.18 2005/02/09 01:54:51 ca Exp $")
#if SM_CONF_SHM
# include <stdlib.h>
@@ -104,4 +104,38 @@ sm_shmstop(shm, shmid, owner)
}
+/*
+** SM_SHMSETOWNER -- set owner/group/mode of shared memory segment.
+**
+** Parameters:
+** shmid -- id.
+** uid -- uid to use
+** gid -- gid to use
+** mode -- mode to use
+**
+** Returns:
+** 0 on success.
+** < 0 on failure.
+*/
+
+int
+sm_shmsetowner(shmid, uid, gid, mode)
+ int shmid;
+ uid_t uid;
+ gid_t gid;
+ mode_t mode;
+{
+ int r;
+ struct shmid_ds shmid_ds;
+
+ memset(&shmid_ds, 0, sizeof(shmid_ds));
+ if ((r = shmctl(shmid, IPC_STAT, &shmid_ds)) < 0)
+ return r;
+ shmid_ds.shm_perm.uid = uid;
+ shmid_ds.shm_perm.gid = gid;
+ shmid_ds.shm_perm.mode = mode;
+ if ((r = shmctl(shmid, IPC_SET, &shmid_ds)) < 0)
+ return r;
+ return 0;
+}
#endif /* SM_CONF_SHM */
diff --git a/gnu/usr.sbin/sendmail/libsm/t-sem.c b/gnu/usr.sbin/sendmail/libsm/t-sem.c
new file mode 100644
index 00000000000..b0445d2c513
--- /dev/null
+++ b/gnu/usr.sbin/sendmail/libsm/t-sem.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ */
+
+#include <sm/gen.h>
+SM_RCSID("@(#)$Sendmail: t-sem.c,v 1.14 2005/03/25 21:27:41 ca Exp $")
+
+#include <stdio.h>
+
+#if SM_CONF_SEM
+# include <stdlib.h>
+# include <unistd.h>
+# include <sysexits.h>
+# include <sm/heap.h>
+# include <sm/string.h>
+# include <sm/signal.h>
+# include <sm/test.h>
+# include <sm/sem.h>
+
+static void
+delay(t, s)
+ int t;
+ char *s;
+{
+ if (t > 0)
+ {
+#if DEBUG
+ fprintf(stderr, "sleep(%d) before %s\n", t, s);
+#endif /* DEBUG */
+ sleep(t);
+ }
+#if DEBUG
+ fprintf(stderr, "%s\n", s);
+#endif /* DEBUG */
+}
+
+
+/*
+** SEMINTER -- interactive testing of semaphores.
+**
+** Parameters:
+** owner -- create semaphores.
+**
+** Returns:
+** 0 on success
+** < 0 on failure.
+*/
+
+static int
+seminter(owner)
+ bool owner;
+{
+ int semid;
+ int t;
+
+ semid = sm_sem_start(SM_SEM_KEY, SM_NSEM, 0, owner);
+ if (semid < 0)
+ {
+ perror("sm_sem_start failed");
+ return 1;
+ }
+
+ while ((t = getchar()) != EOF)
+ {
+ switch (t)
+ {
+ case 'a':
+ delay(0, "try to acq");
+ if (sm_sem_acq(semid, 0, 2) < 0)
+ {
+ perror("sm_sem_acq failed");
+ return 1;
+ }
+ delay(0, "acquired");
+ break;
+
+ case 'r':
+ delay(0, "try to rel");
+ if (sm_sem_rel(semid, 0, 2) < 0)
+ {
+ perror("sm_sem_rel failed");
+ return 1;
+ }
+ delay(0, "released");
+ break;
+
+ case 'v':
+ if ((t = sm_sem_get(semid, 0)) < 0)
+ {
+ perror("get_sem failed");
+ return 1;
+ }
+ printf("semval: %d\n", t);
+ break;
+
+ }
+ }
+ if (owner)
+ return sm_sem_stop(semid);
+ return 0;
+}
+
+/*
+** SEM_CLEANUP -- cleanup if something breaks
+**
+** Parameters:
+** sig -- signal.
+**
+** Returns:
+** none.
+*/
+
+static int semid_c = -1;
+void
+sem_cleanup(sig)
+ int sig;
+{
+ if (semid_c >= 0)
+ (void) sm_sem_stop(semid_c);
+ exit(EX_UNAVAILABLE);
+}
+
+/*
+** SEMTEST -- test of semaphores
+**
+** Parameters:
+** owner -- create semaphores.
+**
+** Returns:
+** 0 on success
+** < 0 on failure.
+*/
+
+# define MAX_CNT 10
+
+static int
+semtest(owner)
+ int owner;
+{
+ int semid, r;
+ int cnt = 0;
+
+ semid = sm_sem_start(SM_SEM_KEY, 1, 0, owner);
+ if (semid < 0)
+ {
+ perror("sm_sem_start failed");
+ return -1;
+ }
+
+ if (owner)
+ {
+ /* just in case someone kills the program... */
+ semid_c = semid;
+ (void) sm_signal(SIGHUP, sem_cleanup);
+ (void) sm_signal(SIGINT, sem_cleanup);
+ (void) sm_signal(SIGTERM, sem_cleanup);
+
+ delay(1, "parent: acquire 1");
+ cnt = 0;
+ do
+ {
+ r = sm_sem_acq(semid, 0, 0);
+ if (r < 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r < 0 && cnt <= MAX_CNT);
+ SM_TEST(r >= 0);
+ if (r < 0)
+ return r;
+
+ delay(3, "parent: release 1");
+ cnt = 0;
+ do
+ {
+ r = sm_sem_rel(semid, 0, 0);
+ if (r < 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r < 0 && cnt <= MAX_CNT);
+ SM_TEST(r >= 0);
+ if (r < 0)
+ return r;
+
+ delay(1, "parent: getval");
+ cnt = 0;
+ do
+ {
+ r = sm_sem_get(semid, 0);
+ if (r <= 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r <= 0 && cnt <= MAX_CNT);
+ SM_TEST(r > 0);
+ if (r <= 0)
+ return r;
+
+ delay(1, "parent: acquire 2");
+ cnt = 0;
+ do
+ {
+ r = sm_sem_acq(semid, 0, 0);
+ if (r < 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r < 0 && cnt <= MAX_CNT);
+ SM_TEST(r >= 0);
+ if (r < 0)
+ return r;
+
+ cnt = 0;
+ do
+ {
+ r = sm_sem_rel(semid, 0, 0);
+ if (r < 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r < 0 && cnt <= MAX_CNT);
+ SM_TEST(r >= 0);
+ if (r < 0)
+ return r;
+ }
+ else
+ {
+ delay(1, "child: acquire 1");
+ cnt = 0;
+ do
+ {
+ r = sm_sem_acq(semid, 0, 0);
+ if (r < 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r < 0 && cnt <= MAX_CNT);
+ SM_TEST(r >= 0);
+ if (r < 0)
+ return r;
+
+ delay(1, "child: release 1");
+ cnt = 0;
+ do
+ {
+ r = sm_sem_rel(semid, 0, 0);
+ if (r < 0)
+ {
+ sleep(1);
+ ++cnt;
+ }
+ } while (r < 0 && cnt <= MAX_CNT);
+ SM_TEST(r >= 0);
+ if (r < 0)
+ return r;
+
+ }
+ if (owner)
+ return sm_sem_stop(semid);
+ return 0;
+}
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ bool interactive = false;
+ bool owner = false;
+ int ch;
+ int r = 0;
+
+# define OPTIONS "io"
+ while ((ch = getopt(argc, argv, OPTIONS)) != -1)
+ {
+ switch ((char) ch)
+ {
+ case 'i':
+ interactive = true;
+ break;
+
+ case 'o':
+ owner = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (interactive)
+ r = seminter(owner);
+ else
+ {
+ pid_t pid;
+
+ printf("This test takes about 8 seconds.\n");
+ printf("If it takes longer than 30 second, please interrupt it\n");
+ printf("and compile again without semaphore support, i.e.,");
+ printf("-DSM_CONF_SEM=0\n");
+ if ((pid = fork()) < 0)
+ {
+ perror("fork failed\n");
+ return -1;
+ }
+
+ sm_test_begin(argc, argv, "test semaphores");
+ if (pid == 0)
+ {
+ /* give the parent the chance to setup data */
+ sleep(1);
+ r = semtest(false);
+ }
+ else
+ {
+ r = semtest(true);
+ }
+ SM_TEST(r == 0);
+ return sm_test_end();
+ }
+ return r;
+}
+#else /* SM_CONF_SEM */
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ printf("No support for semaphores configured on this machine\n");
+ return 0;
+}
+#endif /* SM_CONF_SEM */
diff --git a/gnu/usr.sbin/sendmail/libsm/t-shm.c b/gnu/usr.sbin/sendmail/libsm/t-shm.c
index 103b2f15363..2dfb9ee5283 100644
--- a/gnu/usr.sbin/sendmail/libsm/t-shm.c
+++ b/gnu/usr.sbin/sendmail/libsm/t-shm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002, 2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2002, 2004, 2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: t-shm.c,v 1.20 2004/08/03 20:51:36 ca Exp $")
+SM_RCSID("@(#)$Sendmail: t-shm.c,v 1.22 2005/01/14 02:14:10 ca Exp $")
#include <stdio.h>
@@ -83,6 +83,10 @@ shminter(owner)
case 'v':
printf("shmval: %d\n", *shm);
break;
+ case 'S':
+ i = sm_shmsetowner(shmid, getuid(), getgid(), 0644);
+ printf("sm_shmsetowner=%d\n", i);
+ break;
}
}
return sm_shmstop((void *) shm, shmid, owner);
@@ -165,6 +169,8 @@ shmtest(owner)
{
int r;
+ r = sm_shmsetowner(shmid, getuid(), getgid(), 0660);
+ SM_TEST(r == 0);
*shm = 1;
while (*shm == 1 && cnt++ < MAX_CNT)
sleep(1);
diff --git a/gnu/usr.sbin/sendmail/sendmail/README b/gnu/usr.sbin/sendmail/sendmail/README
index 749ed134021..e1bd55cf252 100644
--- a/gnu/usr.sbin/sendmail/sendmail/README
+++ b/gnu/usr.sbin/sendmail/sendmail/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Sendmail: README,v 8.385 2004/11/25 06:52:06 msk Exp $
+# $Sendmail: README,v 8.386 2005/03/04 23:24:08 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -375,6 +375,9 @@ LA_TYPE The type of load average your kernel supports. These
LA_DEVSHORT (13) reads a short from a system file (default:
/dev/table/avenrun) and scales it in the same manner
as LA_SHORT.
+ LA_LONGLONG (17) to read /dev/kmem for the symbol avenrun and
+ interpret as a long long integer (e.g., for 64 bit
+ systems).
LA_INT, LA_SHORT, LA_FLOAT, and LA_READKSYM have several
other parameters that they try to divine: the name of your
kernel, the name of the variable in the kernel to examine,
@@ -1823,4 +1826,4 @@ util.c Some general purpose routines used by sendmail.
version.c The version number and information about this
version of sendmail.
-(Version $Revision: 1.22 $, last update $Date: 2004/12/16 00:21:30 $ )
+(Version $Revision: 1.23 $, last update $Date: 2005/04/08 16:00:50 $ )
diff --git a/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS b/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS
index 372b864ee9c..ebcf4abcfe6 100644
--- a/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS
+++ b/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS
@@ -1,4 +1,4 @@
-# $Sendmail: TRACEFLAGS,v 8.42 2003/06/13 22:29:11 lijian Exp $
+# $Sendmail: TRACEFLAGS,v 8.43 2005/02/16 23:38:51 ca Exp $
0, 4 main.c main canonical name, UUCP node name, a.k.a.s
0, 15 main.c main print configuration
0, 44 util.c printav print address of each string
@@ -83,6 +83,7 @@
#endif /* _FFR_QUEUE_SCHED_DBG */
70 queue.c quarantining
71,>99 milter.c quarantine on errors
+73 queue.c shared memory updates
80 content length
81 sun remote mode
91 mci.c syslogging of MCI cache information
diff --git a/gnu/usr.sbin/sendmail/sendmail/collect.c b/gnu/usr.sbin/sendmail/sendmail/collect.c
index f62471a11aa..42ee81334ad 100644
--- a/gnu/usr.sbin/sendmail/sendmail/collect.c
+++ b/gnu/usr.sbin/sendmail/sendmail/collect.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: collect.c,v 8.260 2004/11/30 23:29:15 ca Exp $")
+SM_RCSID("@(#)$Sendmail: collect.c,v 8.261 2005/02/16 23:38:51 ca Exp $")
static void collecttimeout __P((int));
static void eatfrom __P((char *volatile, ENVELOPE *));
@@ -728,6 +728,7 @@ readerr:
{
/* skip next few clauses */
/* EMPTY */
+ /* Note: updfs() is not called in this case! */
}
else if (sm_io_setinfo(df, SM_BF_COMMIT, NULL) < 0 && errno != EINVAL)
{
@@ -781,7 +782,7 @@ readerr:
df = NULL;
/* remove from available space in filesystem */
- updfs(e, false, true);
+ updfs(e, 0, 1, "collect");
}
/* An EOF when running SMTP is an error */
diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.c b/gnu/usr.sbin/sendmail/sendmail/conf.c
index a8f9c7319ad..bf9b221199c 100644
--- a/gnu/usr.sbin/sendmail/sendmail/conf.c
+++ b/gnu/usr.sbin/sendmail/sendmail/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: conf.c,v 8.1052 2004/12/15 22:45:55 ca Exp $")
+SM_RCSID("@(#)$Sendmail: conf.c,v 8.1061 2005/03/07 17:18:44 ca Exp $")
#include <sendmail/pathnames.h>
#if NEWDB
@@ -1431,6 +1431,7 @@ init_vendor_macros(e)
#define LA_DEVSHORT 13 /* read short from a device */
#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
#define LA_PSET 15 /* Solaris per-processor-set load average */
+#define LA_LONGLONG 17 /* read kmem for avenrun; interpret as long long */
/* do guesses based on general OS type */
#ifndef LA_TYPE
@@ -1469,7 +1470,7 @@ init_vendor_macros(e)
# define _PATH_KMEM "/dev/kmem"
#endif /* ! _PATH_KMEM */
-#if (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT)
+#if (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG)
# include <nlist.h>
@@ -1503,8 +1504,12 @@ getla()
# else /* LA_TYPE == LA_INT */
# if LA_TYPE == LA_SHORT
short avenrun[3];
-# else /* LA_TYPE == LA_SHORT */
+# else
+# if LA_TYPE == LA_LONGLONG
+ long long avenrun[3];
+# else /* LA_TYPE == LA_LONGLONG */
double avenrun[3];
+# endif /* LA_TYPE == LA_LONGLONG */
# endif /* LA_TYPE == LA_SHORT */
# endif /* LA_TYPE == LA_INT */
extern off_t lseek();
@@ -1570,7 +1575,7 @@ getla()
sm_errstring(errno));
return -1;
}
-# if (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT)
+# if (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG)
if (tTd(3, 5))
{
# if LA_TYPE == LA_SHORT
@@ -1578,9 +1583,15 @@ getla()
if (tTd(3, 15))
sm_dprintf(", %d, %d", avenrun[1], avenrun[2]);
# else /* LA_TYPE == LA_SHORT */
+# if LA_TYPE == LA_LONGLONG
+ sm_dprintf("getla: avenrun = %lld", avenrun[0]);
+ if (tTd(3, 15))
+ sm_dprintf(", %lld, %lld", avenrun[1], avenrun[2]);
+# else /* LA_TYPE == LA_LONGLONG */
sm_dprintf("getla: avenrun = %ld", avenrun[0]);
if (tTd(3, 15))
sm_dprintf(", %ld, %ld", avenrun[1], avenrun[2]);
+# endif /* LA_TYPE == LA_LONGLONG */
# endif /* LA_TYPE == LA_SHORT */
sm_dprintf("\n");
}
@@ -1588,7 +1599,7 @@ getla()
sm_dprintf("getla: %d\n",
(int) (avenrun[0] + FSCALE/2) >> FSHIFT);
return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
-# else /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) */
+# else /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG) */
if (tTd(3, 5))
{
sm_dprintf("getla: avenrun = %g", avenrun[0]);
@@ -1599,10 +1610,10 @@ getla()
if (tTd(3, 1))
sm_dprintf("getla: %d\n", (int) (avenrun[0] +0.5));
return ((int) (avenrun[0] + 0.5));
-# endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) */
+# endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG) */
}
-#endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) */
+#endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG) */
#if LA_TYPE == LA_READKSYM
@@ -6042,6 +6053,10 @@ char *FFRCompileOptions[] =
/* Problem noted by Anne Bennett of Concordia University */
"_FFR_DIGUNIX_SAFECHOWN",
#endif /* _FFR_DIGUNIX_SAFECHOWN */
+#if _FFR_DM_PER_DAEMON
+ /* DeliveryMode per DaemonPortOptions: 'D' */
+ "_FFR_DM_PER_DAEMON",
+#endif /* _FFR_DM_PER_DAEMON */
#if _FFR_DNSMAP_ALIASABLE
/* Allow dns map type to be used for aliases. */
/* Don Lewis of TDK */
@@ -6172,6 +6187,10 @@ char *FFRCompileOptions[] =
/* Disable PIPELINING, delay client if used. */
"_FFR_NO_PIPE",
#endif /* _FFR_NO_PIPE */
+#if _FFR_LOG_NTRIES
+ /* log ntries=, from Nik Clayton of FreeBSD */
+ "_FFR_LOG_NTRIES",
+#endif /* _FFR_LOG_NTRIES */
#if _FFR_PRIV_NOACTUALRECIPIENT
/*
** PrivacyOptions=noactualrecipient stops sendmail from putting
@@ -6179,7 +6198,7 @@ char *FFRCompileOptions[] =
** account that addresses map to. Patch from Dan Harkless.
*/
- "_FFR_PRIV_NOACTUALRECIPIENT"
+ "_FFR_PRIV_NOACTUALRECIPIENT",
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
#if _FFR_QUEUEDELAY
/* Exponential queue delay; disabled in 8.13 since it isn't used. */
@@ -6251,6 +6270,10 @@ char *FFRCompileOptions[] =
/* Chris Adams of HiWAAY Informations Services */
"_FFR_SPT_ALIGN",
#endif /* _FFR_SPT_ALIGN */
+#if _FFR_SS_PER_DAEMON
+ /* SuperSafe per DaemonPortOptions: 'T' (better letter?) */
+ "_FFR_SS_PER_DAEMON",
+#endif /* _FFR_SS_PER_DAEMON */
#if _FFR_TIMERS
/* Donated code (unused). */
"_FFR_TIMERS",
@@ -6268,6 +6291,9 @@ char *FFRCompileOptions[] =
"_FFR_TRUSTED_QF",
#endif /* _FFR_TRUSTED_QF */
+#if _FFR_USE_SEM_LOCKING
+ "_FFR_USE_SEM_LOCKING",
+#endif /* _FFR_USE_SEM_LOCKING */
#if _FFR_USE_SETLOGIN
/* Use setlogin() */
/* Peter Philipp */
diff --git a/gnu/usr.sbin/sendmail/sendmail/daemon.c b/gnu/usr.sbin/sendmail/sendmail/daemon.c
index b1ac41e4ec0..0e3de18fb92 100644
--- a/gnu/usr.sbin/sendmail/sendmail/daemon.c
+++ b/gnu/usr.sbin/sendmail/sendmail/daemon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: daemon.c,v 8.653 2004/11/18 23:45:01 ca Exp $")
+SM_RCSID("@(#)$Sendmail: daemon.c,v 8.658 2005/02/02 18:19:28 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -77,10 +77,22 @@ struct daemon
char *d_inputfilterlist;
struct milter *d_inputfilters[MAXFILTERS];
#endif /* MILTER */
+#if _FFR_SS_PER_DAEMON
+ int d_supersafe;
+#endif /* _FFR_SS_PER_DAEMON */
+#if _FFR_DM_PER_DAEMON
+ int d_dm; /* DeliveryMode */
+#endif /* _FFR_DM_PER_DAEMON */
};
typedef struct daemon DAEMON_T;
+#define SAFE_NOTSET (-1) /* SuperSafe (per daemon) option not set */
+/* see also sendmail.h: SuperSafe values */
+
+#define DM_NOTSET (-1) /* DeliveryMode (per daemon) option not set */
+/* see also sendmail.h: values for e_sendmode -- send modes */
+
static void connecttimeout __P((int));
static int opendaemonsocket __P((DAEMON_T *, bool));
static unsigned short setupdaemon __P((SOCKADDR *));
@@ -742,6 +754,17 @@ getrequests(e)
/* don't schedule queue runs if ETRN */
QueueIntvl = 0;
+#if _FFR_SS_PER_DAEMON
+ if (Daemons[curdaemon].d_supersafe !=
+ SAFE_NOTSET)
+ SuperSafe = Daemons[curdaemon].d_supersafe;
+#endif /* _FFR_SS_PER_DAEMON */
+#if _FFR_DM_PER_DAEMON
+ if (Daemons[curdaemon].d_dm != DM_NOTSET)
+ set_delivery_mode(
+ Daemons[curdaemon].d_dm, e);
+#endif /* _FFR_DM_PER_DAEMON */
+
sm_setproctitle(true, e, "startup with %s",
anynet_ntoa(&RealHostAddr));
@@ -1453,9 +1476,37 @@ setsockaddroptions(p, d)
continue;
if (isascii(*f) && islower(*f))
*f = toupper(*f);
+#if _FFR_SS_PER_DAEMON
+ d->d_supersafe = SAFE_NOTSET;
+#endif /* _FFR_SS_PER_DAEMON */
+#if _FFR_DM_PER_DAEMON
+ d->d_dm = DM_NOTSET;
+#endif /* _FFR_DM_PER_DAEMON */
switch (*f)
{
+ case 'A': /* address */
+ addr = v;
+ break;
+
+#if _FFR_DM_PER_DAEMON
+ case 'D': /* DeliveryMode */
+ switch (*v)
+ {
+ case SM_QUEUE:
+ case SM_DEFER:
+ case SM_DELIVER:
+ case SM_FORK:
+ d->d_dm = *v;
+ break;
+ default:
+ syserr("554 5.3.5 Unknown delivery mode %c",
+ *v);
+ break;
+ }
+ break;
+#endif /* _FFR_DM_PER_DAEMON */
+
case 'F': /* address family */
if (isascii(*v) && isdigit(*v))
d->d_addr.sa.sa_family = atoi(v);
@@ -1491,20 +1542,12 @@ setsockaddroptions(p, d)
v);
break;
- case 'A': /* address */
- addr = v;
- break;
-
#if MILTER
case 'I':
d->d_inputfilterlist = v;
break;
#endif /* MILTER */
- case 'P': /* port */
- port = v;
- break;
-
case 'L': /* listen queue size */
d->d_listenqueue = atoi(v);
break;
@@ -1513,17 +1556,38 @@ setsockaddroptions(p, d)
d->d_mflags = getmodifiers(v, d->d_flags);
break;
- case 'S': /* send buffer size */
- d->d_tcpsndbufsize = atoi(v);
+ case 'N': /* name */
+ d->d_name = v;
+ break;
+
+ case 'P': /* port */
+ port = v;
break;
case 'R': /* receive buffer size */
d->d_tcprcvbufsize = atoi(v);
break;
- case 'N': /* name */
- d->d_name = v;
+ case 'S': /* send buffer size */
+ d->d_tcpsndbufsize = atoi(v);
+ break;
+
+#if _FFR_SS_PER_DAEMON
+ case 'T': /* SuperSafe */
+ if (tolower(*v) == 'i')
+ d->d_supersafe = SAFE_INTERACTIVE;
+ else if (tolower(*v) == 'p')
+# if MILTER
+ d->d_supersafe = SAFE_REALLY_POSTMILTER;
+# else /* MILTER */
+ (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
+ "Warning: SuperSafe=PostMilter requires Milter support (-DMILTER)\n");
+# endif /* MILTER */
+ else
+ d->d_supersafe = atobool(v) ? SAFE_REALLY
+ : SAFE_NO;
break;
+#endif /* _FFR_SS_PER_DAEMON */
default:
syserr("554 5.3.5 PortOptions parameter \"%s\" unknown",
diff --git a/gnu/usr.sbin/sendmail/sendmail/deliver.c b/gnu/usr.sbin/sendmail/sendmail/deliver.c
index 98082f33791..65bbdb3be14 100644
--- a/gnu/usr.sbin/sendmail/sendmail/deliver.c
+++ b/gnu/usr.sbin/sendmail/sendmail/deliver.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sys/time.h>
-SM_RCSID("@(#)$Sendmail: deliver.c,v 8.983 2005/01/07 17:43:22 ca Exp $")
+SM_RCSID("@(#)$Sendmail: deliver.c,v 8.986 2005/03/05 02:28:50 ca Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -4267,6 +4267,16 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
bp += strlen(bp);
}
+#if _FFR_LOG_NTRIES
+ /* ntries */
+ if (e->e_ntries >= 0)
+ {
+ (void) sm_snprintf(bp, SPACELEFT(buf, bp),
+ ", ntries=%d", e->e_ntries + 1);
+ bp += strlen(bp);
+ }
+#endif /* _FFR_LOG_NTRIES */
+
# define STATLEN (((SYSLOG_BUFSIZE) - 100) / 4)
# if (STATLEN) < 63
# undef STATLEN
@@ -5673,6 +5683,10 @@ hostsignature(m, host)
!(m->m_argv[0] != NULL && strcmp(m->m_argv[0], "TCP") == 0))
return "localhost";
+ /* an empty host does not have MX records */
+ if (*host == '\0')
+ return "_empty_";
+
/*
** Check to see if this uses IPC -- if not, it can't have MX records.
*/
diff --git a/gnu/usr.sbin/sendmail/sendmail/domain.c b/gnu/usr.sbin/sendmail/sendmail/domain.c
index 1e4abb07751..8d0ccd036a9 100644
--- a/gnu/usr.sbin/sendmail/sendmail/domain.c
+++ b/gnu/usr.sbin/sendmail/sendmail/domain.c
@@ -14,9 +14,9 @@
#include <sendmail.h>
#if NAMED_BIND
-SM_RCSID("@(#)$Sendmail: domain.c,v 8.195 2004/08/04 21:11:31 ca Exp $ (with name server)")
+SM_RCSID("@(#)$Sendmail: domain.c,v 8.197 2005/03/04 00:54:42 ca Exp $ (with name server)")
#else /* NAMED_BIND */
-SM_RCSID("@(#)$Sendmail: domain.c,v 8.195 2004/08/04 21:11:31 ca Exp $ (without name server)")
+SM_RCSID("@(#)$Sendmail: domain.c,v 8.197 2005/03/04 00:54:42 ca Exp $ (without name server)")
#endif /* NAMED_BIND */
#if NAMED_BIND
@@ -232,6 +232,9 @@ getmxrr(host, mxhosts, mxprefs, droplocalhost, rcode, tryfallback, pttl)
if (tTd(8, 2))
sm_dprintf("getmxrr(%s, droplocalhost=%d)\n",
host, droplocalhost);
+ *rcode = EX_OK;
+ if (pttl != NULL)
+ *pttl = SM_DEFAULT_TTL;
if (*host == '\0')
return 0;
@@ -242,8 +245,6 @@ getmxrr(host, mxhosts, mxprefs, droplocalhost, rcode, tryfallback, pttl)
fallbackMX = NULL;
}
- *rcode = EX_OK;
-
if (mxprefs != NULL)
prefs = mxprefs;
else
diff --git a/gnu/usr.sbin/sendmail/sendmail/envelope.c b/gnu/usr.sbin/sendmail/sendmail/envelope.c
index 9041096d8af..726c694f03b 100644
--- a/gnu/usr.sbin/sendmail/sendmail/envelope.c
+++ b/gnu/usr.sbin/sendmail/sendmail/envelope.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: envelope.c,v 8.293 2004/02/18 00:46:18 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: envelope.c,v 8.294 2005/02/16 23:38:51 ca Exp $")
/*
** CLRSESSENVELOPE -- clear session oriented data in an envelope
@@ -518,7 +518,7 @@ simpledrop:
if (xunlink(queuename(e, ANYQFL_LETTER)) == 0)
{
/* add to available space in filesystem */
- updfs(e, true, !panic);
+ updfs(e, -1, panic ? 0 : -1, "dropenvelope");
}
if (e->e_ntries > 0 && LogLevel > 9)
diff --git a/gnu/usr.sbin/sendmail/sendmail/map.c b/gnu/usr.sbin/sendmail/sendmail/map.c
index 48d50258c47..a91dd99e5cc 100644
--- a/gnu/usr.sbin/sendmail/sendmail/map.c
+++ b/gnu/usr.sbin/sendmail/sendmail/map.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: map.c,v 8.666 2004/08/17 16:50:19 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: map.c,v 8.669 2005/02/09 01:46:35 ca Exp $")
#if LDAPMAP
# include <sm/ldap.h>
@@ -5657,12 +5657,14 @@ stab_map_lookup(map, name, av, pstat)
map->map_mname, name);
s = stab(name, ST_ALIAS, ST_FIND);
- if (s != NULL)
- return s->s_alias;
- return NULL;
+ if (s == NULL)
+ return NULL;
+ if (bitset(MF_MATCHONLY, map->map_mflags))
+ return map_rewrite(map, name, strlen(name), NULL);
+ else
+ return map_rewrite(map, s->s_alias, strlen(s->s_alias), av);
}
-
/*
** STAB_MAP_STORE -- store in symtab (actually using during init, not rebuild)
*/
@@ -7554,8 +7556,9 @@ socket_map_lookup(map, name, av, statp)
int *statp;
{
unsigned int nettolen, replylen, recvlen;
- char *replybuf, *rval, *value, *status;
+ char *replybuf, *rval, *value, *status, *key;
SM_FILE_T *f;
+ char keybuf[MAXNAME + 1];
replybuf = NULL;
rval = NULL;
@@ -7564,11 +7567,24 @@ socket_map_lookup(map, name, av, statp)
sm_dprintf("socket_map_lookup(%s, %s) %s\n",
map->map_mname, name, map->map_file);
- nettolen = strlen(map->map_mname) + 1 + strlen(name);
+ if (!bitset(MF_NOFOLDCASE, map->map_mflags))
+ {
+ nettolen = strlen(name);
+ if (nettolen > sizeof keybuf - 1)
+ nettolen = sizeof keybuf - 1;
+ memmove(keybuf, name, nettolen);
+ keybuf[nettolen] = '\0';
+ makelower(keybuf);
+ key = keybuf;
+ }
+ else
+ key = name;
+
+ nettolen = strlen(map->map_mname) + 1 + strlen(key);
SM_ASSERT(nettolen > strlen(map->map_mname));
- SM_ASSERT(nettolen > strlen(name));
+ SM_ASSERT(nettolen > strlen(key));
if ((sm_io_fprintf(f, SM_TIME_DEFAULT, "%u:%s %s,",
- nettolen, map->map_mname, name) == SM_IO_EOF) ||
+ nettolen, map->map_mname, key) == SM_IO_EOF) ||
(sm_io_flush(f, SM_TIME_DEFAULT) != 0) ||
(sm_io_error(f)))
{
@@ -7638,7 +7654,7 @@ socket_map_lookup(map, name, av, statp)
/* collect the return value */
if (bitset(MF_MATCHONLY, map->map_mflags))
- rval = map_rewrite(map, name, strlen(name), NULL);
+ rval = map_rewrite(map, key, strlen(key), NULL);
else
rval = map_rewrite(map, value, strlen(value), av);
}
@@ -7647,13 +7663,13 @@ socket_map_lookup(map, name, av, statp)
*statp = EX_NOTFOUND;
if (tTd(38, 20))
sm_dprintf("socket_map_lookup(%s): %s not found\n",
- map->map_mname, name);
+ map->map_mname, key);
}
else
{
if (tTd(38, 5))
sm_dprintf("socket_map_lookup(%s, %s): server returned error: type=%s, reason=%s\n",
- map->map_mname, name, status,
+ map->map_mname, key, status,
value ? value : "");
if ((strcmp(status, "TEMP") == 0) ||
(strcmp(status, "TIMEOUT") == 0))
diff --git a/gnu/usr.sbin/sendmail/sendmail/mci.c b/gnu/usr.sbin/sendmail/sendmail/mci.c
index fe71005ae04..b4ab7100dc4 100644
--- a/gnu/usr.sbin/sendmail/sendmail/mci.c
+++ b/gnu/usr.sbin/sendmail/sendmail/mci.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: mci.c,v 8.212 2004/08/04 21:11:31 ca Exp $")
+SM_RCSID("@(#)$Sendmail: mci.c,v 8.214 2005/02/04 22:01:45 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -398,6 +398,57 @@ mci_get(host, m)
return mci;
}
+
+/*
+** MCI_CLOSE -- (forcefully) close files used for a connection.
+** Note: this is a last resort, usually smtpquit() or endmailer()
+** should be used to close a connection.
+**
+** Parameters:
+** mci -- the connection to close.
+** where -- where has this been called?
+**
+** Returns:
+** none.
+*/
+
+void
+mci_close(mci, where)
+ MCI *mci;
+ char *where;
+{
+ bool dumped;
+
+ if (mci == NULL)
+ return;
+ dumped = false;
+ if (mci->mci_out != NULL)
+ {
+ if (tTd(56, 1))
+ {
+ sm_dprintf("mci_close: mci_out!=NULL, where=%s\n",
+ where);
+ mci_dump(sm_debug_file(), mci, false);
+ dumped = true;
+ }
+ (void) sm_io_close(mci->mci_out, SM_TIME_DEFAULT);
+ mci->mci_out = NULL;
+ }
+ if (mci->mci_in != NULL)
+ {
+ if (tTd(56, 1))
+ {
+ sm_dprintf("mci_close: mci_in!=NULL, where=%s\n",
+ where);
+ if (!dumped)
+ mci_dump(sm_debug_file(), mci, false);
+ }
+ (void) sm_io_close(mci->mci_in, SM_TIME_DEFAULT);
+ mci->mci_in = NULL;
+ }
+ mci->mci_state = MCIS_CLOSED;
+}
+
/*
** MCI_NEW -- allocate new MCI structure
**
diff --git a/gnu/usr.sbin/sendmail/sendmail/milter.c b/gnu/usr.sbin/sendmail/sendmail/milter.c
index cb3a81e0a37..d3a5e061d2b 100644
--- a/gnu/usr.sbin/sendmail/sendmail/milter.c
+++ b/gnu/usr.sbin/sendmail/sendmail/milter.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: milter.c,v 8.228 2004/11/09 18:54:55 ca Exp $")
+SM_RCSID("@(#)$Sendmail: milter.c,v 8.229 2005/03/02 02:32:34 ca Exp $")
#if MILTER
# include <libmilter/mfapi.h>
@@ -350,6 +350,16 @@ milter_read(m, cmd, rlen, to, e)
char *buf;
char data[MILTER_LEN_BYTES + 1];
+ if (m->mf_sock < 0)
+ {
+ if (MilterLogLevel > 0)
+ sm_syslog(LOG_ERR, e->e_id,
+ "milter_read(%s): socket closed",
+ m->mf_name);
+ milter_error(m, e);
+ return NULL;
+ }
+
*rlen = 0;
*cmd = '\0';
@@ -487,6 +497,15 @@ milter_write(m, cmd, buf, len, to, e)
milter_error(m, e);
return NULL;
}
+ if (m->mf_sock < 0)
+ {
+ if (MilterLogLevel > 0)
+ sm_syslog(LOG_ERR, e->e_id,
+ "milter_write(%s): socket closed",
+ m->mf_name);
+ milter_error(m, e);
+ return NULL;
+ }
if (tTd(64, 20))
sm_dprintf("milter_write(%s): cmd %c, len %ld\n",
@@ -1852,7 +1871,7 @@ milter_send_macros(m, macros, cmd, e)
}
(void) milter_write(m, SMFIC_MACRO, buf, s,
m->mf_timeout[SMFTO_WRITE], e);
- sm_free(buf); /* XXX */
+ sm_free(buf);
}
/*
@@ -3760,8 +3779,11 @@ milter_data(e, state)
}
if (MilterEOMMacros[0] != NULL)
+ {
milter_send_macros(m, MilterEOMMacros,
SMFIC_BODYEOB, e);
+ MILTER_CHECK_RESULTS();
+ }
/* send the final body chunk */
(void) milter_write(m, SMFIC_BODYEOB, NULL, 0,
diff --git a/gnu/usr.sbin/sendmail/sendmail/parseaddr.c b/gnu/usr.sbin/sendmail/sendmail/parseaddr.c
index 3b581338c1b..b23e22fca73 100644
--- a/gnu/usr.sbin/sendmail/sendmail/parseaddr.c
+++ b/gnu/usr.sbin/sendmail/sendmail/parseaddr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: parseaddr.c,v 8.379 2004/08/06 22:19:36 ca Exp $")
+SM_RCSID("@(#)$Sendmail: parseaddr.c,v 8.381 2005/02/04 22:01:45 ca Exp $")
static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
static int callsubr __P((char**, int, ENVELOPE *));
@@ -2194,9 +2194,22 @@ cataddr(pvp, evp, buf, sz, spacesub)
break;
}
- /* Don't silently truncate long strings */
+#if 0
+ /*
+ ** Silently truncate long strings: even though this doesn't
+ ** seem like a good idea it is necessary because header checks
+ ** send the whole header value to rscheck() and hence rewrite().
+ ** The latter however sometimes uses a "short" buffer (e.g.,
+ ** cbuf[MAXNAME + 1]) to call cataddr() which then triggers this
+ ** error function. One possible fix to the problem is to pass
+ ** flags to rscheck() and rewrite() to distinguish the various
+ ** calls and only trigger the error if necessary. For now just
+ ** undo the change from 8.13.0.
+ */
+
if (sz <= 0)
usrerr("cataddr: string too long");
+#endif
*p = '\0';
}
/*
diff --git a/gnu/usr.sbin/sendmail/sendmail/queue.c b/gnu/usr.sbin/sendmail/sendmail/queue.c
index dbdc71a1aeb..97baa24b571 100644
--- a/gnu/usr.sbin/sendmail/sendmail/queue.c
+++ b/gnu/usr.sbin/sendmail/sendmail/queue.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,8 +12,9 @@
*/
#include <sendmail.h>
+#include <sm/sem.h>
-SM_RCSID("@(#)$Sendmail: queue.c,v 8.939 2004/08/03 19:57:23 ca Exp $")
+SM_RCSID("@(#)$Sendmail: queue.c,v 8.944 2005/02/17 23:58:58 ca Exp $")
#include <dirent.h>
@@ -401,6 +402,7 @@ queueup(e, announce, msync)
/* NOTREACHED */
}
e->e_lockfp = tfp;
+ upd_qs(e, 1, 0, "queueup");
}
/* if newid, write the queue file directly (instead of temp file) */
@@ -6496,13 +6498,79 @@ disk_status(out, prefix)
#endif /* _FFR_CONTROL_MSTAT */
#if SM_CONF_SHM
+
+/*
+** INIT_SEM -- initialize semaphore system
+**
+** Parameters:
+** owner -- is this the owner of semaphores?
+**
+** Returns:
+** none.
+*/
+
+#if _FFR_USE_SEM_LOCKING
+#if SM_CONF_SEM
+static int SemId = -1; /* Semaphore Id */
+int SemKey = SM_SEM_KEY;
+#endif /* SM_CONF_SEM */
+#endif /* _FFR_USE_SEM_LOCKING */
+
+static void init_sem __P((bool));
+
+static void
+init_sem(owner)
+ bool owner;
+{
+#if _FFR_USE_SEM_LOCKING
+#if SM_CONF_SEM
+ SemId = sm_sem_start(SemKey, 1, 0, owner);
+ if (SemId < 0)
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "func=init_sem, sem_key=%ld, sm_sem_start=%d",
+ (long) SemKey, SemId);
+ return;
+ }
+#endif /* SM_CONF_SEM */
+#endif /* _FFR_USE_SEM_LOCKING */
+ return;
+}
+
+/*
+** STOP_SEM -- stop semaphore system
+**
+** Parameters:
+** owner -- is this the owner of semaphores?
+**
+** Returns:
+** none.
+*/
+
+static void stop_sem __P((bool));
+
+static void
+stop_sem(owner)
+ bool owner;
+{
+#if _FFR_USE_SEM_LOCKING
+#if SM_CONF_SEM
+ if (owner && SemId >= 0)
+ sm_sem_stop(SemId);
+#endif /* SM_CONF_SEM */
+#endif /* _FFR_USE_SEM_LOCKING */
+ return;
+}
+
/*
** UPD_QS -- update information about queue when adding/deleting an entry
**
** Parameters:
** e -- envelope.
-** delete -- delete/add entry.
-** avail -- update the space available as well.
+** count -- add/remove entry (+1/0/-1: add/no change/remove)
+** space -- update the space available as well.
+** (>0/0/<0: add/no change/remove)
+** where -- caller (for logging)
**
** Returns:
** none.
@@ -6513,13 +6581,17 @@ disk_status(out, prefix)
*/
void
-upd_qs(e, delete, avail)
+upd_qs(e, count, space, where)
ENVELOPE *e;
- bool delete;
- bool avail;
+ int count;
+ int space;
+ char *where;
{
short fidx;
int idx;
+# if _FFR_USE_SEM_LOCKING
+ int r;
+# endif /* _FFR_USE_SEM_LOCKING */
long s;
if (ShmId == SM_SHM_NO_ID || e == NULL)
@@ -6527,14 +6599,21 @@ upd_qs(e, delete, avail)
if (e->e_qgrp == NOQGRP || e->e_qdir == NOQDIR)
return;
idx = Queue[e->e_qgrp]->qg_qpaths[e->e_qdir].qp_idx;
+ if (tTd(73,2))
+ sm_dprintf("func=upd_qs, count=%d, space=%d, where=%s, idx=%d, entries=%d\n",
+ count, space, where, idx, QSHM_ENTRIES(idx));
/* XXX in theory this needs to be protected with a mutex */
- if (QSHM_ENTRIES(idx) >= 0)
+ if (QSHM_ENTRIES(idx) >= 0 && count != 0)
{
- if (delete)
- --QSHM_ENTRIES(idx);
- else
- ++QSHM_ENTRIES(idx);
+# if _FFR_USE_SEM_LOCKING
+ r = sm_sem_acq(SemId, 0, 1);
+# endif /* _FFR_USE_SEM_LOCKING */
+ QSHM_ENTRIES(idx) += count;
+# if _FFR_USE_SEM_LOCKING
+ if (r >= 0)
+ r = sm_sem_rel(SemId, 0, 1);
+# endif /* _FFR_USE_SEM_LOCKING */
}
fidx = Queue[e->e_qgrp]->qg_qpaths[e->e_qdir].qp_fsysidx;
@@ -6542,7 +6621,7 @@ upd_qs(e, delete, avail)
return;
/* update available space also? (might be loseqfile) */
- if (!avail)
+ if (space == 0)
return;
/* convert size to blocks; this causes rounding errors */
@@ -6551,7 +6630,7 @@ upd_qs(e, delete, avail)
return;
/* XXX in theory this needs to be protected with a mutex */
- if (delete)
+ if (space > 0)
FILE_SYS_AVAIL(fidx) += s;
else
FILE_SYS_AVAIL(fidx) -= s;
@@ -6676,6 +6755,8 @@ init_shm(qn, owner, hash)
unsigned int hash;
{
int i;
+ int count;
+ int save_errno;
#if _FFR_SELECT_SHM
bool keyselect;
#endif /* _FFR_SELECT_SHM */
@@ -6689,120 +6770,129 @@ init_shm(qn, owner, hash)
#endif /* _FFR_SELECT_SHM */
/* This allows us to disable shared memory at runtime. */
- if (ShmKey != 0)
- {
- int count;
- int save_errno;
+ if (ShmKey == 0)
+ return;
- count = 0;
- shms = SM_T_SIZE + qn * sizeof(QUEUE_SHM_T);
+ count = 0;
+ shms = SM_T_SIZE + qn * sizeof(QUEUE_SHM_T);
#if _FFR_SELECT_SHM
- keyselect = ShmKey == SEL_SHM_KEY;
- if (keyselect)
+ keyselect = ShmKey == SEL_SHM_KEY;
+ if (keyselect)
+ {
+ if (owner)
+ ShmKey = FIRST_SHM_KEY;
+ else
{
- if (owner)
- ShmKey = FIRST_SHM_KEY;
- else
- {
- ShmKey = read_key_file(ShmKeyFile, ShmKey);
- keyselect = false;
- if (ShmKey == SEL_SHM_KEY)
- goto error;
- }
+ ShmKey = read_key_file(ShmKeyFile, ShmKey);
+ keyselect = false;
+ if (ShmKey == SEL_SHM_KEY)
+ goto error;
}
+ }
#endif /* _FFR_SELECT_SHM */
- for (;;)
+ for (;;)
+ {
+ /* allow read/write access for group? */
+ Pshm = sm_shmstart(ShmKey, shms,
+ SHM_R|SHM_W|(SHM_R>>3)|(SHM_W>>3),
+ &ShmId, owner);
+ save_errno = errno;
+ if (Pshm != NULL || !sm_file_exists(save_errno))
+ break;
+ if (++count >= 3)
{
- /* XXX: maybe allow read access for group? */
- Pshm = sm_shmstart(ShmKey, shms, SHM_R|SHM_W, &ShmId,
- owner);
- save_errno = errno;
- if (Pshm != NULL || !sm_file_exists(save_errno))
- break;
- if (++count >= 3)
- {
#if _FFR_SELECT_SHM
- if (keyselect)
- {
- ++ShmKey;
+ if (keyselect)
+ {
+ ++ShmKey;
- /* back where we started? */
- if (ShmKey == SEL_SHM_KEY)
- break;
- continue;
- }
-#endif /* _FFR_SELECT_SHM */
- break;
+ /* back where we started? */
+ if (ShmKey == SEL_SHM_KEY)
+ break;
+ continue;
}
-#if _FFR_SELECT_SHM
- /* only sleep if we are at the first key */
- if (!keyselect || ShmKey == SEL_SHM_KEY)
#endif /* _FFR_SELECT_SHM */
- sleep(count);
+ break;
}
- if (Pshm != NULL)
- {
- int *p;
+#if _FFR_SELECT_SHM
+ /* only sleep if we are at the first key */
+ if (!keyselect || ShmKey == SEL_SHM_KEY)
+#endif /* _FFR_SELECT_SHM */
+ sleep(count);
+ }
+ if (Pshm != NULL)
+ {
+ int *p;
#if _FFR_SELECT_SHM
- if (keyselect)
- (void) write_key_file(ShmKeyFile, (long) ShmKey);
+ if (keyselect)
+ (void) write_key_file(ShmKeyFile, (long) ShmKey);
#endif /* _FFR_SELECT_SHM */
- p = (int *) Pshm;
- if (owner)
+ if (owner && RunAsUid != 0)
+ {
+ i = sm_shmsetowner(ShmId, RunAsUid, RunAsGid,
+ 0660);
+ if (i != 0)
+ sm_syslog(LOG_ERR, NOQID,
+ "key=%ld, sm_shmsetowner=%d, RunAsUid=%d, RunAsGid=%d",
+ (long) ShmKey, i,
+ RunAsUid, RunAsGid);
+ }
+ p = (int *) Pshm;
+ if (owner)
+ {
+ *p = (int) shms;
+ *((pid_t *) SHM_OFF_PID(Pshm)) = CurrentPid;
+ p = (int *) SHM_OFF_TAG(Pshm);
+ *p = hash;
+ }
+ else
+ {
+ if (*p != (int) shms)
{
- *p = (int) shms;
- *((pid_t *) SHM_OFF_PID(Pshm)) = CurrentPid;
- p = (int *) SHM_OFF_TAG(Pshm);
- *p = hash;
+ save_errno = EINVAL;
+ cleanup_shm(false);
+ goto error;
}
- else
+ p = (int *) SHM_OFF_TAG(Pshm);
+ if (*p != (int) hash)
{
- if (*p != (int) shms)
- {
- save_errno = EINVAL;
- cleanup_shm(false);
- goto error;
- }
- p = (int *) SHM_OFF_TAG(Pshm);
- if (*p != (int) hash)
- {
- save_errno = EINVAL;
- cleanup_shm(false);
- goto error;
- }
-
- /*
- ** XXX how to check the pid?
- ** Read it from the pid-file? That does
- ** not need to exist.
- ** We could disable shm if we can't confirm
- ** that it is the right one.
- */
+ save_errno = EINVAL;
+ cleanup_shm(false);
+ goto error;
}
- PtrFileSys = (FILESYS *) OFF_FILE_SYS(Pshm);
- PNumFileSys = (int *) OFF_NUM_FILE_SYS(Pshm);
- QShm = (QUEUE_SHM_T *) OFF_QUEUE_SHM(Pshm);
- PRSATmpCnt = (int *) OFF_RSA_TMP_CNT(Pshm);
- *PRSATmpCnt = 0;
- if (owner)
- {
- /* initialize values in shared memory */
- NumFileSys = 0;
- for (i = 0; i < qn; i++)
- QShm[i].qs_entries = -1;
- }
- return;
+ /*
+ ** XXX how to check the pid?
+ ** Read it from the pid-file? That does
+ ** not need to exist.
+ ** We could disable shm if we can't confirm
+ ** that it is the right one.
+ */
}
- error:
- if (LogLevel > (owner ? 8 : 11))
+
+ PtrFileSys = (FILESYS *) OFF_FILE_SYS(Pshm);
+ PNumFileSys = (int *) OFF_NUM_FILE_SYS(Pshm);
+ QShm = (QUEUE_SHM_T *) OFF_QUEUE_SHM(Pshm);
+ PRSATmpCnt = (int *) OFF_RSA_TMP_CNT(Pshm);
+ *PRSATmpCnt = 0;
+ if (owner)
{
- sm_syslog(owner ? LOG_ERR : LOG_NOTICE, NOQID,
- "can't %s shared memory, key=%ld: %s",
- owner ? "initialize" : "attach to",
- (long) ShmKey, sm_errstring(save_errno));
+ /* initialize values in shared memory */
+ NumFileSys = 0;
+ for (i = 0; i < qn; i++)
+ QShm[i].qs_entries = -1;
}
+ init_sem(owner);
+ return;
+ }
+ error:
+ if (LogLevel > (owner ? 8 : 11))
+ {
+ sm_syslog(owner ? LOG_ERR : LOG_NOTICE, NOQID,
+ "can't %s shared memory, key=%ld: %s",
+ owner ? "initialize" : "attach to",
+ (long) ShmKey, sm_errstring(save_errno));
}
}
#endif /* SM_CONF_SHM */
@@ -7013,6 +7103,7 @@ cleanup_shm(owner)
Pshm = NULL;
ShmId = SM_SHM_NO_ID;
}
+ stop_sem(owner);
}
#endif /* SM_CONF_SHM */
diff --git a/gnu/usr.sbin/sendmail/sendmail/sendmail.h b/gnu/usr.sbin/sendmail/sendmail/sendmail.h
index 18fa9b200c6..c5776f423a8 100644
--- a/gnu/usr.sbin/sendmail/sendmail/sendmail.h
+++ b/gnu/usr.sbin/sendmail/sendmail/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -52,7 +52,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.990 2004/11/09 19:45:46 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.993 2005/03/07 18:03:17 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -728,6 +728,7 @@ MCI
/* functions */
extern void mci_cache __P((MCI *));
+extern void mci_close __P((MCI *, char *where));
extern void mci_dump __P((SM_FILE_T *, MCI *, bool));
extern void mci_dump_all __P((SM_FILE_T *, bool));
extern void mci_flush __P((bool, MCI *));
@@ -2577,10 +2578,11 @@ extern void unsetenv __P((char *));
/* update file system information: +/- some blocks */
#if SM_CONF_SHM
-extern void upd_qs __P((ENVELOPE *, bool, bool));
-# define updfs(e, delete, avail) upd_qs(e, delete, avail)
+extern void upd_qs __P((ENVELOPE *, bool, bool, char *));
+# define updfs(e, count, space, where) upd_qs(e, count, space, where)
#else /* SM_CONF_SHM */
-# define updfs(e, delete, avail)
+# define updfs(e, count, space, where)
+# define upd_qs(e, count, space, where)
#endif /* SM_CONF_SHM */
extern char *username __P((void));
diff --git a/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c b/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c
index fb37c12eef0..0c9dddde180 100644
--- a/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c
+++ b/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -17,7 +17,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Sendmail: srvrsmtp.c,v 8.902 2004/11/18 21:46:01 ca Exp $")
+SM_RCSID("@(#)$Sendmail: srvrsmtp.c,v 8.906 2005/03/16 00:36:09 ca Exp $")
#include <sys/time.h>
#include <sm/fdset.h>
@@ -80,13 +80,13 @@ static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
char *_auth_id, sasl_ssf_t *_ext_ssf));
# define RESET_SASLCONN \
- result = reset_saslconn(&conn, AuthRealm, remoteip, localip, auth_id, \
- &ext_ssf); \
- if (result != SASL_OK) \
- { \
- /* This is pretty fatal */ \
- goto doquit; \
- }
+ do \
+ { \
+ result = reset_saslconn(&conn, AuthRealm, remoteip, \
+ localip, auth_id, &ext_ssf); \
+ if (result != SASL_OK) \
+ sasl_ok = false; \
+ } while (0)
# else /* SASL >= 20000 */
static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
@@ -94,12 +94,13 @@ static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
struct sockaddr_in *_saddr_l,
sasl_external_properties_t *_ext_ssf));
# define RESET_SASLCONN \
- result = reset_saslconn(&conn, AuthRealm, &saddr_r, &saddr_l, &ext_ssf); \
- if (result != SASL_OK) \
- { \
- /* This is pretty fatal */ \
- goto doquit; \
- }
+ do \
+ { \
+ result = reset_saslconn(&conn, AuthRealm, &saddr_r, \
+ &saddr_l, &ext_ssf); \
+ if (result != SASL_OK) \
+ sasl_ok = false; \
+ } while (0)
# endif /* SASL >= 20000 */
#endif /* SASL */
@@ -664,6 +665,7 @@ smtp(nullserver, d_flags, e)
*/
# if SASL >= 20000
+ localip[0] = remoteip[0] = '\0';
# if NETINET || NETINET6
in = macvalue(macid("{daemon_family}"), e);
if (in != NULL && (
@@ -747,8 +749,6 @@ smtp(nullserver, d_flags, e)
/* XXX should these be options settable via .cf ? */
/* ssp.min_ssf = 0; is default due to memset() */
-# if STARTTLS
-# endif /* STARTTLS */
{
ssp.max_ssf = MaxSLBits;
ssp.maxbufsize = MAXOUTLEN;
@@ -4617,12 +4617,12 @@ help(topic, e)
*/
static int
-reset_saslconn(sasl_conn_t ** conn, char *hostname,
+reset_saslconn(sasl_conn_t **conn, char *hostname,
# if SASL >= 20000
char *remoteip, char *localip,
char *auth_id, sasl_ssf_t * ext_ssf)
# else /* SASL >= 20000 */
- struct sockaddr_in * saddr_r, struct sockaddr_in * saddr_l,
+ struct sockaddr_in *saddr_r, struct sockaddr_in *saddr_l,
sasl_external_properties_t * ext_ssf)
# endif /* SASL >= 20000 */
{
@@ -4645,12 +4645,12 @@ reset_saslconn(sasl_conn_t ** conn, char *hostname,
# if SASL >= 20000
# if NETINET || NETINET6
- if (remoteip != NULL)
+ if (remoteip != NULL && *remoteip != '\0')
result = sasl_setprop(*conn, SASL_IPREMOTEPORT, remoteip);
if (result != SASL_OK)
return result;
- if (localip != NULL)
+ if (localip != NULL && *localip != '\0')
result = sasl_setprop(*conn, SASL_IPLOCALPORT, localip);
if (result != SASL_OK)
return result;
diff --git a/gnu/usr.sbin/sendmail/sendmail/tls.c b/gnu/usr.sbin/sendmail/sendmail/tls.c
index ead9d404ee7..139a56ce47b 100644
--- a/gnu/usr.sbin/sendmail/sendmail/tls.c
+++ b/gnu/usr.sbin/sendmail/sendmail/tls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: tls.c,v 8.96 2004/08/04 21:17:58 ca Exp $")
+SM_RCSID("@(#)$Sendmail: tls.c,v 8.97 2005/03/08 22:20:52 ca Exp $")
#if STARTTLS
# include <openssl/err.h>
@@ -1155,7 +1155,8 @@ tls_get_info(ssl, srv, host, mac, certreq)
NID_commonName, buf, sizeof buf);
macdefine(mac, A_TEMP, macid("{cn_issuer}"),
xtextify(buf, "<>\")"));
- if (X509_digest(cert, EVP_md5(), md, &n))
+ n = 0;
+ if (X509_digest(cert, EVP_md5(), md, &n) != 0 && n > 0)
{
char md5h[EVP_MAX_MD_SIZE * 3];
static const char hexcodes[] = "0123456789ABCDEF";
diff --git a/gnu/usr.sbin/sendmail/sendmail/usersmtp.c b/gnu/usr.sbin/sendmail/sendmail/usersmtp.c
index 264e71e79fb..ad38622aec2 100644
--- a/gnu/usr.sbin/sendmail/sendmail/usersmtp.c
+++ b/gnu/usr.sbin/sendmail/sendmail/usersmtp.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: usersmtp.c,v 8.460 2005/01/11 00:24:19 ca Exp $")
+SM_RCSID("@(#)$Sendmail: usersmtp.c,v 8.463 2005/03/16 00:36:09 ca Exp $")
#include <sysexits.h>
@@ -89,6 +89,7 @@ smtpinit(m, mci, e, onlyhelo)
*/
SmtpError[0] = '\0';
+ SmtpMsgBuffer[0] = '\0';
CurHostName = mci->mci_host; /* XXX UGLY XXX */
if (CurHostName == NULL)
CurHostName = MyHostName;
@@ -1595,8 +1596,6 @@ attemptauth(m, mci, e, sai)
(void) memset(&ssp, '\0', sizeof ssp);
/* XXX should these be options settable via .cf ? */
-# if STARTTLS
-#endif /* STARTTLS */
{
ssp.max_ssf = MaxSLBits;
ssp.maxbufsize = MAXOUTLEN;
@@ -2899,7 +2898,10 @@ smtpquit(m, mci, e)
char *oldcurhost;
if (mci->mci_state == MCIS_CLOSED)
+ {
+ mci_close(mci, "smtpquit:1");
return;
+ }
oldcurhost = CurHostName;
CurHostName = mci->mci_host; /* XXX UGLY XXX */
@@ -3133,7 +3135,7 @@ reply(m, mci, e, timeout, pfunc, enhstat, rtype)
if (strncmp(SmtpMsgBuffer, "QUIT", 4) == 0)
{
errno = mci->mci_errno;
- mci->mci_state = MCIS_CLOSED;
+ mci_close(mci, "reply:1");
return -1;
}
mci->mci_state = MCIS_ERROR;
@@ -3158,7 +3160,7 @@ reply(m, mci, e, timeout, pfunc, enhstat, rtype)
/* errors on QUIT should be ignored */
if (strncmp(SmtpMsgBuffer, "QUIT", 4) == 0)
{
- mci->mci_state = MCIS_CLOSED;
+ mci_close(mci, "reply:2");
return -1;
}
diff --git a/gnu/usr.sbin/sendmail/sendmail/version.c b/gnu/usr.sbin/sendmail/sendmail/version.c
index ece33f92848..14ad53eac40 100644
--- a/gnu/usr.sbin/sendmail/sendmail/version.c
+++ b/gnu/usr.sbin/sendmail/sendmail/version.c
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: version.c,v 8.140 2005/01/12 04:32:32 ca Exp $")
+SM_RCSID("@(#)$Sendmail: version.c,v 8.145 2005/03/25 18:44:44 ca Exp $")
-char Version[] = "8.13.3";
+char Version[] = "8.13.4";