From 6792a0541d8ae3784572478b89043dd72c01867f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 19 Jan 2004 01:41:15 +0000 Subject: Update to sendmail 8.12.11. I've been runninga beta version of this for some time without problems. See the RELEASE_NOTES for the change log. --- gnu/usr.sbin/sendmail/RELEASE_NOTES | 66 ++++++++++- gnu/usr.sbin/sendmail/cf/README | 18 +-- gnu/usr.sbin/sendmail/cf/m4/cfhead.m4 | 2 +- gnu/usr.sbin/sendmail/cf/m4/proto.m4 | 8 +- gnu/usr.sbin/sendmail/cf/m4/version.m4 | 6 +- gnu/usr.sbin/sendmail/doc/op/op.me | 15 +-- gnu/usr.sbin/sendmail/include/libmilter/mfapi.h | 4 +- gnu/usr.sbin/sendmail/include/libmilter/milter.h | 8 +- gnu/usr.sbin/sendmail/include/sm/cdefs.h | 5 +- gnu/usr.sbin/sendmail/include/sm/conf.h | 11 +- .../sendmail/libmilter/docs/smfi_addrcpt.html | 2 +- .../sendmail/libmilter/docs/smfi_delrcpt.html | 2 +- .../sendmail/libmilter/docs/smfi_setreply.html | 6 + .../sendmail/libmilter/docs/xxfi_connect.html | 24 +++- .../sendmail/libmilter/docs/xxfi_envrcpt.html | 4 +- gnu/usr.sbin/sendmail/libmilter/engine.c | 61 ++++++++--- gnu/usr.sbin/sendmail/libmilter/libmilter.h | 4 +- gnu/usr.sbin/sendmail/libmilter/listener.c | 68 ++++++++++-- gnu/usr.sbin/sendmail/libmilter/main.c | 13 ++- gnu/usr.sbin/sendmail/libmilter/signal.c | 4 +- gnu/usr.sbin/sendmail/libsm/assert.c | 6 +- gnu/usr.sbin/sendmail/libsm/exc.c | 6 +- gnu/usr.sbin/sendmail/libsm/ldap.c | 10 +- gnu/usr.sbin/sendmail/libsm/local.h | 4 +- gnu/usr.sbin/sendmail/sendmail/README | 9 +- gnu/usr.sbin/sendmail/sendmail/alias.c | 4 +- gnu/usr.sbin/sendmail/sendmail/conf.c | 13 ++- gnu/usr.sbin/sendmail/sendmail/daemon.c | 18 ++- gnu/usr.sbin/sendmail/sendmail/deliver.c | 7 +- gnu/usr.sbin/sendmail/sendmail/headers.c | 14 ++- gnu/usr.sbin/sendmail/sendmail/main.c | 49 ++++++++- gnu/usr.sbin/sendmail/sendmail/milter.c | 21 +++- gnu/usr.sbin/sendmail/sendmail/mime.c | 74 ++++++------- gnu/usr.sbin/sendmail/sendmail/queue.c | 121 ++++++++++++++++----- gnu/usr.sbin/sendmail/sendmail/readcf.c | 8 +- gnu/usr.sbin/sendmail/sendmail/recipient.c | 7 +- gnu/usr.sbin/sendmail/sendmail/sendmail.8 | 37 +++++-- gnu/usr.sbin/sendmail/sendmail/sendmail.h | 3 +- gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c | 51 ++++----- gnu/usr.sbin/sendmail/sendmail/tls.c | 36 +++--- gnu/usr.sbin/sendmail/sendmail/util.c | 7 +- gnu/usr.sbin/sendmail/sendmail/version.c | 6 +- gnu/usr.sbin/sendmail/smrsh/smrsh.8 | 4 +- gnu/usr.sbin/sendmail/smrsh/smrsh.c | 10 +- 44 files changed, 619 insertions(+), 237 deletions(-) diff --git a/gnu/usr.sbin/sendmail/RELEASE_NOTES b/gnu/usr.sbin/sendmail/RELEASE_NOTES index 8dca46e9a49..b9e49bfc855 100644 --- a/gnu/usr.sbin/sendmail/RELEASE_NOTES +++ b/gnu/usr.sbin/sendmail/RELEASE_NOTES @@ -1,12 +1,74 @@ SENDMAIL RELEASE NOTES - $Sendmail: RELEASE_NOTES,v 8.1340.2.165 2003/09/16 20:50:42 ca Exp $ + $Sendmail: RELEASE_NOTES,v 8.1340.2.189 2004/01/18 17:50:57 ca 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.12.10/8.12.10 2003/09/24 +8.12.11/8.12.11 2004/01/18 + Use QueueFileMode when opening qf files. This error was a + regression in 8.12.10. Problem detected and diagnosed + Lech Szychowski of the Polish Power Grid Company. + Properly count the number of queue runners in a work group and + make sure the total limit of MaxQueueChildren is not + exceeded. Based on patch from Takayuki Yoshizawa of + Techfirm, Inc. + Take care of systems that can generate time values where the + seconds can exceed the usual range of 0 to 59. + Problem noted by Randy Diffenderfer of EDS. + Avoid regeneration of identical queue identifiers by processes + whose process id is the same as that of the initial + sendmail process that was used to start the daemon. + Problem noted by Randy Diffenderfer of EDS. + When a milter invokes smfi_delrcpt() compare the supplied + recipient address also against the printable addresses + of the current list to deal with rewritten addresses. + Based on patch from Sean Hanson of The Asylum. + BadRcptThrottle now also works for addresses which return the + error mailer, e.g., virtusertable entries with the + right hand side error:. Patch from Per Hedeland. + Fix printing of 8 bit characters as octals in log messages. + Based on patch by Andrey J. Melnikoff. + Undo change of algorithm for MIME 7-bit base64 encoding to 8-bit + text that has been introduced in 8.12.3. There are some + examples where the new code fails, but the old code works. + To get the 8.12.3-8.12.10 version, compile sendmail with + -DMIME7TO8_OLD=0. If you have an example of improper + 7 to 8 bit conversion please send it to us. + Return normal error code for unknown SMTP commands instead of + the one specified by check_relay or a milter for a + connection. Problem noted by Andrzej Filip. + Some ident responses contain data after the terminating CRLF which + causes sendmail to log "POSSIBLE ATTACK...newline in string". + To avoid this everything after LF is ignored. + If the operating system supports O_EXLOCK and HASFLOCK is set + then a possible race condition for creating qf files + can be avoided. Note: the race condition does not + exist within sendmail, but between sendmail and an + external application that accesses qf files. + Log the proper options name for TLS related mising files for + the CACertPath, CACertFile, and DHParameters options. + Do not split an envelope if it will be discarded, otherwise df + files could be left behind. Problem found by Wolfgang + Breyha. + The use of the environment variables HOME and HOSTALIASES has been + deprecated and will be removed in version 8.13. This only + effects configuration which preserve those variable via the + 'E' command in the cf file as sendmail clears out its entire + environment. + Portability: + Add support for Darwin 7.0/Mac OS X 10.3 (a.k.a. Panther). + Solaris 10 has unsetenv(), patch from Craig Mohrman of + Sun Microsystems. + LIBMILTER: Add extra checks in case a broken MTA sends bogus data + to libmilter. Based on code review by Rob Grzywinski. + SMRSH: Properly assemble commands that contain '&&' or '||'. + Problem noted by Eric Lee of Talking Heads. + New Files: + devtools/OS/Darwin.7.0 + +8.12.10/8.12.10 2003/09/24 (Released: 2003/09/17) SECURITY: Fix a buffer overflow in address parsing. Problem detected by Michal Zalewski, patch from Todd C. Miller of Courtesan Consulting. diff --git a/gnu/usr.sbin/sendmail/cf/README b/gnu/usr.sbin/sendmail/cf/README index 6d212e9f0cb..6b1088cca44 100644 --- a/gnu/usr.sbin/sendmail/cf/README +++ b/gnu/usr.sbin/sendmail/cf/README @@ -2591,9 +2591,9 @@ my.domain and you have my.domain RELAY -in the access map, then all e-mail with a sender address of - gets through, even if check_relay would reject it -(e.g., based on the hostname or IP address). This allows spammers +in the access map, then any e-mail with a sender address of + will not be rejected by check_relay even though +it would match the hostname or IP address. This allows spammers to get around DNS based blacklist by faking the sender address. To avoid this problem you have to use tagged entries: @@ -3858,11 +3858,11 @@ confMAX_RCPTS_PER_MESSAGE MaxRecipientsPerMessage receive a 452 error code (i.e., they are deferred for the next delivery attempt). -confBAD_RCPT_THROTTLE BadRcptThrottle [infinite] If set and more than the - specified number of recipients in an - envelope are rejected, sleep for one - second after each rejected RCPT - command. +confBAD_RCPT_THROTTLE BadRcptThrottle [infinite] If set and the specified + number of recipients in a single SMTP + transaction have been rejected, sleep + for one second after each subsequent + RCPT command in that transaction. confDONT_PROBE_INTERFACES DontProbeInterfaces [False] If set, sendmail will _not_ insert the names and addresses of any @@ -4375,4 +4375,4 @@ M4 DIVERSIONS 8 DNS based blacklists 9 special local rulesets (1 and 2) -$Revision: 1.19 $, Last updated $Date: 2003/09/17 17:31:39 $ +$Revision: 1.20 $, Last updated $Date: 2004/01/19 01:41:12 $ diff --git a/gnu/usr.sbin/sendmail/cf/m4/cfhead.m4 b/gnu/usr.sbin/sendmail/cf/m4/cfhead.m4 index 3fe593b6ec5..aa1ffb56bfd 100644 --- a/gnu/usr.sbin/sendmail/cf/m4/cfhead.m4 +++ b/gnu/usr.sbin/sendmail/cf/m4/cfhead.m4 @@ -305,4 +305,4 @@ define(`confMILTER_MACROS_ENVRCPT', ``{rcpt_mailer}, {rcpt_host}, {rcpt_addr}'') divert(0)dnl -VERSIONID(`$Sendmail: cfhead.m4,v 8.108.2.3 2003/04/03 17:51:51 ca Exp $') +VERSIONID(`$Sendmail: cfhead.m4,v 8.108.2.6 2003/12/05 02:26:47 ca Exp $') diff --git a/gnu/usr.sbin/sendmail/cf/m4/proto.m4 b/gnu/usr.sbin/sendmail/cf/m4/proto.m4 index cc6426811d1..bcde48b249f 100644 --- a/gnu/usr.sbin/sendmail/cf/m4/proto.m4 +++ b/gnu/usr.sbin/sendmail/cf/m4/proto.m4 @@ -1,6 +1,6 @@ divert(-1) # -# Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers. +# Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers. # All rights reserved. # Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved. # Copyright (c) 1988, 1993 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Sendmail: proto.m4,v 8.649.2.24 2003/08/04 21:14:26 ca Exp $') +VERSIONID(`$Sendmail: proto.m4,v 8.649.2.30 2004/01/11 17:54:06 ca Exp $') # level CF_LEVEL config file format V`'CF_LEVEL/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley') @@ -111,6 +111,7 @@ Fw`'confCW_FILE', # ... `define' this only if sendmail cannot automatically determine your domain ifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM') +# host/domain names ending with a token in class P are canonical CP. ifdef(`UUCP_RELAY', @@ -633,7 +634,8 @@ _OPTION(Milter.LogLevel, `confMILTER_LOG_LEVEL', `') _OPTION(Milter.macros.connect, `confMILTER_MACROS_CONNECT', `') _OPTION(Milter.macros.helo, `confMILTER_MACROS_HELO', `') _OPTION(Milter.macros.envfrom, `confMILTER_MACROS_ENVFROM', `') -_OPTION(Milter.macros.envrcpt, `confMILTER_MACROS_ENVRCPT', `')') +_OPTION(Milter.macros.envrcpt, `confMILTER_MACROS_ENVRCPT', `') +') # CA directory _OPTION(CACertPath, `confCACERT_PATH', `') diff --git a/gnu/usr.sbin/sendmail/cf/m4/version.m4 b/gnu/usr.sbin/sendmail/cf/m4/version.m4 index d5fa52ff023..64f36345b02 100644 --- a/gnu/usr.sbin/sendmail/cf/m4/version.m4 +++ b/gnu/usr.sbin/sendmail/cf/m4/version.m4 @@ -1,6 +1,6 @@ divert(-1) # -# Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers. +# Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers. # All rights reserved. # Copyright (c) 1983 Eric P. Allman. All rights reserved. # Copyright (c) 1988, 1993 @@ -11,8 +11,8 @@ divert(-1) # the sendmail distribution. # # -VERSIONID(`$Sendmail: version.m4,v 8.92.2.22 2003/09/16 20:02:05 ca Exp $') +VERSIONID(`$Sendmail: version.m4,v 8.92.2.26 2004/01/13 00:29:26 ca Exp $') # divert(0) # Configuration version number -DZ8.12.10`'ifdef(`confCF_VERSION', `/confCF_VERSION') +DZ8.12.11`'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 83f01456e52..68682aae7c8 100644 --- a/gnu/usr.sbin/sendmail/doc/op/op.me +++ b/gnu/usr.sbin/sendmail/doc/op/op.me @@ -9,7 +9,7 @@ .\" the sendmail distribution. .\" .\" -.\" $Sendmail: op.me,v 8.609.2.26 2003/07/28 21:54:53 ca Exp $ +.\" $Sendmail: op.me,v 8.609.2.29 2004/01/11 17:58:24 ca Exp $ .\" .\" eqn op.me | pic | troff -me .\" @@ -90,7 +90,7 @@ Sendmail, Inc. .de Ve Version \\$2 .. -.Ve $Revision: 1.20 $ +.Ve $Revision: 1.21 $ .rm Ve .sp For Sendmail Version 8.12 @@ -1125,7 +1125,7 @@ that some sites might want. A complete description of the log levels is given in section .\" XREF -4.6. +4.7. .sh 2 "Dumping State" .pp You can ask @@ -3025,7 +3025,7 @@ alias files, :include: files, and external databases) must be readable by that user. -Also, since sendmail will not be able to change it's uid, +Also, since sendmail will not be able to change its uid, delivery to programs or files will be marked as unsafe, e.g., undeliverable, in @@ -6227,8 +6227,9 @@ selected SASL mechanisms. Explanations of these properties can be found in the Cyrus SASL documentation. .ip BadRcptThrottle=\fIN\fP [no short name] -If set and more than the specified number of recipients in a single SMTP -envelope are rejected, sleep for one second after each rejected RCPT command. +If set and the specified number of recipients in a single SMTP +transaction have been rejected, sleep for one second after each subsequent +RCPT command in that transaction. .ip BlankSub=\fIc\fP [B] Set the blank substitution character to @@ -10767,7 +10768,7 @@ replace it with a blank sheet for double-sided output. .\".sz 10 .\"Eric Allman .\".sp -.\"Version $Revision: 1.20 $ +.\"Version $Revision: 1.21 $ .\".ce 0 .bp 3 .ce diff --git a/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h b/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h index e433477f0d9..a385012566e 100644 --- a/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h +++ b/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h @@ -7,7 +7,7 @@ * the sendmail distribution. * * - * $Sendmail: mfapi.h,v 8.44.2.3 2002/12/19 02:10:09 ca Exp $ + * $Sendmail: mfapi.h,v 8.44.2.4 2003/10/20 21:51:49 msk Exp $ */ /* @@ -108,7 +108,7 @@ struct smfiDesc }; #if _FFR_SMFI_OPENSOCKET -LIBMILTER_API int smfi_opensocket __P((void)); +LIBMILTER_API int smfi_opensocket __P((bool)); #endif /* _FFR_SMFI_OPENSOCKET */ LIBMILTER_API int smfi_register __P((struct smfiDesc)); LIBMILTER_API int smfi_main __P((void)); diff --git a/gnu/usr.sbin/sendmail/include/libmilter/milter.h b/gnu/usr.sbin/sendmail/include/libmilter/milter.h index 2c871d445df..832096de886 100644 --- a/gnu/usr.sbin/sendmail/include/libmilter/milter.h +++ b/gnu/usr.sbin/sendmail/include/libmilter/milter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2003 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. * * - * $Sendmail: milter.h,v 8.37.2.1 2002/12/19 02:10:09 ca Exp $ + * $Sendmail: milter.h,v 8.37.2.3 2003/12/02 00:19:51 msk Exp $ */ /* @@ -25,7 +25,11 @@ typedef pthread_t sthread_t; typedef int socket_t; +#if _FFR_MILTER_MACROS_EOM +# define MAX_MACROS_ENTRIES 5 /* max size of macro pointer array */ +#else /* _FFR_MILTER_MACROS_EOM */ # define MAX_MACROS_ENTRIES 4 /* max size of macro pointer array */ +#endif /* _FFR_MILTER_MACROS_EOM */ /* ** context for milter diff --git a/gnu/usr.sbin/sendmail/include/sm/cdefs.h b/gnu/usr.sbin/sendmail/include/sm/cdefs.h index d4dce9ba8ea..76a95e84670 100644 --- a/gnu/usr.sbin/sendmail/include/sm/cdefs.h +++ b/gnu/usr.sbin/sendmail/include/sm/cdefs.h @@ -6,7 +6,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Sendmail: cdefs.h,v 1.15 2002/01/16 18:30:11 ca Exp $ + * $Sendmail: cdefs.h,v 1.15.2.1 2003/12/05 22:44:17 ca Exp $ */ /* @@ -67,11 +67,14 @@ # if __GNUC__ >= 2 # if __GNUC__ == 2 && __GNUC_MINOR__ < 5 # define SM_DEAD(proto) volatile proto +# define SM_DEAD_D volatile # else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ # define SM_DEAD(proto) proto __attribute__((__noreturn__)) +# define SM_DEAD_D # endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ # else /* __GNUC__ >= 2 */ # define SM_DEAD(proto) proto +# define SM_DEAD_D # endif /* __GNUC__ >= 2 */ # endif /* SM_DEAD */ diff --git a/gnu/usr.sbin/sendmail/include/sm/conf.h b/gnu/usr.sbin/sendmail/include/sm/conf.h index a2f790a324f..15158df10b6 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-2003 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2004 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.90.2.18 2003/08/20 22:27:44 ca Exp $ + * $Sendmail: conf.h,v 1.90.2.20 2004/01/07 00:52:16 ca Exp $ */ /* @@ -437,6 +437,9 @@ typedef int pid_t; # if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) # define HASURANDOMDEV 1 /* /dev/[u]random added in S9 */ # endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */ +# if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) +# define HASUNSETENV 1 /* unsetenv() added in S10 */ +# endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */ # ifndef HASGETUSERSHELL # define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps pre-2.7 */ # endif /* ! HASGETUSERSHELL */ @@ -2254,8 +2257,8 @@ typedef struct msgb mblk_t; # undef HAVE_SYS_ERRLIST # define sys_errlist __sys_errlist # define sys_nerr __sys_nerr -# define major(dev) ((int)(((dev) >> 8) & 0xff) -# define minor(dev) ((int)((dev) & 0xff) +# define major(dev) ((int)(((dev) >> 8) & 0xff)) +# define minor(dev) ((int)((dev) & 0xff)) # endif /* defined(__INTERIX) */ diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addrcpt.html b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addrcpt.html index 3b2eb56ccba..16f86c94977 100644 --- a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addrcpt.html +++ b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addrcpt.html @@ -48,7 +48,7 @@ Add a recipient for the current message. smfi_addrcpt will fail and return MI_FAILURE if:
  • rcpt is NULL. -
  • Adding headers in the current connection state is invalid. +
  • Adding recipients in the current connection state is invalid.
  • A network error occurs.
  • SMFIF_ADDRCPT was not set when smfi_register was called.
diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_delrcpt.html b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_delrcpt.html index 451f36a6a94..9608e61eaef 100644 --- a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_delrcpt.html +++ b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_delrcpt.html @@ -49,7 +49,7 @@ Remove a recipient from the current message's envelope. smfi_delrcpt will fail and return MI_FAILURE if:
  • rcpt is NULL. -
  • Adding headers in the current connection state is invalid. +
  • Deleting recipients in the current connection state is invalid.
  • A network error occurs.
  • SMFIF_DELRCPT was not set when smfi_register was called.
diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_setreply.html b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_setreply.html index 646a8f14c60..d5b0e245330 100644 --- a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_setreply.html +++ b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_setreply.html @@ -75,6 +75,12 @@ Otherwise, it return MI_SUCCESS.
  • Values passed to smfi_setreply are not checked for standards compliance. +
  • The message parameter should contain only printable characters, +other characters may lead to undefined behavior. +For example, CR or LF will cause the call to fail, +single '%' characters will cause the text to be ignored +(if there really should be a '%' in the string, +use '%%' just like for printf(3)).
  • For details about reply codes and their meanings, please see RFC's 821/ 2821 diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_connect.html b/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_connect.html index af58bf9cba8..85d02e41266 100644 --- a/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_connect.html +++ b/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_connect.html @@ -62,11 +62,29 @@ is passed to smfi_register(). - - + + + + + + + + + + + + + + + + +
    Return valueDescription
    SMFIS_DISCARDNot meaningful, as - this is only meaningful from message-oriented routines. + SMFIS_ACCEPTAccept all commands and messages from this client without any + further contact with the filter.
    SMFIS_CONTINUEContinue normal processing.
    SMFIS_DISCARDUndefined behaviour; do not use.
    SMFIS_TEMPFAILReject all commands and messages from this client with a + temporary failure reply code.
    SMFIS_REJECTReject all commands and messages from this client with a + permanent failure reply code.
    --> diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_envrcpt.html b/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_envrcpt.html index 9d32e90962c..a96ac95f2e1 100644 --- a/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_envrcpt.html +++ b/gnu/usr.sbin/sendmail/libmilter/docs/xxfi_envrcpt.html @@ -52,12 +52,12 @@ Handle the envelope RCPT command. SMFIS_TEMPFAIL Temporarily fail for this particular recipient; further recipients - maystill be sent. xxfi_abort is not called. + may still be sent. xxfi_abort is not called. SMFIS_REJECT - Reject this particular recipient; further recipients maystill be sent. + Reject this particular recipient; further recipients may still be sent. xxfi_abort is not called. diff --git a/gnu/usr.sbin/sendmail/libmilter/engine.c b/gnu/usr.sbin/sendmail/libmilter/engine.c index dd1888908f6..ac834d242b1 100644 --- a/gnu/usr.sbin/sendmail/libmilter/engine.c +++ b/gnu/usr.sbin/sendmail/libmilter/engine.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Sendmail: engine.c,v 8.109.2.5 2003/08/04 18:14:33 ca Exp $") +SM_RCSID("@(#)$Sendmail: engine.c,v 8.109.2.8 2003/12/01 23:57:45 msk Exp $") #include "libmilter.h" @@ -59,14 +59,21 @@ typedef struct cmdfct_t cmdfct; #define CT_END 0x0008 /* start replying */ /* index in macro array: macros only for these commands */ -#define CI_NONE (-1) -#define CI_CONN 0 -#define CI_HELO 1 -#define CI_MAIL 2 -#define CI_RCPT 3 -#if CI_RCPT >= MAX_MACROS_ENTRIES +#define CI_NONE (-1) +#define CI_CONN 0 +#define CI_HELO 1 +#define CI_MAIL 2 +#define CI_RCPT 3 +#if _FFR_MILTER_MACROS_EOM +# define CI_EOM 4 +# if CI_EOM >= MAX_MACROS_ENTRIES +ERROR: do not compile with CI_EOM >= MAX_MACROS_ENTRIES +# endif +#else /* _FFR_MILTER_MACROS_EOM */ +# if CI_RCPT >= MAX_MACROS_ENTRIES ERROR: do not compile with CI_RCPT >= MAX_MACROS_ENTRIES -#endif +# endif +#endif /* _FFR_MILTER_MACROS_EOM */ /* function prototypes */ static int st_abortfct __P((genarg *)); @@ -156,7 +163,11 @@ static cmdfct cmds[] = {SMFIC_MACRO, CM_ARGV, ST_NONE, CT_KEEP, CI_NONE, st_macros }, {SMFIC_BODY, CM_ARG1, ST_BODY, CT_CONT, CI_NONE, st_bodychunk }, {SMFIC_CONNECT, CM_ARG2, ST_CONN, CT_CONT, CI_CONN, st_connectinfo }, +#if _FFR_MILTER_MACROS_EOM +{SMFIC_BODYEOB, CM_ARG1, ST_ENDM, CT_CONT, CI_EOM, st_bodyend }, +#else /* _FFR_MILTER_MACROS_EOM */ {SMFIC_BODYEOB, CM_ARG1, ST_ENDM, CT_CONT, CI_NONE, st_bodyend }, +#endif /* _FFR_MILTER_MACROS_EOM */ {SMFIC_HELO, CM_ARG1, ST_HELO, CT_CONT, CI_HELO, st_helo }, {SMFIC_HEADER, CM_ARG2, ST_HDRS, CT_CONT, CI_NONE, st_header }, {SMFIC_MAIL, CM_ARGV, ST_MAIL, CT_CONT, CI_MAIL, st_sender }, @@ -599,7 +610,7 @@ st_connectinfo(g) l = g->a_len; while (s[i] != '\0' && i <= l) ++i; - if (i >= l) + if (i + 1 >= l) return _SMFIS_ABORT; /* Move past trailing \0 in host string */ @@ -608,9 +619,7 @@ st_connectinfo(g) (void) memset(&sockaddr, '\0', sizeof sockaddr); if (family != SMFIA_UNKNOWN) { - (void) memcpy((void *) &port, (void *) (s + i), - sizeof port); - if ((i += sizeof port) >= l) + if (i + sizeof port >= l) { smi_log(SMI_LOG_ERR, "%s: connect[%d]: wrong len %d >= %d", @@ -618,6 +627,9 @@ st_connectinfo(g) (int) g->a_ctx->ctx_id, (int) i, (int) l); return _SMFIS_ABORT; } + (void) memcpy((void *) &port, (void *) (s + i), + sizeof port); + i += sizeof port; /* make sure string is terminated */ if (s[l - 1] != '\0') @@ -729,7 +741,12 @@ st_helo(g) mi_clr_macros(g->a_ctx, g->a_idx + 1); if (g->a_ctx->ctx_smfi != NULL && (fi_helo = g->a_ctx->ctx_smfi->xxfi_helo) != NULL) + { + /* paranoia: check for terminating '\0' */ + if (g->a_len == 0 || g->a_buf[g->a_len - 1] != '\0') + return MI_FAILURE; return (*fi_helo)(g->a_ctx, g->a_buf); + } return SMFIS_CONTINUE; } /* @@ -847,6 +864,11 @@ st_macros(g) case SMFIC_RCPT: i = CI_RCPT; break; +#if _FFR_MILTER_MACROS_EOM + case SMFIC_BODYEOB: + i = CI_EOM; + break; +#endif /* _FFR_MILTER_MACROS_EOM */ default: free(argv); return _SMFIS_FAIL; @@ -1089,10 +1111,16 @@ dec_argv(buf, len) for (i = 0, elem = 0; i < len && elem < nelem; i++) { if (buf[i] == '\0') - s[++elem] = &(buf[i + 1]); + { + ++elem; + if (i + 1 >= len) + s[elem] = NULL; + else + s[elem] = &(buf[i + 1]); + } } - /* overwrite last entry */ + /* overwrite last entry (already done above, just paranoia) */ s[elem] = NULL; return s; } @@ -1117,6 +1145,9 @@ dec_arg2(buf, len, s1, s2) { size_t i; + /* paranoia: check for terminating '\0' */ + if (len == 0 || buf[len - 1] != '\0') + return MI_FAILURE; *s1 = buf; for (i = 1; i < len && buf[i] != '\0'; i++) continue; diff --git a/gnu/usr.sbin/sendmail/libmilter/libmilter.h b/gnu/usr.sbin/sendmail/libmilter/libmilter.h index 36a539bef99..eee411d8e8d 100644 --- a/gnu/usr.sbin/sendmail/libmilter/libmilter.h +++ b/gnu/usr.sbin/sendmail/libmilter/libmilter.h @@ -19,7 +19,7 @@ #ifdef _DEFINE # define EXTERN # define INIT(x) = x -SM_IDSTR(MilterlId, "@(#)$Sendmail: libmilter.h,v 8.33.2.12 2003/09/08 21:39:55 yuri Exp $") +SM_IDSTR(MilterlId, "@(#)$Sendmail: libmilter.h,v 8.33.2.13 2003/10/20 21:51:50 msk Exp $") #else /* _DEFINE */ # define EXTERN extern # define INIT(x) @@ -176,7 +176,7 @@ extern void mi_clean_signals __P((void)); extern struct hostent *mi_gethostbyname __P((char *, int)); extern int mi_inet_pton __P((int, const char *, void *)); extern void mi_closener __P((void)); -extern int mi_opensocket __P((char *, int, int, smfiDesc_ptr)); +extern int mi_opensocket __P((char *, int, int, bool, smfiDesc_ptr)); /* communication functions */ extern char *mi_rd_cmd __P((socket_t, struct timeval *, char *, size_t *, char *)); diff --git a/gnu/usr.sbin/sendmail/libmilter/listener.c b/gnu/usr.sbin/sendmail/libmilter/listener.c index 10e99dfc9b9..95c5485e847 100644 --- a/gnu/usr.sbin/sendmail/libmilter/listener.c +++ b/gnu/usr.sbin/sendmail/libmilter/listener.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Sendmail: listener.c,v 8.85.2.12 2003/08/04 18:47:29 ca Exp $") +SM_RCSID("@(#)$Sendmail: listener.c,v 8.85.2.17 2003/10/21 17:22:57 ca Exp $") /* ** listener.c -- threaded network listener @@ -18,6 +18,9 @@ SM_RCSID("@(#)$Sendmail: listener.c,v 8.85.2.12 2003/08/04 18:47:29 ca Exp $") #include "libmilter.h" #include +#include +#include + # if NETINET || NETINET6 # include @@ -28,26 +31,29 @@ static int L_family; static SOCKADDR_LEN_T L_socksize; static socket_t listenfd = INVALID_SOCKET; -static socket_t mi_milteropen __P((char *, int, char *)); +static socket_t mi_milteropen __P((char *, int, bool, char *)); /* ** MI_OPENSOCKET -- create the socket where this filter and the MTA will meet ** -** Parameters: +** Parameters: ** conn -- connection description ** backlog -- listen backlog -** dbg -- debug level +** dbg -- debug level +** rmsocket -- if true, try to unlink() the socket first +** (UNIX domain sockets only) ** smfi -- filter structure to use ** -** Return value: -** MI_SUCCESS/MI_FAILURE +** Return value: +** MI_SUCCESS/MI_FAILURE */ int -mi_opensocket(conn, backlog, dbg, smfi) +mi_opensocket(conn, backlog, dbg, rmsocket, smfi) char *conn; int backlog; int dbg; + bool rmsocket; smfiDesc_ptr smfi; { if (smfi == NULL || conn == NULL) @@ -64,7 +70,7 @@ mi_opensocket(conn, backlog, dbg, smfi) } (void) smutex_init(&L_Mutex); (void) smutex_lock(&L_Mutex); - listenfd = mi_milteropen(conn, backlog, smfi->xxfi_name); + listenfd = mi_milteropen(conn, backlog, rmsocket, smfi->xxfi_name); if (!ValidSocket(listenfd)) { smi_log(SMI_LOG_FATAL, @@ -91,6 +97,8 @@ mi_opensocket(conn, backlog, dbg, smfi) ** Parameters: ** conn -- connection description ** backlog -- listen backlog +** rmsocket -- if true, try to unlink() the socket first +** (UNIX domain sockets only) ** name -- name for logging ** ** Returns: @@ -105,9 +113,10 @@ static char *sockpath = NULL; #endif /* NETUNIX */ static socket_t -mi_milteropen(conn, backlog, name) +mi_milteropen(conn, backlog, rmsocket, name) char *conn; int backlog; + bool rmsocket; char *name; { socket_t sock; @@ -457,6 +466,41 @@ mi_milteropen(conn, backlog, name) return INVALID_SOCKET; } +#if NETUNIX + if (addr.sa.sa_family == AF_UNIX && rmsocket) + { + struct stat s; + + if (stat(colon, &s) != 0) + { + if (errno != ENOENT) + { + smi_log(SMI_LOG_ERR, + "%s: Unable to stat() %s: %s", + name, colon, sm_errstring(errno)); + (void) closesocket(sock); + return INVALID_SOCKET; + } + } + else if (!S_ISSOCK(s.st_mode)) + { + smi_log(SMI_LOG_ERR, + "%s: %s is not a UNIX domain socket", + name, colon); + (void) closesocket(sock); + return INVALID_SOCKET; + } + else if (unlink(colon) != 0) + { + smi_log(SMI_LOG_ERR, + "%s: Unable to remove %s: %s", + name, colon, sm_errstring(errno)); + (void) closesocket(sock); + return INVALID_SOCKET; + } + } +#endif /* NETUNIX */ + if (bind(sock, &addr.sa, L_socksize) < 0) { smi_log(SMI_LOG_ERR, @@ -591,9 +635,11 @@ mi_closener() ** Parameters: ** conn -- connection description ** dbg -- debug level +** rmsocket -- if true, try to unlink() the socket first +** (UNIX domain sockets only) ** smfi -- filter structure to use ** timeout -- timeout for reads/writes -** backlog -- listen queue backlog size +** backlog -- listen queue backlog size ** ** Returns: ** MI_SUCCESS -- Exited normally @@ -673,7 +719,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog) FD_RD_VAR(rds, excs); struct timeval chktime; - if (mi_opensocket(conn, backlog, dbg, smfi) == MI_FAILURE) + if (mi_opensocket(conn, backlog, dbg, false, smfi) == MI_FAILURE) return MI_FAILURE; clilen = L_socksize; diff --git a/gnu/usr.sbin/sendmail/libmilter/main.c b/gnu/usr.sbin/sendmail/libmilter/main.c index 08930ef888a..d200712a5fd 100644 --- a/gnu/usr.sbin/sendmail/libmilter/main.c +++ b/gnu/usr.sbin/sendmail/libmilter/main.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Sendmail: main.c,v 8.64.2.10 2003/01/23 22:34:24 ca Exp $") +SM_RCSID("@(#)$Sendmail: main.c,v 8.64.2.13 2003/10/20 22:27:13 ca Exp $") #define _DEFINE 1 #include "libmilter.h" @@ -86,7 +86,7 @@ smfi_stop() } /* -** default values for some variables. +** Default values for some variables. ** Most of these can be changed with the functions below. */ @@ -101,19 +101,22 @@ static int backlog = MI_SOMAXCONN; ** able to start up ** ** Parameters: -** None. +** rmsocket -- if true, instructs libmilter to attempt +** to remove the socket before creating it; +** only applies for "local:" or "unix:" sockets ** ** Return: ** MI_SUCCESS/MI_FAILURE */ int -smfi_opensocket() +smfi_opensocket(rmsocket) + bool rmsocket; { if (smfi == NULL || conn == NULL) return MI_FAILURE; - return mi_opensocket(conn, backlog, dbg, smfi); + return mi_opensocket(conn, backlog, dbg, rmsocket, smfi); } #endif /* _FFR_SMFI_OPENSOCKET */ diff --git a/gnu/usr.sbin/sendmail/libmilter/signal.c b/gnu/usr.sbin/sendmail/libmilter/signal.c index 8b9578b5c42..3275b8efa0c 100644 --- a/gnu/usr.sbin/sendmail/libmilter/signal.c +++ b/gnu/usr.sbin/sendmail/libmilter/signal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Sendmail: signal.c,v 8.37.2.3 2003/08/04 18:14:33 ca Exp $") +SM_RCSID("@(#)$Sendmail: signal.c,v 8.37.2.4 2003/11/19 00:22:40 ca Exp $") #include "libmilter.h" diff --git a/gnu/usr.sbin/sendmail/libsm/assert.c b/gnu/usr.sbin/sendmail/libsm/assert.c index 56438866e9f..7454a9cd540 100644 --- a/gnu/usr.sbin/sendmail/libsm/assert.c +++ b/gnu/usr.sbin/sendmail/libsm/assert.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Sendmail: assert.c,v 1.25 2001/09/11 04:04:47 gshapiro Exp $") +SM_RCSID("@(#)$Sendmail: assert.c,v 1.25.2.1 2003/12/05 22:44:17 ca Exp $") /* ** Abnormal program termination and assertion checking. @@ -127,7 +127,7 @@ sm_abort_sethandler(f) ** doesn't. */ -void +void SM_DEAD_D #if SM_VA_STD sm_abort(char *fmt, ...) #else /* SM_VA_STD */ @@ -163,7 +163,7 @@ sm_abort(fmt, va_alist) ** doesn't. */ -void +void SM_DEAD_D sm_abort_at(filename, lineno, msg) const char *filename; int lineno; diff --git a/gnu/usr.sbin/sendmail/libsm/exc.c b/gnu/usr.sbin/sendmail/libsm/exc.c index c347b1b3d55..1a8e21532e9 100644 --- a/gnu/usr.sbin/sendmail/libsm/exc.c +++ b/gnu/usr.sbin/sendmail/libsm/exc.c @@ -9,7 +9,7 @@ */ #include -SM_RCSID("@(#)$Sendmail: exc.c,v 1.47 2002/01/09 18:51:43 ca Exp $") +SM_RCSID("@(#)$Sendmail: exc.c,v 1.47.2.1 2003/12/05 22:44:17 ca Exp $") /* ** exception handling @@ -587,7 +587,7 @@ sm_exc_newthread(h) ** doesn't. */ -void +void SM_DEAD_D sm_exc_raise_x(exc) SM_EXC_T *exc; { @@ -648,7 +648,7 @@ sm_exc_raise_x(exc) ** none. */ -void +void SM_DEAD_D #if SM_VA_STD sm_exc_raisenew_x( const SM_EXC_TYPE_T *etype, diff --git a/gnu/usr.sbin/sendmail/libsm/ldap.c b/gnu/usr.sbin/sendmail/libsm/ldap.c index da75b3d2581..f3a6d1b87e2 100644 --- a/gnu/usr.sbin/sendmail/libsm/ldap.c +++ b/gnu/usr.sbin/sendmail/libsm/ldap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 2001-2003 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_RCSID("@(#)$Sendmail: ldap.c,v 1.44.2.3 2003/07/07 20:16:16 gshapiro Exp $") +SM_RCSID("@(#)$Sendmail: ldap.c,v 1.44.2.5 2003/12/23 21:21:56 gshapiro Exp $") #if LDAPMAP # include @@ -570,9 +570,11 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result, ** no need to spin through attributes */ - if (statp == EX_OK && - bitset(SM_LDAP_MATCHONLY, flags)) + if (bitset(SM_LDAP_MATCHONLY, flags)) + { + statp = EX_OK; continue; + } /* record completed DN's to prevent loops */ dn = ldap_get_dn(lmap->ldap_ld, entry); diff --git a/gnu/usr.sbin/sendmail/libsm/local.h b/gnu/usr.sbin/sendmail/libsm/local.h index 21777ddfab9..c6417edf019 100644 --- a/gnu/usr.sbin/sendmail/libsm/local.h +++ b/gnu/usr.sbin/sendmail/libsm/local.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 2000-2002, 2004 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -11,7 +11,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Sendmail: local.h,v 1.51.2.1 2002/09/09 21:38:08 gshapiro Exp $ + * $Sendmail: local.h,v 1.51.2.2 2004/01/09 18:32:44 ca Exp $ */ /* diff --git a/gnu/usr.sbin/sendmail/sendmail/README b/gnu/usr.sbin/sendmail/sendmail/README index 671da1bd1ad..b5aa17336c7 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.355.2.15 2003/06/02 01:43:04 ca Exp $ +# $Sendmail: README,v 8.355.2.16 2004/01/08 21:54:55 ca Exp $ # This directory contains the source files for sendmail(TM). @@ -561,6 +561,11 @@ MATCHGECOS Permit fuzzy matching of user names against the full MIME8TO7 If non-zero, include 8 to 7 bit MIME conversions. This also controls advertisement of 8BITMIME in the ESMTP startup dialogue. +MIME7TO8_OLD If 0 then use an algorithm for MIME 7-bit quoted-printable + or base64 encoding to 8-bit text that has been introduced + in 8.12.3. There are some examples where that code fails, + but the old code works. If you have an example of improper + 7 to 8 bit conversion please send it to sendmail-bugs. MIME7TO8 If non-zero, include 7 to 8 bit MIME conversions. HES_GETMAILHOST Define this to 1 if you are using Hesiod with the hes_getmailhost() routine. This is included with the MIT @@ -1797,4 +1802,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.18 $, last update $Date: 2003/09/17 17:31:40 $ ) +(Version $Revision: 1.19 $, last update $Date: 2004/01/19 01:41:13 $ ) diff --git a/gnu/usr.sbin/sendmail/sendmail/alias.c b/gnu/usr.sbin/sendmail/sendmail/alias.c index 25d7a0631d6..ac53735cfac 100644 --- a/gnu/usr.sbin/sendmail/sendmail/alias.c +++ b/gnu/usr.sbin/sendmail/sendmail/alias.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2003 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 -SM_RCSID("@(#)$Sendmail: alias.c,v 8.214.2.1 2003/07/28 17:47:55 ca Exp $") +SM_RCSID("@(#)$Sendmail: alias.c,v 8.214.2.2 2003/10/06 20:43:29 ca Exp $") #define SEPARATOR ':' # define ALIAS_SPEC_SEPARATORS " ,/:" diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.c b/gnu/usr.sbin/sendmail/sendmail/conf.c index d222058dc81..7b825c14541 100644 --- a/gnu/usr.sbin/sendmail/sendmail/conf.c +++ b/gnu/usr.sbin/sendmail/sendmail/conf.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Sendmail: conf.c,v 8.972.2.50 2003/09/03 21:37:03 ca Exp $") +SM_RCSID("@(#)$Sendmail: conf.c,v 8.972.2.54 2004/01/08 21:54:55 ca Exp $") #include #if NEWDB @@ -5573,6 +5573,9 @@ char *CompileOptions[] = #if MIME7TO8 "MIME7TO8", #endif /* MIME7TO8 */ +#if MIME7TO8_OLD + "MIME7TO8_OLD", +#endif /* MIME7TO8_OLD */ #if MIME8TO7 "MIME8TO7", #endif /* MIME8TO7 */ @@ -6067,11 +6070,19 @@ char *FFRCompileOptions[] = /* Limit sleep(2) time in libsm/clock.c */ "_FFR_MAX_SLEEP_TIME", #endif /* _FFR_MAX_SLEEP_TIME */ +#if _FFR_MESSAGEID_MACRO + /* stick the message ID header's value in a macro */ + "_FFR_MESSAGEID_MACRO", +#endif /* _FFR_MESSAGEID_MACRO */ #if MILTER # if _FFR_MILTER_421 /* If a filter returns 421, close the SMTP connection */ "_FFR_MILTER_421", # endif /* _FFR_MILTER_421 */ +# if _FFR_MILTER_MACROS_EOM + /* Add an EOM macro set for milter */ + "_FFR_MILTER_MACROS_EOM", +# endif /* _FFR_MILTER_MACROS_EOM */ # if _FFR_MILTER_PERDAEMON /* Per DaemonPortOptions InputMailFilter lists */ "_FFR_MILTER_PERDAEMON", diff --git a/gnu/usr.sbin/sendmail/sendmail/daemon.c b/gnu/usr.sbin/sendmail/sendmail/daemon.c index f5d18757176..bcf003bb5bd 100644 --- a/gnu/usr.sbin/sendmail/sendmail/daemon.c +++ b/gnu/usr.sbin/sendmail/sendmail/daemon.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Sendmail: daemon.c,v 8.613.2.17 2003/07/30 20:17:04 ca Exp $") +SM_RCSID("@(#)$Sendmail: daemon.c,v 8.613.2.20 2003/11/25 19:02:24 ca Exp $") #if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__) # define USE_SOCK_STREAM 1 @@ -164,6 +164,8 @@ getrequests(e) extern bool refuseconnections __P((char *, ENVELOPE *, int, bool)); + /* initialize data for function that generates queue ids */ + init_qid_alg(); for (idx = 0; idx < NDaemons; idx++) { Daemons[idx].d_port = setupdaemon(&(Daemons[idx].d_addr)); @@ -363,7 +365,6 @@ getrequests(e) /* Did someone signal while waiting? */ CHECK_RESTART; - curdaemon = -1; if (doqueuerun()) { @@ -3484,10 +3485,21 @@ getauthinfo(fd, may_be_forged) nleft = sizeof ibuf - 1; while ((i = read(s, p, nleft)) > 0) { + char *s; + p += i; nleft -= i; *p = '\0'; - if (strchr(ibuf, '\n') != NULL || nleft <= 0) + if ((s = strchr(ibuf, '\n')) != NULL) + { + if (p > s + 1) + { + p = s + 1; + *p = '\0'; + } + break; + } + if (nleft <= 0) break; } (void) close(s); diff --git a/gnu/usr.sbin/sendmail/sendmail/deliver.c b/gnu/usr.sbin/sendmail/sendmail/deliver.c index 503d3757499..0c0b1f7522f 100644 --- a/gnu/usr.sbin/sendmail/sendmail/deliver.c +++ b/gnu/usr.sbin/sendmail/sendmail/deliver.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Sendmail: deliver.c,v 8.940.2.19 2003/09/03 19:58:26 ca Exp $") +SM_RCSID("@(#)$Sendmail: deliver.c,v 8.940.2.20 2003/09/26 18:26:19 ca Exp $") #if HASSETUSERCONTEXT # include @@ -3491,7 +3491,12 @@ do_transfer: (mci->mci_state == MCIS_MAIL || mci->mci_state == MCIS_RCPT || mci->mci_state == MCIS_DATA)) + { mci->mci_state = MCIS_OPEN; + SmtpPhase = mci->mci_phase = "idle"; + sm_setproctitle(true, e, "%s: %s", CurHostName, + mci->mci_phase); + } } if (tobuf[0] != '\0') diff --git a/gnu/usr.sbin/sendmail/sendmail/headers.c b/gnu/usr.sbin/sendmail/sendmail/headers.c index d2110d30ab7..625d8bc7118 100644 --- a/gnu/usr.sbin/sendmail/sendmail/headers.c +++ b/gnu/usr.sbin/sendmail/sendmail/headers.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Sendmail: headers.c,v 8.266.4.7 2003/09/03 21:32:20 ca Exp $") +SM_RCSID("@(#)$Sendmail: headers.c,v 8.266.4.9 2003/10/30 00:17:22 gshapiro Exp $") static size_t fix_mime_header __P((HDR *, ENVELOPE *)); static int priencode __P((char *)); @@ -730,6 +730,10 @@ eatheader(e, full, log) e->e_msgid = h->h_value; while (isascii(*e->e_msgid) && isspace(*e->e_msgid)) e->e_msgid++; +#if _FFR_MESSAGEID_MACRO + macdefine(&e->e_macro, A_PERM, macid("{msg_id}"), + e->e_msgid); +#endif /* _FFR_MESSAGEID_MACRO */ } } if (tTd(32, 1)) @@ -773,11 +777,13 @@ eatheader(e, full, log) e->e_timeoutclass = TOC_NORMAL; else if (sm_strcasecmp(p, "non-urgent") == 0) e->e_timeoutclass = TOC_NONURGENT; +#if _FFR_QUEUERETURN_DSN + else if (bitset(EF_RESPONSE, e->e_flags)) + e->e_timeoutclass = TOC_DSN; +#endif /* _FFR_QUEUERETURN_DSN */ } - #if _FFR_QUEUERETURN_DSN - /* If no timeoutclass picked and it's a DSN, use that timeoutclass */ - if (e->e_timeoutclass == TOC_NORMAL && bitset(EF_RESPONSE, e->e_flags)) + else if (bitset(EF_RESPONSE, e->e_flags)) e->e_timeoutclass = TOC_DSN; #endif /* _FFR_QUEUERETURN_DSN */ diff --git a/gnu/usr.sbin/sendmail/sendmail/main.c b/gnu/usr.sbin/sendmail/sendmail/main.c index fd02287a2d1..10556d3e415 100644 --- a/gnu/usr.sbin/sendmail/sendmail/main.c +++ b/gnu/usr.sbin/sendmail/sendmail/main.c @@ -25,7 +25,7 @@ SM_UNUSED(static char copyright[]) = The Regents of the University of California. All rights reserved.\n"; #endif /* ! lint */ -SM_RCSID("@(#)$Sendmail: main.c,v 8.887.2.27 2003/08/04 17:23:37 ca Exp $") +SM_RCSID("@(#)$Sendmail: main.c,v 8.887.2.29 2003/11/07 00:09:31 ca Exp $") #if NETINET || NETINET6 @@ -2234,8 +2234,32 @@ main(argc, argv, envp) int status; pid_t ret; + errno = 0; while ((ret = sm_wait(&status)) <= 0) + { + if (errno == ECHILD) + { + /* + ** Oops... something got messed + ** up really bad. Waiting for + ** non-existent children + ** shouldn't happen. Let's get + ** out of here. + */ + + CurChildren = 0; + break; + } continue; + } + + /* something is really really wrong */ + if (errno == ECHILD) + { + sm_syslog(LOG_ERR, NOQID, + "queue control process: lost all children: wait returned ECHILD"); + break; + } /* Only drop when a child gives status */ if (WIFSTOPPED(status)) @@ -2371,8 +2395,31 @@ main(argc, argv, envp) int group; CHECK_RESTART; + errno = 0; while ((ret = sm_wait(&status)) <= 0) + { + /* + ** Waiting for non-existent + ** children shouldn't happen. + ** Let's get out of here if + ** it occurs. + */ + + if (errno == ECHILD) + { + CurChildren = 0; + break; + } continue; + } + + /* something is really really wrong */ + if (errno == ECHILD) + { + sm_syslog(LOG_ERR, NOQID, + "persistent queue runner control process: lost all children: wait returned ECHILD"); + break; + } if (WIFSTOPPED(status)) continue; diff --git a/gnu/usr.sbin/sendmail/sendmail/milter.c b/gnu/usr.sbin/sendmail/sendmail/milter.c index 69661c4a621..6c60e2d1234 100644 --- a/gnu/usr.sbin/sendmail/sendmail/milter.c +++ b/gnu/usr.sbin/sendmail/sendmail/milter.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Sendmail: milter.c,v 8.197.2.9 2003/09/07 00:18:29 ca Exp $") +SM_RCSID("@(#)$Sendmail: milter.c,v 8.197.2.10 2003/12/01 23:57:44 msk Exp $") #if MILTER # include @@ -34,6 +34,9 @@ static char *MilterConnectMacros[MAXFILTERMACROS + 1]; static char *MilterHeloMacros[MAXFILTERMACROS + 1]; static char *MilterEnvFromMacros[MAXFILTERMACROS + 1]; static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1]; +#if _FFR_MILTER_MACROS_EOM +static char *MilterEOMMacros[MAXFILTERMACROS + 1]; +#endif /* _FFR_MILTER_MACROS_EOM */ # define MILTER_CHECK_DONE_MSG() \ if (*state == SMFIR_REPLYCODE || \ @@ -1415,6 +1418,10 @@ static struct milteropt { "macros.envrcpt", MO_MACROS_ENVRCPT }, # define MO_LOGLEVEL 0x05 { "loglevel", MO_LOGLEVEL }, +#if _FFR_MILTER_MACROS_EOM +# define MO_MACROS_EOM 0x06 + { "macros.eom", MO_MACROS_EOM }, +#endif /* _FFR_MILTER_MACROS_EOM */ { NULL, 0 }, }; @@ -1488,6 +1495,13 @@ milter_set_option(name, val, sticky) case MO_MACROS_ENVRCPT: if (macros == NULL) macros = MilterEnvRcptMacros; +#if _FFR_MILTER_MACROS_EOM + /* FALLTHROUGH */ + + case MO_MACROS_EOM: + if (macros == NULL) + macros = MilterEOMMacros; +#endif /* _FFR_MILTER_MACROS_EOM */ p = newstr(val); while (*p != '\0') @@ -3594,6 +3608,11 @@ milter_data(e, state) MILTER_CHECK_RESULTS(); } +#if _FFR_MILTER_MACROS_EOM + if (MilterEOMMacros[0] != NULL) + milter_send_macros(m, MilterEOMMacros, SMFIC_BODYEOB, e); +#endif /* _FFR_MILTER_MACROS_EOM */ + /* send the final body chunk */ (void) milter_write(m, SMFIC_BODYEOB, NULL, 0, m->mf_timeout[SMFTO_WRITE], e); diff --git a/gnu/usr.sbin/sendmail/sendmail/mime.c b/gnu/usr.sbin/sendmail/sendmail/mime.c index 4db1f6f4e70..15fdc1bbd83 100644 --- a/gnu/usr.sbin/sendmail/sendmail/mime.c +++ b/gnu/usr.sbin/sendmail/sendmail/mime.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1994, 1996-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1994 @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Sendmail: mime.c,v 8.130.2.1 2003/04/15 01:05:59 ca Exp $") +SM_RCSID("@(#)$Sendmail: mime.c,v 8.130.2.3 2004/01/08 21:42:56 ca Exp $") /* ** MIME support. @@ -33,6 +33,11 @@ SM_RCSID("@(#)$Sendmail: mime.c,v 8.130.2.1 2003/04/15 01:05:59 ca Exp $") ** the problem. */ +/* use "old" mime 7 to 8 algorithm by default */ +#ifndef MIME7TO8_OLD +# define MIME7TO8_OLD 1 +#endif /* ! MIME7TO8_OLD */ + #if MIME8TO7 static int isboundary __P((char *, char **)); static int mimeboundary __P((char *, char **)); @@ -1064,54 +1069,41 @@ mime7to8(mci, header, e) c1 = CHAR64(c1); c2 = CHAR64(c2); +#if MIME7TO8_OLD +#define CHK_EOL if (*--fbufp != '\n' || (fbufp > fbuf && *--fbufp != '\r')) \ + ++fbufp; +#else /* MIME7TO8_OLD */ +#define CHK_EOL if (*--fbufp != '\n' || (fbufp > fbuf && *--fbufp != '\r')) \ + { \ + ++fbufp; \ + pxflags |= PXLF_NOADDEOL; \ + } +#endif /* MIME7TO8_OLD */ + +#define PUTLINE64 \ + do \ + { \ + if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE]) \ + { \ + CHK_EOL; \ + putxline((char *) fbuf, fbufp - fbuf, mci, pxflags); \ + pxflags &= ~PXLF_NOADDEOL; \ + fbufp = fbuf; \ + } \ + } while (0) + *fbufp = (c1 << 2) | ((c2 & 0x30) >> 4); - if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE]) - { - if (*--fbufp != '\n' || - (fbufp > fbuf && *--fbufp != '\r')) - { - pxflags |= PXLF_NOADDEOL; - fbufp++; - } - putxline((char *) fbuf, fbufp - fbuf, - mci, pxflags); - pxflags &= ~PXLF_NOADDEOL; - fbufp = fbuf; - } + PUTLINE64; if (c3 == '=') continue; c3 = CHAR64(c3); *fbufp = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2); - if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE]) - { - if (*--fbufp != '\n' || - (fbufp > fbuf && *--fbufp != '\r')) - { - pxflags |= PXLF_NOADDEOL; - fbufp++; - } - putxline((char *) fbuf, fbufp - fbuf, - mci, pxflags); - pxflags &= ~PXLF_NOADDEOL; - fbufp = fbuf; - } + PUTLINE64; if (c4 == '=') continue; c4 = CHAR64(c4); *fbufp = ((c3 & 0x03) << 6) | c4; - if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE]) - { - if (*--fbufp != '\n' || - (fbufp > fbuf && *--fbufp != '\r')) - { - pxflags |= PXLF_NOADDEOL; - fbufp++; - } - putxline((char *) fbuf, fbufp - fbuf, - mci, pxflags); - pxflags &= ~PXLF_NOADDEOL; - fbufp = fbuf; - } + PUTLINE64; } } else diff --git a/gnu/usr.sbin/sendmail/sendmail/queue.c b/gnu/usr.sbin/sendmail/sendmail/queue.c index dcf72c4bd91..cd2c0dedbe5 100644 --- a/gnu/usr.sbin/sendmail/sendmail/queue.c +++ b/gnu/usr.sbin/sendmail/sendmail/queue.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Sendmail: queue.c,v 8.863.2.61 2003/09/03 19:58:26 ca Exp $") +SM_RCSID("@(#)$Sendmail: queue.c,v 8.863.2.67 2003/12/02 23:56:01 ca Exp $") #include @@ -22,7 +22,16 @@ SM_RCSID("@(#)$Sendmail: queue.c,v 8.863.2.61 2003/09/03 19:58:26 ca Exp $") # define sm_file_exists(errno) ((errno) == EEXIST) -# define TF_OPEN_FLAGS (O_CREAT|O_WRONLY|O_EXCL) +# if HASFLOCK && defined(O_EXLOCK) +# define SM_OPEN_EXLOCK 1 +# define TF_OPEN_FLAGS (O_CREAT|O_WRONLY|O_EXCL|O_EXLOCK) +# else /* HASFLOCK && defined(O_EXLOCK) */ +# define TF_OPEN_FLAGS (O_CREAT|O_WRONLY|O_EXCL) +# endif /* HASFLOCK && defined(O_EXLOCK) */ + +#ifndef SM_OPEN_EXLOCK +# define SM_OPEN_EXLOCK 0 +#endif /* ! SM_OPEN_EXLOCK */ /* ** Historical notes: @@ -358,6 +367,18 @@ queueup(e, announce, msync) ** Create control file. */ +#define OPEN_TF do \ + { \ + MODE_T oldumask = 0; \ + \ + if (bitset(S_IWGRP, QueueFileMode)) \ + oldumask = umask(002); \ + tfd = open(tf, TF_OPEN_FLAGS, QueueFileMode); \ + if (bitset(S_IWGRP, QueueFileMode)) \ + (void) umask(oldumask); \ + } while (0) + + newid = (e->e_id == NULL) || !bitset(EF_INQUEUE, e->e_flags); (void) sm_strlcpy(tf, queuename(e, NEWQFL_LETTER), sizeof tf); tfp = e->e_lockfp; @@ -370,9 +391,11 @@ queueup(e, announce, msync) */ (void) sm_strlcpy(tf, queuename(e, ANYQFL_LETTER), sizeof tf); - tfd = open(tf, TF_OPEN_FLAGS, FileMode); + OPEN_TF; if (tfd < 0 || +#if !SM_OPEN_EXLOCK !lockfile(tfd, tf, NULL, LOCK_EX|LOCK_NB) || +#endif /* !SM_OPEN_EXLOCK */ (tfp = sm_io_open(SmFtStdiofd, SM_TIME_DEFAULT, (void *) &tfd, SM_IO_WRONLY_B, NULL)) == NULL) @@ -396,14 +419,7 @@ queueup(e, announce, msync) { if (tfd < 0) { - MODE_T oldumask = 0; - - if (bitset(S_IWGRP, QueueFileMode)) - oldumask = umask(002); - tfd = open(tf, TF_OPEN_FLAGS, QueueFileMode); - if (bitset(S_IWGRP, QueueFileMode)) - (void) umask(oldumask); - + OPEN_TF; if (tfd < 0) { if (errno != EEXIST) @@ -414,12 +430,22 @@ queueup(e, announce, msync) tf, (int) geteuid(), sm_errstring(errno)); } +#if SM_OPEN_EXLOCK + else + break; +#endif /* SM_OPEN_EXLOCK */ } if (tfd >= 0) { +#if SM_OPEN_EXLOCK + /* file is locked by open() */ + break; +#else /* SM_OPEN_EXLOCK */ if (lockfile(tfd, tf, NULL, LOCK_EX|LOCK_NB)) break; - else if (LogLevel > 0 && (i % 32) == 0) + else +#endif /* SM_OPEN_EXLOCK */ + if (LogLevel > 0 && (i % 32) == 0) sm_syslog(LOG_ALERT, e->e_id, "queueup: cannot lock %s: %s", tf, sm_errstring(errno)); @@ -5172,6 +5198,36 @@ queuename(e, type) sm_dprintf("queuename: %s\n", buf); return buf; } + +/* +** INIT_QID_ALG -- Initialize the (static) parameters that are used to +** generate a queue ID. +** +** This function is called by the daemon to reset +** LastQueueTime and LastQueuePid which are used by assign_queueid(). +** Otherwise the algorithm may cause problems because +** LastQueueTime and LastQueuePid are set indirectly by main() +** before the daemon process is started, hence LastQueuePid is not +** the pid of the daemon and therefore a child of the daemon can +** actually have the same pid as LastQueuePid which means the section +** in assign_queueid(): +** * see if we need to get a new base time/pid * +** is NOT triggered which will cause the same queue id to be generated. +** +** Parameters: +** none +** +** Returns: +** none. +*/ + +void +init_qid_alg() +{ + LastQueueTime = 0; + LastQueuePid = -1; +} + /* ** ASSIGN_QUEUEID -- assign a queue ID for this envelope. ** @@ -5188,8 +5244,20 @@ queuename(e, type) ** none. */ -static const char QueueIdChars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx"; +static const char QueueIdChars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; # define QIC_LEN 60 +# define QIC_LEN_R 62 + +/* +** Note: the length is "officially" 60 because minutes and seconds are +** usually only 0-59. However (Linux): +** tm_sec The number of seconds after the minute, normally in +** the range 0 to 59, but can be up to 61 to allow for +** leap seconds. +** Hence the real length of the string is 62 to take this into account. +** Alternatively % QIC_LEN can (should) be used for access everywhere. +*/ + # define queuenextid() CurrentPid @@ -5244,8 +5312,8 @@ assign_queueid(e) idbuf[1] = QueueIdChars[tm->tm_mon]; idbuf[2] = QueueIdChars[tm->tm_mday]; idbuf[3] = QueueIdChars[tm->tm_hour]; - idbuf[4] = QueueIdChars[tm->tm_min]; - idbuf[5] = QueueIdChars[tm->tm_sec]; + idbuf[4] = QueueIdChars[tm->tm_min % QIC_LEN_R]; + idbuf[5] = QueueIdChars[tm->tm_sec % QIC_LEN_R]; idbuf[6] = QueueIdChars[seq / QIC_LEN]; idbuf[7] = QueueIdChars[seq % QIC_LEN]; (void) sm_snprintf(&idbuf[8], sizeof idbuf - 8, "%06d", @@ -7357,10 +7425,10 @@ cmpidx(a, b) void makeworkgroups() { - int i, j, total_runners = 0; - int dir; + int i, j, total_runners, dir, h; SORTQGRP_T si[MAXQUEUEGROUPS + 1]; + total_runners = 0; if (NumQueue == 1 && strcmp(Queue[0]->qg_name, "mqueue") == 0) { /* @@ -7456,18 +7524,19 @@ makeworkgroups() (WorkGrp[j].wg_numqgrp + 1))); } - WorkGrp[j].wg_qgs[WorkGrp[j].wg_numqgrp] = Queue[si[i].sg_idx]; + h = si[i].sg_idx; + WorkGrp[j].wg_qgs[WorkGrp[j].wg_numqgrp] = Queue[h]; WorkGrp[j].wg_numqgrp++; - WorkGrp[j].wg_runners += Queue[i]->qg_maxqrun; - Queue[si[i].sg_idx]->qg_wgrp = j; + WorkGrp[j].wg_runners += Queue[h]->qg_maxqrun; + Queue[h]->qg_wgrp = j; if (WorkGrp[j].wg_maxact == 0) { /* can't have more runners than allowed total */ if (MaxQueueChildren > 0 && - Queue[i]->qg_maxqrun > MaxQueueChildren) - Queue[i]->qg_maxqrun = MaxQueueChildren; - WorkGrp[j].wg_maxact = Queue[i]->qg_maxqrun; + Queue[h]->qg_maxqrun > MaxQueueChildren) + Queue[h]->qg_maxqrun = MaxQueueChildren; + WorkGrp[j].wg_maxact = Queue[h]->qg_maxqrun; } /* @@ -7477,9 +7546,9 @@ makeworkgroups() */ /* keep track of the lowest interval for a persistent runner */ - if (Queue[si[i].sg_idx]->qg_queueintvl > 0 && - WorkGrp[j].wg_lowqintvl < Queue[si[i].sg_idx]->qg_queueintvl) - WorkGrp[j].wg_lowqintvl = Queue[si[i].sg_idx]->qg_queueintvl; + if (Queue[h]->qg_queueintvl > 0 && + WorkGrp[j].wg_lowqintvl < Queue[h]->qg_queueintvl) + WorkGrp[j].wg_lowqintvl = Queue[h]->qg_queueintvl; j += dir; } if (tTd(41, 9)) diff --git a/gnu/usr.sbin/sendmail/sendmail/readcf.c b/gnu/usr.sbin/sendmail/sendmail/readcf.c index bbb2a0c7b57..94ef205bf8e 100644 --- a/gnu/usr.sbin/sendmail/sendmail/readcf.c +++ b/gnu/usr.sbin/sendmail/sendmail/readcf.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Sendmail: readcf.c,v 8.607.2.11 2003/04/03 23:04:06 ca Exp $") +SM_RCSID("@(#)$Sendmail: readcf.c,v 8.607.2.12 2003/10/07 17:45:28 ca Exp $") #if NETINET || NETINET6 # include @@ -3153,7 +3153,7 @@ setoption(opt, val, safe, sticky, e) RunAsGid = pw->pw_gid; else if (UseMSP && *p == '\0') (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, - "WARNING: RunAsGid for MSP ignored, check group ids (egid=%d, want=%d)\n", + "WARNING: RunAsUser for MSP ignored, check group ids (egid=%d, want=%d)\n", (int) EffGid, (int) pw->pw_gid); } @@ -3177,7 +3177,7 @@ setoption(opt, val, safe, sticky, e) else if (UseMSP) (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, - "WARNING: RunAsGid for MSP ignored, check group ids (egid=%d, want=%d)\n", + "WARNING: RunAsUser for MSP ignored, check group ids (egid=%d, want=%d)\n", (int) EffGid, (int) runasgid); } @@ -3194,7 +3194,7 @@ setoption(opt, val, safe, sticky, e) else if (UseMSP) (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, - "WARNING: RunAsGid for MSP ignored, check group ids (egid=%d, want=%d)\n", + "WARNING: RunAsUser for MSP ignored, check group ids (egid=%d, want=%d)\n", (int) EffGid, (int) gr->gr_gid); } diff --git a/gnu/usr.sbin/sendmail/sendmail/recipient.c b/gnu/usr.sbin/sendmail/sendmail/recipient.c index e33965278ca..f0e49d7e48c 100644 --- a/gnu/usr.sbin/sendmail/sendmail/recipient.c +++ b/gnu/usr.sbin/sendmail/sendmail/recipient.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2003 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 -SM_RCSID("@(#)$Sendmail: recipient.c,v 8.330.2.2 2003/09/16 19:56:25 ca Exp $") +SM_RCSID("@(#)$Sendmail: recipient.c,v 8.330.2.4 2003/10/06 20:43:29 ca Exp $") static void includetimeout __P((void)); static ADDRESS *self_reference __P((ADDRESS *)); @@ -397,7 +397,8 @@ removefromlist(list, sendq, e) for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next) { if (!QS_IS_DEAD(q->q_state) && - sameaddr(q, &a)) + (sameaddr(q, &a) || + strcmp(q->q_paddr, a.q_paddr) == 0)) { if (tTd(25, 5)) { diff --git a/gnu/usr.sbin/sendmail/sendmail/sendmail.8 b/gnu/usr.sbin/sendmail/sendmail/sendmail.8 index 118b75a7f18..890b979b217 100644 --- a/gnu/usr.sbin/sendmail/sendmail/sendmail.8 +++ b/gnu/usr.sbin/sendmail/sendmail/sendmail.8 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Sendmail: sendmail.8,v 8.51.2.1 2003/05/20 16:38:15 gshapiro Exp $ +.\" $Sendmail: sendmail.8,v 8.51.2.3 2003/12/01 17:02:00 ca Exp $ .\" -.Dd May 20, 2003 +.Dd December 1, 2003 .Dt SENDMAIL 8 .Os .Sh NAME @@ -134,11 +134,34 @@ users or mailing lists. .It Fl C Ns Ar file Use alternate configuration file. .Nm Sendmail -refuses to run as root if an alternate configuration file is specified. -.It Fl d Ns Ar X -Set debugging value to -.Ar X . -.ne 1i +gives up any enhanced (set-user-ID or set-group-ID) privileges +if an alternate configuration file is specified. +.It Xo Fl d Ns Ar category Ns . Ns +.Ar level +.Xc +Set the debugging flag for +.Ar category +to +.Ar level . +The +.Ar category +is either an integer or a name specifying the topic; the +.Ar level +is an integer specifying the level of debugging output desired. +Higher levels generally mean more output. +More than one flag may be specified by separating flags with commas. +A list of numeric debugging categories can be found in the TRACEFLAGS file +in the sendmail source distribution. +.br +The option +.Fl d Ns Ar 0.1 +prints the version of +.Nm sendmail +and the options it was compiled with. +.br +Most other categories are only useful with, and documented in, +.Nm sendmail 's +source code. .It Fl F Ns Ar fullname Set the full name of the sender. .It Fl f Ns Ar name diff --git a/gnu/usr.sbin/sendmail/sendmail/sendmail.h b/gnu/usr.sbin/sendmail/sendmail/sendmail.h index 0aefba208af..08d11a865c1 100644 --- a/gnu/usr.sbin/sendmail/sendmail/sendmail.h +++ b/gnu/usr.sbin/sendmail/sendmail/sendmail.h @@ -48,7 +48,7 @@ #ifdef _DEFINE # ifndef lint -SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.919.2.28 2003/09/03 19:58:27 ca Exp $"; +SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.919.2.29 2003/11/07 00:08:02 ca Exp $"; # endif /* ! lint */ #endif /* _DEFINE */ @@ -1973,6 +1973,7 @@ extern void setup_queues __P((bool)); extern bool setnewqueue __P((ENVELOPE *)); extern bool shouldqueue __P((long, time_t)); extern void sync_queue_time __P((void)); +extern void init_qid_alg __P((void)); extern int print_single_queue __P((int, int)); #if REQUIRES_DIR_FSYNC # define SYNC_DIR(path, panic) sync_dir(path, panic) diff --git a/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c b/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c index fce6030cdf2..4486e59bbfd 100644 --- a/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c +++ b/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c @@ -16,7 +16,7 @@ # include #endif /* MILTER */ -SM_RCSID("@(#)$Sendmail: srvrsmtp.c,v 8.829.2.31 2003/07/01 17:30:01 ca Exp $") +SM_RCSID("@(#)$Sendmail: srvrsmtp.c,v 8.829.2.34 2004/01/14 19:13:46 ca Exp $") #if SASL || STARTTLS # include @@ -1288,6 +1288,7 @@ smtp(nullserver, d_flags, e) case CMDEHLO: case CMDNOOP: case CMDRSET: + case CMDERROR: /* process normally */ break; @@ -2338,6 +2339,29 @@ tlsfail: case CMDRCPT: /* rcpt -- designate recipient */ DELAY_CONN("RCPT"); + if (BadRcptThrottle > 0 && + n_badrcpts >= BadRcptThrottle) + { + if (LogLevel > 5 && + n_badrcpts == BadRcptThrottle) + { + sm_syslog(LOG_INFO, e->e_id, + "%s: Possible SMTP RCPT flood, throttling.", + CurSmtpClient); + + /* To avoid duplicated message */ + n_badrcpts++; + } + + /* + ** Don't use exponential backoff for now. + ** Some servers will open more connections + ** and actually overload the receiver even + ** more. + */ + + (void) sleep(1); + } if (!smtp.sm_gotmail) { usrerr("503 5.0.0 Need MAIL before RCPT"); @@ -2384,29 +2408,6 @@ tlsfail: e, true); macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), NULL); - if (BadRcptThrottle > 0 && - n_badrcpts >= BadRcptThrottle) - { - if (LogLevel > 5 && - n_badrcpts == BadRcptThrottle) - { - sm_syslog(LOG_INFO, e->e_id, - "%s: Possible SMTP RCPT flood, throttling.", - CurSmtpClient); - - /* To avoid duplicated message */ - n_badrcpts++; - } - - /* - ** Don't use exponential backoff for now. - ** Some servers will open more connections - ** and actually overload the receiver even - ** more. - */ - - (void) sleep(1); - } if (Errors > 0) goto rcpt_done; if (a == NULL) @@ -3146,7 +3147,7 @@ smtp_data(smtp, e) doublequeue = false; aborting = Errors > 0; - if (!aborting && + if (!(aborting || bitset(EF_DISCARD, e->e_flags)) && #if _FFR_QUARANTINE (QueueMode == QM_QUARANTINE || e->e_quarmsg == NULL) && #endif /* _FFR_QUARANTINE */ diff --git a/gnu/usr.sbin/sendmail/sendmail/tls.c b/gnu/usr.sbin/sendmail/sendmail/tls.c index 292ebb9de9b..e998db9004d 100644 --- a/gnu/usr.sbin/sendmail/sendmail/tls.c +++ b/gnu/usr.sbin/sendmail/sendmail/tls.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Sendmail: tls.c,v 8.79.4.4 2003/03/20 00:03:42 ca Exp $") +SM_RCSID("@(#)$Sendmail: tls.c,v 8.79.4.5 2003/12/28 04:23:28 gshapiro Exp $") #if STARTTLS # include @@ -344,30 +344,36 @@ tls_set_verify(ctx, ssl, vrfy) # define TLS_S_DHPAR_EX 0x00400000 /* DH param file exists */ # define TLS_S_DHPAR_OK 0x00800000 /* DH param file is ok to use */ +/* Type of variable */ +# define TLS_T_OTHER 0 +# define TLS_T_SRV 1 +# define TLS_T_CLT 2 + /* ** TLS_OK_F -- can var be an absolute filename? ** ** Parameters: ** var -- filename ** fn -- what is the filename used for? -** srv -- server side? +** type -- type of variable ** ** Returns: ** ok? */ static bool -tls_ok_f(var, fn, srv) +tls_ok_f(var, fn, type) char *var; char *fn; - bool srv; + int type; { /* must be absolute pathname */ if (var != NULL && *var == '/') return true; if (LogLevel > 12) sm_syslog(LOG_WARNING, NOQID, "STARTTLS: %s%s missing", - srv ? "Server" : "Client", fn); + type == TLS_T_SRV ? "Server" : + (type == TLS_T_CLT ? "Client" : ""), var); return false; } /* @@ -407,16 +413,16 @@ tls_safe_f(var, sff, srv) ** fn -- what is the filename used for? ** req -- is the file required? ** st -- status bit to set if ok -** srv -- server side? +** type -- type of variable ** ** Side Effects: ** uses r, ok; may change ok and status. ** */ -# define TLS_OK_F(var, fn, req, st, srv) if (ok) \ +# define TLS_OK_F(var, fn, req, st, type) if (ok) \ { \ - r = tls_ok_f(var, fn, srv); \ + r = tls_ok_f(var, fn, type); \ if (r) \ status |= st; \ else if (req) \ @@ -539,13 +545,13 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam) */ TLS_OK_F(certfile, "CertFile", bitset(TLS_I_CERT_EX, req), - TLS_S_CERT_EX, srv); + TLS_S_CERT_EX, srv ? TLS_T_SRV : TLS_T_CLT); TLS_OK_F(keyfile, "KeyFile", bitset(TLS_I_KEY_EX, req), - TLS_S_KEY_EX, srv); + TLS_S_KEY_EX, srv ? TLS_T_SRV : TLS_T_CLT); TLS_OK_F(cacertpath, "CACertPath", bitset(TLS_I_CERTP_EX, req), - TLS_S_CERTP_EX, srv); + TLS_S_CERTP_EX, TLS_T_OTHER); TLS_OK_F(cacertfile, "CACertFile", bitset(TLS_I_CERTF_EX, req), - TLS_S_CERTF_EX, srv); + TLS_S_CERTF_EX, TLS_T_OTHER); # if _FFR_TLS_1 /* @@ -556,12 +562,12 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam) if (cf2 != NULL) { TLS_OK_F(cf2, "CertFile", bitset(TLS_I_CERT_EX, req), - TLS_S_CERT2_EX, srv); + TLS_S_CERT2_EX, srv ? TLS_T_SRV : TLS_T_CLT); } if (kf2 != NULL) { TLS_OK_F(kf2, "KeyFile", bitset(TLS_I_KEY_EX, req), - TLS_S_KEY2_EX, srv); + TLS_S_KEY2_EX, srv ? TLS_T_SRV : TLS_T_CLT); } # endif /* _FFR_TLS_1 */ @@ -599,7 +605,7 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam) { TLS_OK_F(dhparam, "DHParameters", bitset(TLS_I_DHPAR_EX, req), - TLS_S_DHPAR_EX, srv); + TLS_S_DHPAR_EX, TLS_T_OTHER); } } if (!ok) diff --git a/gnu/usr.sbin/sendmail/sendmail/util.c b/gnu/usr.sbin/sendmail/sendmail/util.c index e008f08adb5..b812fae5324 100644 --- a/gnu/usr.sbin/sendmail/sendmail/util.c +++ b/gnu/usr.sbin/sendmail/sendmail/util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2003 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 -SM_RCSID("@(#)$Sendmail: util.c,v 8.363.2.7 2003/06/02 03:25:39 gshapiro Exp $") +SM_RCSID("@(#)$Sendmail: util.c,v 8.363.2.10 2003/10/15 17:19:14 ca Exp $") #include #include @@ -2380,7 +2380,8 @@ str2prt(s) *h++ = 'r'; break; default: - (void) sm_snprintf(h, l, "%03o", (int) c); + (void) sm_snprintf(h, l, "%03o", + (unsigned int)((unsigned char) c)); /* ** XXX since l is unsigned this may diff --git a/gnu/usr.sbin/sendmail/sendmail/version.c b/gnu/usr.sbin/sendmail/sendmail/version.c index c0c5725c2ca..e1c7fd32548 100644 --- a/gnu/usr.sbin/sendmail/sendmail/version.c +++ b/gnu/usr.sbin/sendmail/sendmail/version.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -13,6 +13,6 @@ #include -SM_RCSID("@(#)$Sendmail: version.c,v 8.104.2.22 2003/09/16 20:02:04 ca Exp $") +SM_RCSID("@(#)$Sendmail: version.c,v 8.104.2.26 2004/01/13 00:29:26 ca Exp $") -char Version[] = "8.12.10"; +char Version[] = "8.12.11"; diff --git a/gnu/usr.sbin/sendmail/smrsh/smrsh.8 b/gnu/usr.sbin/sendmail/smrsh/smrsh.8 index 03a0c861eaf..3416977cdc2 100644 --- a/gnu/usr.sbin/sendmail/smrsh/smrsh.8 +++ b/gnu/usr.sbin/sendmail/smrsh/smrsh.8 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Sendmail: smrsh.8,v 8.16.2.1 2003/07/08 01:33:03 gshapiro Exp $ +.\" $Sendmail: smrsh.8,v 8.16.2.2 2003/10/07 18:05:37 ca Exp $ .\" -.Dd July 8, 2003 +.Dd October 7, 2003 .Dt SMRSH 8 .Os .Sh NAME diff --git a/gnu/usr.sbin/sendmail/smrsh/smrsh.c b/gnu/usr.sbin/sendmail/smrsh/smrsh.c index 5bac52f671b..dfc63eeb3df 100644 --- a/gnu/usr.sbin/sendmail/smrsh/smrsh.c +++ b/gnu/usr.sbin/sendmail/smrsh/smrsh.c @@ -20,7 +20,7 @@ SM_IDSTR(copyright, Copyright (c) 1993\n\ The Regents of the University of California. All rights reserved.\n") -SM_IDSTR(id, "@(#)$Sendmail: smrsh.c,v 8.58.2.2 2002/09/24 21:40:05 ca Exp $") +SM_IDSTR(id, "@(#)$Sendmail: smrsh.c,v 8.58.2.5 2003/12/15 17:09:39 ca Exp $") /* ** SMRSH -- sendmail restricted shell @@ -118,8 +118,9 @@ addcmd(s, cmd, len) if (s == NULL || *s == '\0') return; + /* enough space for s (len) and CMDDIR + "/" and '\0'? */ if (sizeof newcmdbuf - strlen(newcmdbuf) <= - len + (cmd ? (strlen(CMDDIR) + 1) : 0)) + len + 1 + (cmd ? (strlen(CMDDIR) + 1) : 0)) { (void)sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s: command too long: %s\n", prg, par); @@ -130,7 +131,7 @@ addcmd(s, cmd, len) } if (cmd) (void) sm_strlcat2(newcmdbuf, CMDDIR, "/", sizeof newcmdbuf); - (void) sm_strlcat(newcmdbuf, s, sizeof newcmdbuf); + (void) strncat(newcmdbuf, s, len); } int @@ -423,7 +424,8 @@ main(argc, argv) #ifdef DEBUG (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%s\n", newcmdbuf); #endif /* DEBUG */ - (void) execle("/bin/sh", "/bin/sh", "-c", newcmdbuf, (char *)NULL, newenv); + (void) execle("/bin/sh", "/bin/sh", "-c", newcmdbuf, + (char *)NULL, newenv); save_errno = errno; #ifndef DEBUG syslog(LOG_CRIT, "Cannot exec /bin/sh: %s", sm_errstring(errno)); -- cgit v1.2.3