Cleanup: change redundant milter_abort() and milter_disc_event()
calls into NO-OPs. This avoids unnecessary panic() events
for completely harmless conditions. File: milter/milter8.c.
+
+20060805
+
+ Bugfix (introduced Postfix 2.3): #ifdef damage caused
+ smtp_sasl_start() to be invoked twice. Reported by C-J
+ Lofstedt. File: smtp/smtp_sasl_proto.c.
+
+20060806
+
+ Postfix no longer announces its name in delivery status
+ notifications. Users believe that Wietse provides a free
+ helpdesk service that solves all their email problems.
+ Credits to Jonathan Balester. File: bounce/bounce_templates.c.
+
+20060807
+
+ Bugfix (introduced Postfix 2.2): when upgrading from Postfix
+ < 2.2 with the third-party TLS patch, the post-install
+ upgrade procedure didn't put a "?" in the existing tlsmgr
+ entry, causing tlsmgr to repeatedly start and exit when TLS
+ support was not compiled in. File: conf/post-install.
+
+20060812
+
+ Bugfix (introduced Postfix < alpha): safety mechanism in
+ mail_date() didn't work. Found in code review. File:
+ global/mail_date.c.
+
+20060822
+
+ Added missing logging for "message to large" etc. Files:
+ smtpd/smtpd.c, cleanup/cleanup_milter.c.
+
+20060823
+
+ Bugfix (introduced Postfix 2.2): segfault when vstream_fclose()
+ attempted to flush unwritten output, after vstream_fdclose()
+ had already disconnected the stream from its file descriptor.
+ File: util/vstream.c.
+
+ Bugfix (introduced Postfix 2.2): vstream_fdclose() did not
+ flush unwritten output before disconnecting a stream from
+ its file descriptor(s). File: util/vstream.c.
+
+20060825
+
+ Bugfix (introduced Postfix 2.3): with headers-only mail, a
+ Milter "header insert" action corrupted the queue file. The
+ cleanup server executed some end-of-body action before the
+ end-of-header actions. File: cleanup/cleanup_message.c.
+
+ Robustness: mail delivery agents now detect loops in queue
+ files. Files with too many backward jumps are saved to the
+ "corrupt" directory. File: global/record.c.
"AUXLIBS=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
% make
-After postfix has been built with cdb support, you can use "cdb" tables
+After Postfix has been built with cdb support, you can use "cdb" tables
wherever you can use read-only "hash", "btree" or "dbm" tables. However, the
"p\bpo\bos\bst\btm\bma\bap\bp -\b-i\bi" (incremental record insertion) and "p\bpo\bos\bst\btm\bma\bap\bp -\b-d\bd" (incremental
record deletion) command-line options are not available. For the same reason
the "cdb" map type cannot be used to store the persistent address verification
-cache for the verify(8) service.
+cache for the verify(8) service, or to store TLS session information for the
+tlsmgr(8) service.
B\bBu\bui\bil\bld\bdi\bin\bng\bg P\bPo\bos\bst\btf\bfi\bix\bx w\bwi\bit\bth\bh D\bDo\bov\bve\bec\bco\bot\bt S\bSA\bAS\bSL\bL s\bsu\bup\bpp\bpo\bor\brt\bt
-Dovecot SASL support is available in Postfix 2.3 and later. The Dovecot source
-code is available via http://www.dovecot.org/. At the time of writing, only
-server-side SASL support is available, so you can't use it to authenticate to
-your network provider's server. Dovecot uses its own daemon process for
-authentication. This keeps the Postfix build process simple, because there is
-no need to link extra libraries into Postfix.
+Support for the Dovecot version 1 SASL protocol is available in Postfix 2.3 and
+later. At the time of writing, only server-side SASL support is available, so
+you can't use it to authenticate to your network provider's server. Dovecot
+uses its own daemon process for authentication. This keeps the Postfix build
+process simple, because there is no need to link extra libraries into Postfix.
To generate the necessary Makefiles, execute the following in the Postfix top-
level directory:
% make makefiles CCARGS='-DUSE_SASL_AUTH -
- DDEF_SASL_SERVER_TYPE=\"dovecot\"'
+ DDEF_SERVER_SASL_TYPE=\"dovecot\"'
After this, proceed with "make" as described in the INSTALL document.
Notes:
- * The "-DDEF_SASL_SERVER_TYPE" stuff is not necessary; it just makes Postfix
+ * The "-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just makes Postfix
configuration a little more convenient because you don't have to specify
the SASL plug-in type in the Postfix main.cf file.
The mail_release_date configuration parameter (format: yyyymmdd)
specifies the release date of a stable release or snapshot release.
+Incompatible changes with Postfix 2.3.3
+---------------------------------------
+
+Postfix no longer announces its name in delivery status notifications.
+Users believe that Wietse provides a free help desk service that
+solves all their email problems.
+
Critical notes
--------------
ed $config_directory/master.cf <<EOF || exit 1
/^tlsmgr[ ]*fifo[ ]/
s/fifo/unix/
+s/[0-9][0-9]*/&?/
p
w
q
</pre>
</blockquote>
-<p> After postfix has been built with cdb support, you can use
+<p> After Postfix has been built with cdb support, you can use
"cdb" tables wherever you can use read-only "hash", "btree" or
"dbm" tables. However, the "<b>postmap -i</b>" (incremental record
insertion) and "<b>postmap -d</b>" (incremental record deletion)
command-line options are not available. For the same reason the
"cdb" map type cannot be used to store the persistent address
-verification cache for the <a href="verify.8.html">verify(8)</a> service. </p>
+verification cache for the <a href="verify.8.html">verify(8)</a> service, or to store
+TLS session information for the <a href="tlsmgr.8.html">tlsmgr(8)</a> service. </p>
<h2><a name="build_dovecot">Building Postfix with Dovecot SASL
support</a></h2>
-<p> Dovecot SASL support is available in Postfix 2.3 and later. The
-Dovecot source code is available via <a href="http://www.dovecot.org/">http://www.dovecot.org/</a>. At
-the time
+<p> Support for the Dovecot version 1 SASL protocol is available
+in Postfix 2.3 and later. At the time
of writing, only server-side SASL support is available, so you can't
use it to authenticate to your network provider's server. Dovecot
uses its own daemon process for authentication. This keeps the
<blockquote>
<pre>
-% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SASL_SERVER_TYPE=\"dovecot\"'
+% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\"'
</pre>
</blockquote>
<ul>
-<li> <p> The "-DDEF_SASL_SERVER_TYPE" stuff is not necessary; it just
+<li> <p> The "-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just
makes Postfix configuration a little more convenient because you
don't have to specify the SASL plug-in type in the Postfix <a href="postconf.5.html">main.cf</a>
file. </p>
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail
- This is the $<a href="postconf.5.html#mail_name">mail_name</a> program at host $<a href="postconf.5.html#myhostname">myhostname</a>.
+ This is the mail system at host $<a href="postconf.5.html#myhostname">myhostname</a>.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $<a href="postconf.5.html#mail_name">mail_name</a> program
+ The mail system
EOF
The usage and specification of bounce templates is subject
mented by connecting to the service and sending a
wake up request. A ? at the end of the wake-up
time field requests that no wake up events be sent
- before the service is used. Specify 0 for no auto-
- matic wake up.
+ before the first time a service is used. Specify 0
+ for no automatic wake up.
The <a href="pickup.8.html"><b>pickup</b>(8)</a>, <a href="qmgr.8.html"><b>qmgr</b>(8)</a> and <a href="flush.8.html"><b>flush</b>(8)</a> daemons require
a wake up timer.
error (broken mail software) reports.
</p>
+<p> NOTE: postmaster notifications may contain confidential information
+such as SASL passwords or message content. It is the system
+administrator's responsibility to treat such information with care.
+</p>
+
<p>
The error classes are:
</p>
<p>
The numerical Postfix SMTP server response code when a sender or
recipient address is rejected by the <a href="postconf.5.html#reject_unknown_sender_domain">reject_unknown_sender_domain</a>
-or <a href="postconf.5.html#reject_unknown_recipient_domain">reject_unknown_recipient_domain</a> restriction.
+or <a href="postconf.5.html#reject_unknown_recipient_domain">reject_unknown_recipient_domain</a> restriction. The response is
+always 450 in case of a temporary DNS error.
</p>
<p>
;;
OpenBSD.3*) SYSTYPE=OPENBSD3
;;
+ OpenBSD.4*) SYSTYPE=OPENBSD4
+ ;;
ekkoBSD.1*) SYSTYPE=EKKOBSD1
;;
NetBSD.1*) SYSTYPE=NETBSD1
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
delete your own text from the attached returned message.
.ti +12
- The $mail_name program
+ The mail system
EOF
.in -4
.ad
number of seconds. The wake up is implemented by connecting
to the service and sending a wake up request. A ? at the
end of the wake-up time field requests that no wake up
-events be sent before the service is used.
+events be sent before the first time a service is used.
Specify 0 for no automatic wake up.
.sp
The \fBpickup\fR(8), \fBqmgr\fR(8) and \fBflush\fR(8)
may wish to turn on the policy (UCE and mail relaying) and protocol
error (broken mail software) reports.
.PP
+NOTE: postmaster notifications may contain confidential information
+such as SASL passwords or message content. It is the system
+administrator's responsibility to treat such information with care.
+.PP
The error classes are:
.IP "\fBbounce\fR (also implies \fB2bounce\fR)"
Send the postmaster copies of the headers of bounced mail, and
.SH unknown_address_reject_code (default: 450)
The numerical Postfix SMTP server response code when a sender or
recipient address is rejected by the reject_unknown_sender_domain
-or reject_unknown_recipient_domain restriction.
+or reject_unknown_recipient_domain restriction. The response is
+always 450 in case of a temporary DNS error.
.PP
Do not change this unless you have a complete understanding of RFC 821.
.SH unknown_client_reject_code (default: 450)
</pre>
</blockquote>
-<p> After postfix has been built with cdb support, you can use
+<p> After Postfix has been built with cdb support, you can use
"cdb" tables wherever you can use read-only "hash", "btree" or
"dbm" tables. However, the "<b>postmap -i</b>" (incremental record
insertion) and "<b>postmap -d</b>" (incremental record deletion)
command-line options are not available. For the same reason the
"cdb" map type cannot be used to store the persistent address
-verification cache for the verify(8) service. </p>
+verification cache for the verify(8) service, or to store
+TLS session information for the tlsmgr(8) service. </p>
<h2><a name="build_dovecot">Building Postfix with Dovecot SASL
support</a></h2>
-<p> Dovecot SASL support is available in Postfix 2.3 and later. The
-Dovecot source code is available via http://www.dovecot.org/. At
-the time
+<p> Support for the Dovecot version 1 SASL protocol is available
+in Postfix 2.3 and later. At the time
of writing, only server-side SASL support is available, so you can't
use it to authenticate to your network provider's server. Dovecot
uses its own daemon process for authentication. This keeps the
<blockquote>
<pre>
-% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SASL_SERVER_TYPE=\"dovecot\"'
+% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\"'
</pre>
</blockquote>
<ul>
-<li> <p> The "-DDEF_SASL_SERVER_TYPE" stuff is not necessary; it just
+<li> <p> The "-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just
makes Postfix configuration a little more convenient because you
don't have to specify the SASL plug-in type in the Postfix main.cf
file. </p>
# Subject: Undelivered Mail Returned to Sender
# Postmaster-Subject: Postmaster Copy: Undelivered Mail
#
-# This is the $mail_name program at host $myhostname.
+# This is the mail system at host $myhostname.
#
# I'm sorry to have to inform you that your message could not
# be delivered to one or more recipients. It's attached below.
# delete your own text from the attached returned message.
#
# .ti +12
-# The $mail_name program
+# The mail system
# EOF
# .in -4
# .ad
# number of seconds. The wake up is implemented by connecting
# to the service and sending a wake up request. A ? at the
# end of the wake-up time field requests that no wake up
-# events be sent before the service is used.
+# events be sent before the first time a service is used.
# Specify 0 for no automatic wake up.
# .sp
# The \fBpickup\fR(8), \fBqmgr\fR(8) and \fBflush\fR(8)
error (broken mail software) reports.
</p>
+<p> NOTE: postmaster notifications may contain confidential information
+such as SASL passwords or message content. It is the system
+administrator's responsibility to treat such information with care.
+</p>
+
<p>
The error classes are:
</p>
<p>
The numerical Postfix SMTP server response code when a sender or
recipient address is rejected by the reject_unknown_sender_domain
-or reject_unknown_recipient_domain restriction.
+or reject_unknown_recipient_domain restriction. The response is
+always 450 in case of a temporary DNS error.
</p>
<p>
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $mail_name program
+ The mail system
EOF
delay_template = <<EOF
Subject: Delayed Mail (still being retried)
Postmaster-Subject: Postmaster Warning: Delayed Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $mail_name program
+ The mail system
EOF
success_template = <<EOF
From: MAILER-DAEMON (Mail Delivery System)
Subject: Successful Mail Delivery Report
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
Your message was successfully delivered to the destination(s)
listed below. If the message was delivered to mailbox you will
receive no further notifications. Otherwise you may still receive
notifications of mail delivery errors from other systems.
- The $mail_name program
+ The mail system
EOF
verify_template = <<EOF
From: MAILER-DAEMON (Mail Delivery System)
Subject: Mail Delivery Status Report
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
Enclosed is the mail delivery report that you requested.
- The $mail_name program
+ The mail system
EOF
failure_template = <<EOF
Charset: us-ascii
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $mail_name program
+ The mail system
EOF
delay_template = <<EOF
Subject: Delayed Mail (still being retried)
Postmaster-Subject: Postmaster Warning: Delayed Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $mail_name program
+ The mail system
EOF
success_template = <<EOF
From: MAILER-DAEMON (Mail Delivery System)
Subject: Successful Mail Delivery Report
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
Your message was successfully delivered to the destination(s)
listed below. If the message was delivered to mailbox you will
receive no further notifications. Otherwise you may still receive
notifications of mail delivery errors from other systems.
- The $mail_name program
+ The mail system
EOF
verify_template = <<EOF
From: MAILER-DAEMON (Mail Delivery System)
Subject: Mail Delivery Status Report
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
Enclosed is the mail delivery report that you requested.
- The $mail_name program
+ The mail system
EOF
* The fail template is for permanent failure.
*/
static const char *def_bounce_failure_body[] = {
- "This is the $mail_name program at host $myhostname.",
+ "This is the mail system at host $myhostname.",
"",
"I'm sorry to have to inform you that your message could not",
"be delivered to one or more recipients. It's attached below.",
"If you do so, please include this problem report. You can",
"delete your own text from the attached returned message.",
"",
- " The $mail_name program",
+ " The mail system",
0,
};
* The delay template is for delayed mail notifications.
*/
static const char *def_bounce_delay_body[] = {
- "This is the $mail_name program at host $myhostname.",
+ "This is the mail system at host $myhostname.",
"",
"####################################################################",
"# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #",
"If you do so, please include this problem report. You can",
"delete your own text from the attached returned message.",
"",
- " The $mail_name program",
+ " The mail system",
0,
};
* notifications.
*/
static const char *def_bounce_success_body[] = {
- "This is the $mail_name program at host $myhostname.",
+ "This is the mail system at host $myhostname.",
"",
"Your message was successfully delivered to the destination(s)",
"listed below. If the message was delivered to mailbox you will",
"receive no further notifications. Otherwise you may still receive",
"notifications of mail delivery errors from other systems.",
"",
- " The $mail_name program",
+ " The mail system",
0,
};
* address verification (sendmail -bv).
*/
static const char *def_bounce_verify_body[] = {
- "This is the $mail_name program at host $myhostname.",
+ "This is the mail system at host $myhostname.",
"",
"Enclosed is the mail delivery report that you requested.",
"",
- " The $mail_name program",
+ " The mail system",
0,
};
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $mail_name program
+ The mail system
EOF
delay_template = <<EOF
Subject: Delayed Mail (still being retried)
Postmaster-Subject: Postmaster Warning: Delayed Mail
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
- The $mail_name program
+ The mail system
EOF
success_template = <<EOF
From: MAILER-DAEMON (Mail Delivery System)
Subject: Successful Mail Delivery Report
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
Your message was successfully delivered to the destination(s)
listed below. If the message was delivered to mailbox you will
receive no further notifications. Otherwise you may still receive
notifications of mail delivery errors from other systems.
- The $mail_name program
+ The mail system
EOF
verify_template = <<EOF
From: MAILER-DAEMON (Mail Delivery System)
Subject: Mail Delivery Status Report
-This is the $mail_name program at host $myhostname.
+This is the mail system at host $myhostname.
Enclosed is the mail delivery report that you requested.
- The $mail_name program
+ The mail system
EOF
* current file position so we can compute the message size lateron.
*/
else if (type == REC_TYPE_XTRA) {
+ state->mime_errs = mime_state_update(state->mime_state, type, buf, len);
if (state->milters || cleanup_milters)
/* Make room for body modification. */
cleanup_out_format(state, REC_TYPE_PTR, REC_TYPE_PTR_FORMAT, 0L);
- state->mime_errs = mime_state_update(state->mime_state, type, buf, len);
/* Ignore header truncation after primary message headers. */
state->mime_errs &= ~MIME_ERR_TRUNC_HEADER;
if (state->mime_errs && state->reason == 0) {
static void cleanup_milter_set_error(CLEANUP_STATE *state, int err)
{
- if (err == EFBIG)
+ if (err == EFBIG) {
+ msg_warn("%s: queue file size limit exceeded", state->queue_id);
state->errs |= CLEANUP_STAT_SIZE;
- else
+ } else {
+ msg_warn("%s: write queue file: %m", state->queue_id);
state->errs |= CLEANUP_STAT_WRITE;
+ }
}
/* cleanup_milter_error - return dummy error description */
* Finally, add the time zone name.
*/
while (strftime(vstring_end(vp), vstring_avail(vp), " (%Z)", lt) == 0)
- VSTRING_SPACE(vp, 100);
+ VSTRING_SPACE(vp, vstring_avail(vp) + 100);
VSTRING_SKIP(vp);
return (vstring_str(vp));
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20060727"
-#define MAIL_VERSION_NUMBER "2.3.2"
+#define MAIL_RELEASE_DATE "200600825"
+#define MAIL_VERSION_NUMBER "2.3.3"
#ifdef SNAPSHOT
# define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE
int rec_goto(VSTREAM *stream, const char *buf)
{
off_t offset;
+ static const char *saved_path;
+ static off_t saved_offset;
+ static int reverse_count;
+ /*
+ * Crude workaround for queue file loops. VSTREAMs currently have no
+ * option to attach application-specific data, so we use global state and
+ * simple logic to detect if an application switches streams. We trigger
+ * on reverse jumps only. There's one reverse jump for every inserted
+ * header, but only one reverse jump for all appended recipients. No-one
+ * is likely to insert 10000 message headers, but someone might append
+ * 10000 recipients.
+ */
+#define STREQ(x,y) ((x) == (y) && strcmp((x), (y)) == 0)
+#define REVERSE_JUMP_LIMIT 10000
+
+ if (!STREQ(saved_path, VSTREAM_PATH(stream))) {
+ saved_path = VSTREAM_PATH(stream);
+ reverse_count = 0;
+ saved_offset = 0;
+ }
while (ISSPACE(*buf))
buf++;
if ((offset = off_cvt_string(buf)) < 0) {
msg_warn("%s: malformed pointer record value: %s",
VSTREAM_PATH(stream), buf);
return (REC_TYPE_ERROR);
+ } else if (offset < saved_offset && ++reverse_count > REVERSE_JUMP_LIMIT) {
+ msg_warn("%s: too many reverse jump records", VSTREAM_PATH(stream));
+ return (REC_TYPE_ERROR);
} else if (offset > 0 && vstream_fseek(stream, offset, SEEK_SET) < 0) {
msg_warn("%s: seek error after pointer record: %m",
VSTREAM_PATH(stream));
return (REC_TYPE_ERROR);
} else {
+ saved_offset = offset;
return (0);
}
}
ret = smtp_sess_fail(state);
/* Session reuse is disabled. */
} else {
-#ifdef USE_TLS
+#ifndef USE_TLS
+ smtp_sasl_start(session, VAR_SMTP_SASL_OPTS,
+ var_smtp_sasl_opts);
+#else
if (session->tls_context == 0)
-#endif
smtp_sasl_start(session, VAR_SMTP_SASL_OPTS,
var_smtp_sasl_opts);
-#ifdef USE_TLS
#ifdef SNAPSHOT /* XXX: Not yet */
else if (session->tls_context->peer_verified)
smtp_sasl_start(session, VAR_SMTP_SASL_TLSV_OPTS,
var_smtp_sasl_tlsv_opts);
- else
#endif
+ else
smtp_sasl_start(session, VAR_SMTP_SASL_TLS_OPTS,
var_smtp_sasl_tls_opts);
#endif
&& (state->proxy == 0 ? (++start, --len) == 0 : len == 1))
break;
if (state->err == CLEANUP_STAT_OK) {
- if (var_message_limit > 0 && var_message_limit - state->act_size < len + 2)
+ if (var_message_limit > 0 && var_message_limit - state->act_size < len + 2) {
state->err = CLEANUP_STAT_SIZE;
- else {
+ msg_warn("%s: queue file size limit exceeded",
+ state->queue_id ? state->queue_id : "NOQUEUE");
+ } else {
state->act_size += len + 2;
if (out_record(out_stream, curr_rec_type, start, len) < 0)
state->err = out_error;
#if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
|| defined(FREEBSD5) || defined(FREEBSD6) \
|| defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
- || defined(OPENBSD2) || defined(OPENBSD3) \
+ || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
|| defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
|| defined(EKKOBSD1)
#define SUPPORTED
*/
if (stream->pid != 0)
msg_panic("vstream_fclose: stream has process");
- if ((stream->buf.flags & VSTREAM_FLAG_WRITE_DOUBLE) != 0)
+ if ((stream->buf.flags & VSTREAM_FLAG_WRITE_DOUBLE) != 0 && stream->fd >= 0)
vstream_fflush(stream);
+ /* Do not remove: vstream_fdclose() depends on this error test. */
err = vstream_ferror(stream);
if (stream->buf.flags & VSTREAM_FLAG_DOUBLE) {
if (stream->read_fd >= 0)
int vstream_fdclose(VSTREAM *stream)
{
+
+ /*
+ * Flush unwritten output, just like vstream_fclose(). Errors are
+ * reported by vstream_fclose().
+ */
+ if ((stream->buf.flags & VSTREAM_FLAG_WRITE_DOUBLE) != 0)
+ (void) vstream_fflush(stream);
+
+ /*
+ * NOTE: Negative file descriptors are not part of the external
+ * interface. They are for internal use only, in order to support
+ * vstream_fdclose() without a lot of code duplication. Applications that
+ * rely on negative VSTREAM file descriptors will break without warning.
+ */
if (stream->buf.flags & VSTREAM_FLAG_DOUBLE) {
- stream->read_fd = stream->write_fd = -1;
+ stream->fd = stream->read_fd = stream->write_fd = -1;
} else {
stream->fd = -1;
}