From 6fb2e07bcb02d866d2231769a24c1c0b8acca6c9 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Thu, 31 Jan 2008 00:00:00 -0500 Subject: [PATCH] postfix-2.3.14 --- postfix/HISTORY | 36 +++++++++++ postfix/src/global/mail_version.h | 4 +- postfix/src/milter/milter8.c | 77 +++++++++++++++--------- postfix/src/oqmgr/qmgr_entry.c | 3 +- postfix/src/pipe/pipe.c | 2 +- postfix/src/qmgr/qmgr_entry.c | 3 +- postfix/src/smtp/smtp_proto.c | 2 +- postfix/src/util/vstream.c | 15 +++-- postfix/src/xsasl/xsasl_dovecot_server.c | 2 +- 9 files changed, 104 insertions(+), 40 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index 8c6547b4e..eea5f97ec 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -13088,3 +13088,39 @@ Apologies for any names omitted. rate of delivery attempts when the queue file system is mounted with "noatime". File: flush/flush.c. Back-port from Postfix 2.4/2.5. + +20071030 + + Bugfix (introduced Postfix 2.3): Postfix mistakenly enforced + the 64kbyte limit (for sending body parts TO Milter + applications) also while receiving packets FROM Milter + applications. The limit is now at least 1GB. File: + milter/milter8.c. + +20071202 + + Bugfix (introduced Postfix 2.2): don't update the back-to-back + delivery time stamp while deferring mail. File: *qmgr/qmgr_entry.c. + +20071211 + + Bugfix (introduced 19980315): the "write" equivalent of + bugfix 20030104. File: util/vstream.c. + +20071213 + + Bugfix (introduced Postfix 2.3): the SMTP client never + marked corrupt files as corrupt. Victor Duchovni. File: + smtp/smtp_proto.c. + +20071229 + + Bugfix: the Milter client did not replace the Postfix-specific + form for unknown host names by the Sendmail-specific form. + File: milter/milter8.c. + +20080104 + + Workaround: minor change to the Dovecot AUTH request to + prevent dovecot-auth memory wastage. Timo Sirainen. File: + xsasl/xsasl_dovecot_server.c. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 24997fdcb..fe691c943 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20071017" -#define MAIL_VERSION_NUMBER "2.3.13" +#define MAIL_RELEASE_DATE "20080131" +#define MAIL_VERSION_NUMBER "2.3.14" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/milter/milter8.c b/postfix/src/milter/milter8.c index ee5fadeac..2870adedb 100644 --- a/postfix/src/milter/milter8.c +++ b/postfix/src/milter/milter8.c @@ -63,6 +63,7 @@ #include #include #include +#include /* INT_MAX */ #ifndef SHUT_RDWR #define SHUT_RDWR 2 @@ -280,7 +281,7 @@ typedef struct { /* * We don't accept insane amounts of data. */ -#define XXX_MAX_DATA (MILTER_CHUNK_SIZE * 2) +#define XXX_MAX_DATA (INT_MAX / 2) #define XXX_TIMEOUT 10 #ifndef USE_LIBMILTER_INCLUDES @@ -1624,6 +1625,17 @@ static const char *milter8_conn_event(MILTER *m, const char *myname = "milter8_conn_event"; MILTER8 *milter = (MILTER8 *) m; int port; + const char *sm_name; + char *ptr = 0; + const char *resp; + + /* + * Need a global definition for "unknown" host name or address that is + * shared by smtpd, cleanup and libmilter. + */ +#define XXX_UNKNOWN "unknown" +#define STR_EQ(x,y) (strcmp((x), (y)) == 0) +#define STR_NE(x,y) (strcmp((x), (y)) != 0) /* * XXX Sendmail 8 libmilter closes the MTA-to-filter socket when it finds @@ -1655,40 +1667,51 @@ static const char *milter8_conn_event(MILTER *m, port = 0; } milter->state = MILTER8_STAT_ENVELOPE; + /* Transform unknown hostname from Postfix to Sendmail form. */ + sm_name = (STR_NE(client_name, XXX_UNKNOWN) ? client_name : + STR_EQ(client_addr, XXX_UNKNOWN) ? client_name : + (ptr = concatenate("[", client_addr, "]", (char *) 0))); switch (addr_family) { case AF_INET: - return (milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, - DONT_SKIP_REPLY, macros, - MILTER8_DATA_STRING, client_name, - MILTER8_DATA_OCTET, SMFIA_INET, - MILTER8_DATA_NSHORT, htons(port), - MILTER8_DATA_STRING, client_addr, - MILTER8_DATA_END)); + resp = milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, + DONT_SKIP_REPLY, macros, + MILTER8_DATA_STRING, sm_name, + MILTER8_DATA_OCTET, SMFIA_INET, + MILTER8_DATA_NSHORT, htons(port), + MILTER8_DATA_STRING, client_addr, + MILTER8_DATA_END); + break; #ifdef HAS_IPV6 case AF_INET6: - return (milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, - DONT_SKIP_REPLY, macros, - MILTER8_DATA_STRING, client_name, - MILTER8_DATA_OCTET, SMFIA_INET6, - MILTER8_DATA_NSHORT, htons(port), - MILTER8_DATA_STRING, client_addr, - MILTER8_DATA_END)); + resp = milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, + DONT_SKIP_REPLY, macros, + MILTER8_DATA_STRING, sm_name, + MILTER8_DATA_OCTET, SMFIA_INET6, + MILTER8_DATA_NSHORT, htons(port), + MILTER8_DATA_STRING, client_addr, + MILTER8_DATA_END); + break; #endif case AF_UNIX: - return (milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, - DONT_SKIP_REPLY, macros, - MILTER8_DATA_STRING, client_name, - MILTER8_DATA_OCTET, SMFIA_UNIX, - MILTER8_DATA_NSHORT, htons(0), - MILTER8_DATA_STRING, client_addr, - MILTER8_DATA_END)); + resp = milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, + DONT_SKIP_REPLY, macros, + MILTER8_DATA_STRING, sm_name, + MILTER8_DATA_OCTET, SMFIA_UNIX, + MILTER8_DATA_NSHORT, htons(0), + MILTER8_DATA_STRING, client_addr, + MILTER8_DATA_END); + break; default: - return (milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, - DONT_SKIP_REPLY, macros, - MILTER8_DATA_STRING, client_name, - MILTER8_DATA_OCTET, SMFIA_UNKNOWN, - MILTER8_DATA_END)); + resp = milter8_event(milter, SMFIC_CONNECT, SMFIP_NOCONNECT, + DONT_SKIP_REPLY, macros, + MILTER8_DATA_STRING, sm_name, + MILTER8_DATA_OCTET, SMFIA_UNKNOWN, + MILTER8_DATA_END); + break; } + if (ptr != 0) + myfree(ptr); + return (resp); default: msg_panic("%s: milter %s: bad state %d", myname, milter->m.name, milter->state); diff --git a/postfix/src/oqmgr/qmgr_entry.c b/postfix/src/oqmgr/qmgr_entry.c index ccffdb0b0..df433f630 100644 --- a/postfix/src/oqmgr/qmgr_entry.c +++ b/postfix/src/oqmgr/qmgr_entry.c @@ -203,7 +203,8 @@ void qmgr_entry_done(QMGR_ENTRY *entry, int which) /* * Maintain back-to-back delivery status. */ - queue->last_done = event_time(); + if (which == QMGR_QUEUE_BUSY) + queue->last_done = event_time(); /* * When the in-core queue for this site is empty and when this site is diff --git a/postfix/src/pipe/pipe.c b/postfix/src/pipe/pipe.c index 086370263..d15ef9bbc 100644 --- a/postfix/src/pipe/pipe.c +++ b/postfix/src/pipe/pipe.c @@ -840,7 +840,7 @@ static void get_service_attr(PIPE_ATTR *attr, char **argv) /* * null_sender=string */ - else if (strncasecmp("null_sender=", *argv, sizeof("eol=") - 1) == 0) { + else if (strncasecmp("null_sender=", *argv, sizeof("null_sender=") - 1) == 0) { vstring_strcpy(attr->null_sender, *argv + sizeof("null_sender=") - 1); } diff --git a/postfix/src/qmgr/qmgr_entry.c b/postfix/src/qmgr/qmgr_entry.c index 58c278bfd..2788e9127 100644 --- a/postfix/src/qmgr/qmgr_entry.c +++ b/postfix/src/qmgr/qmgr_entry.c @@ -276,7 +276,8 @@ void qmgr_entry_done(QMGR_ENTRY *entry, int which) /* * Maintain back-to-back delivery status. */ - queue->last_done = event_time(); + if (which == QMGR_QUEUE_BUSY) + queue->last_done = event_time(); /* * When the in-core queue for this site is empty and when this site is diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index 1bd4e55cd..f6821c47a 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -1710,7 +1710,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state, fail_status = smtp_mesg_fail(state, DSN_BY_LOCAL_MTA, SMTP_RESP_FAKE(&fake, "5.3.0"), "unreadable mail queue entry"); - if (fail_status == 0) + if (state->status == 0) (void) mark_corrupt(state->src); RETURN(fail_status); } diff --git a/postfix/src/util/vstream.c b/postfix/src/util/vstream.c index ed857b3e3..dd4d3e255 100644 --- a/postfix/src/util/vstream.c +++ b/postfix/src/util/vstream.c @@ -477,6 +477,7 @@ static void vstream_buf_init(VBUF *bp, int flags) static void vstream_buf_alloc(VBUF *bp, ssize_t len) { + VSTREAM *stream = VBUF_TO_APPL(bp, VSTREAM, buf); ssize_t used = bp->ptr - bp->data; const char *myname = "vstream_buf_alloc"; @@ -492,10 +493,15 @@ static void vstream_buf_alloc(VBUF *bp, ssize_t len) bp->data = (unsigned char *) (bp->data ? myrealloc((char *) bp->data, len) : mymalloc(len)); bp->len = len; - if (bp->flags & VSTREAM_FLAG_READ) + if (bp->flags & VSTREAM_FLAG_READ) { bp->ptr = bp->data + used; - else + if (bp->flags & VSTREAM_FLAG_DOUBLE) + VSTREAM_SAVE_STATE(stream, read_buf, read_fd); + } else { VSTREAM_BUF_AT_OFFSET(bp, used); + if (bp->flags & VSTREAM_FLAG_DOUBLE) + VSTREAM_SAVE_STATE(stream, write_buf, write_fd); + } } /* vstream_buf_wipe - reset buffer to initial state */ @@ -663,11 +669,8 @@ static int vstream_buf_get_ready(VBUF *bp) * allocation gives the application a chance to override the default * buffering policy. */ - if (bp->data == 0) { + if (bp->data == 0) vstream_buf_alloc(bp, VSTREAM_BUFSIZE); - if (bp->flags & VSTREAM_FLAG_DOUBLE) - VSTREAM_SAVE_STATE(stream, read_buf, read_fd); - } /* * If the stream is double-buffered and the write buffer is not empty, diff --git a/postfix/src/xsasl/xsasl_dovecot_server.c b/postfix/src/xsasl/xsasl_dovecot_server.c index 47b6bc984..817dde73c 100644 --- a/postfix/src/xsasl/xsasl_dovecot_server.c +++ b/postfix/src/xsasl/xsasl_dovecot_server.c @@ -453,7 +453,7 @@ int xsasl_dovecot_server_first(XSASL_SERVER *xp, const char *sasl_method, /* send the request */ server->last_request_id = ++server->impl->request_id_counter; vstream_fprintf(server->impl->sasl_stream, - "AUTH\t%u\t%s\tservice=%s", + "AUTH\t%u\t%s\tservice=%s\tnologin", server->last_request_id, sasl_method, server->service); if (init_response) {