2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-31 22:25:24 +00:00

snapshot-20010522

This commit is contained in:
Wietse Venema
2001-05-22 00:00:00 -05:00
committed by Viktor Dukhovni
parent 8e965a9d68
commit 92370560ec
21 changed files with 358 additions and 72 deletions

View File

@@ -5126,8 +5126,16 @@ Apologies for any names omitted.
the showq command was extended to safely list the possibly the showq command was extended to safely list the possibly
world-writable maildrop directory. File: showq/showq.c. world-writable maildrop directory. File: showq/showq.c.
20010504
Feature: postsuper -d will also delete defer and bounce
logfiles when the named queue file is found.
20010505 20010505
RFC 2821 feature: an SMTP server must reset all buffers
upon receipt of EHLO. File: smtpd/smtpd_check.c.
RFC 2821 feature: an SMTP server must accept a recipient RFC 2821 feature: an SMTP server must accept a recipient
address of "postmaster" without domain name. File: address of "postmaster" without domain name. File:
smtpd/smtpd_check.c. smtpd/smtpd_check.c.
@@ -5136,13 +5144,13 @@ Apologies for any names omitted.
after 554 greeting. File: smtpd/smtpd.c. after 554 greeting. File: smtpd/smtpd.c.
RFC 2821 recommendation: if VRFY is enabled, list it in RFC 2821 recommendation: if VRFY is enabled, list it in
the EHLO response. the EHLO response. File: smtpd/smtpd.c.
RFC 2821 recommendation: SMTP clients should use EHLO. RFC 2821 recommendation: SMTP clients should use EHLO.
The default setting of smtp_always_send_ehlo has changed The default setting of smtp_always_send_ehlo has changed
from 0 (send EHLO if server greets with ESMTP) to 1 (always from 0 (send EHLO if server greets with ESMTP) to 1 (always
greet with EHLO). In all cases, Postfix falls back to HELO send EHLO). In all cases, Postfix falls back to HELO if
if the remote host does not support EHLO. the server does not support EHLO. File: smtp/smtp_proto.c.
20010507 20010507
@@ -5158,9 +5166,9 @@ Apologies for any names omitted.
20010520 20010520
Standard: deleted the "via" portion from Received: headers Standard: deleted the non-standard "via" portion from
generated by Postfix bounce or other notification processes. Received: headers generated by Postfix bounce or other
File: global/post_mail.c. notification processes. File: global/post_mail.c.
Robustness: eliminated stack-based recursion from the RFC Robustness: eliminated stack-based recursion from the RFC
822 address parser. File: global/tok822_parse.c. 822 address parser. File: global/tok822_parse.c.
@@ -5168,8 +5176,24 @@ Apologies for any names omitted.
Standard: annotated the source code with comments based on Standard: annotated the source code with comments based on
RFC 2821 and 2822. Not all the changes make sense. RFC 2821 and 2822. Not all the changes make sense.
RFC 2821 recommendation: treat a RCPT 552 reply as if the
server sent 452. Files: smtp/smtp_proto.c, lmtp/lmtp_proto.c.
Cleanup: moved ownership of the debug_peer parameters from Cleanup: moved ownership of the debug_peer parameters from
the applications to the library, so that a Postfix shared the applications to the library, so that a Postfix shared
library does not suffer from undefined references. Files: library does not suffer from undefined references. Files:
smtp/smtp.c, lmtp/lmtp.c, smtpd/smtpd.c, global/mail_params.c. smtp/smtp.c, lmtp/lmtp.c, smtpd/smtpd.c, global/mail_params.c.
LaMont Jones, for Debian. LaMont Jones, for Debian.
20010522
Feature: "postsuper -r queueID" re-queues a message. The
message is moved to the maildrop queue so that the pickup
daemon will copy it to a new file with the "right" name
that matches the queue file inode number, and so that
address rewriting will be done again. This is useful after
changes of address rewriting or virtual mappings.
Feature: "postsuper -R" re-queues all mail. This is useful
after restoring a Postfix queue from another machine, or
from backup.

View File

@@ -1,3 +1,31 @@
Incompatible changes with snapshot-20010522
===========================================
The Postfix SMTP server always sends EHLO at the beginning of an
SMTP session. Specify "smtp_always_send_ehlo = no" for the old
behavior, which is to send EHLO only when the server greeting banner
contains the word ESMTP.
Specifying EHLO in the middle of an SMTP session resets the SMTP
server state just like RSET. This behavior cannot be disabled.
Major changes with snapshot-20010522
====================================
Revision of some fine details in the light of the new RFC 2821 and
RFC 2822 standards. Changes that may affect interoperability are
listed above under "incompatible changes".
The postsuper queue maintenance tool was extended with options to
read queue IDs from standard input (which makes it easier to drive
the tool from scripts).
The postsuper queue maintenance tool has a new -r (requeue) option
for subjecting queue files to another iteration of address rewriting.
The postsuper -R option requeues all mail. This is necessary after
restoring Postfix queues from another machine or from backups.
Major changes with snapshot-20010502 Major changes with snapshot-20010502
==================================== ====================================

View File

@@ -75,6 +75,7 @@ LMTP(8) LMTP(8)
<a href="http://www.faqs.org/rfcs/rfc2033.html">RFC 2033</a> (LMTP protocol) <a href="http://www.faqs.org/rfcs/rfc2033.html">RFC 2033</a> (LMTP protocol)
<a href="http://www.faqs.org/rfcs/rfc2197.html">RFC 2197</a> (Pipelining) <a href="http://www.faqs.org/rfcs/rfc2197.html">RFC 2197</a> (Pipelining)
<a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> (AUTH command) <a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> (AUTH command)
<a href="http://www.faqs.org/rfcs/rfc2821.html">RFC 2821</a> (SMTP protocol)
<b>DIAGNOSTICS</b> <b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8). Cor- Problems and transactions are logged to <b>syslogd</b>(8). Cor-
@@ -124,7 +125,6 @@ LMTP(8) LMTP(8)
<b>Authentication</b> <b>controls</b> <b>Authentication</b> <b>controls</b>
<b>lmtp</b><i>_</i><b>enable</b><i>_</i><b>sasl</b><i>_</i><b>auth</b> <b>lmtp</b><i>_</i><b>enable</b><i>_</i><b>sasl</b><i>_</i><b>auth</b>
Enable per-session authentication as per <a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> Enable per-session authentication as per <a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a>
(SASL). By default, Postfix is built without SASL
@@ -137,6 +137,7 @@ LMTP(8) LMTP(8)
LMTP(8) LMTP(8) LMTP(8) LMTP(8)
(SASL). By default, Postfix is built without SASL
support. support.
<b>lmtp</b><i>_</i><b>sasl</b><i>_</i><b>password</b><i>_</i><b>maps</b> <b>lmtp</b><i>_</i><b>sasl</b><i>_</i><b>password</b><i>_</i><b>maps</b>
@@ -190,7 +191,6 @@ LMTP(8) LMTP(8)
<i>transport_</i><b>destination</b><i>_</i><b>concurrency</b><i>_</i><b>limit</b> <i>transport_</i><b>destination</b><i>_</i><b>concurrency</b><i>_</i><b>limit</b>
Limit the number of parallel deliveries to the same Limit the number of parallel deliveries to the same
destination via this mail delivery transport.
@@ -203,6 +203,7 @@ LMTP(8) LMTP(8)
LMTP(8) LMTP(8) LMTP(8) LMTP(8)
destination via this mail delivery transport.
<i>transport</i> is the name of the service as specified <i>transport</i> is the name of the service as specified
in the <b>master.cf</b> file. The default limit is taken in the <b>master.cf</b> file. The default limit is taken
from the <b>default</b><i>_</i><b>destination</b><i>_</i><b>concurrency</b><i>_</i><b>limit</b> from the <b>default</b><i>_</i><b>destination</b><i>_</i><b>concurrency</b><i>_</i><b>limit</b>
@@ -259,7 +260,6 @@ LMTP(8) LMTP(8)
4 4

View File

@@ -9,13 +9,14 @@ POSTSUPER(1) POSTSUPER(1)
postsuper - Postfix super intendent postsuper - Postfix super intendent
<b>SYNOPSIS</b> <b>SYNOPSIS</b>
<b>postsuper</b> [<b>-d</b> <i>queue_id</i>] [<b>-p</b>] [<b>-s</b>] [<b>-v</b>] [<i>directory</i> <i>...</i>] <b>postsuper</b> [<b>-psv</b>] [<b>-d</b> <i>queue_id</i>] [<b>-r</b> <i>queue_id</i>] [<i>directory</i>
<i>...</i>]
<b>DESCRIPTION</b> <b>DESCRIPTION</b>
The <b>postsuper</b> command does small maintenance jobs. Use of The <b>postsuper</b> command does small maintenance jobs. Use of
the command is restricted to the super-user. the command is restricted to the super-user.
By default, <b>postsuper</b> performs the operations requested By default, <b>postsuper</b> performs the operations requested
with the <b>-s</b> and <b>-p</b> command-line options on the named Post- with the <b>-s</b> and <b>-p</b> command-line options on the named Post-
fix queue directories (default: all). Directory names are fix queue directories (default: all). Directory names are
relative to the Postfix top-level queue directory. relative to the Postfix top-level queue directory.
@@ -23,42 +24,41 @@ POSTSUPER(1) POSTSUPER(1)
Options: Options:
<b>-d</b> This option ignores any <i>directory</i> argument(s). <b>-d</b> This option ignores any <i>directory</i> argument(s).
Delete one message queue file with the named queue Delete one message queue file with the named queue
ID. Specify multiple <b>-d</b> options to delete multiple ID. Specify multiple <b>-d</b> options to delete multiple
queue files by name. queue files by name.
Alternatively, if a <i>queue_id</i> of <b>-</b> is specified, the Alternatively, if a <i>queue_id</i> of <b>-</b> is specified, the
program reads queue IDs from standard input. program reads queue IDs from standard input.
The <b>postsuper</b> exit status is non-zero when no mes- The <b>postsuper</b> exit status is non-zero when no mes-
sage queue file was deleted. sage queue file was deleted.
<b>There</b> <b>is</b> <b>a</b> <b>very</b> <b>small</b> <b>possibility</b> <b>that</b> <b>postsuper</b> <b>There</b> <b>is</b> <b>a</b> <b>very</b> <b>small</b> <b>possibility</b> <b>that</b> <b>postsuper</b>
<b>deletes</b> <b>the</b> <b>wrong</b> <b>message</b> <b>file</b> <b>when</b> <b>it</b> <b>is</b> <b>executed</b> <b>deletes</b> <b>the</b> <b>wrong</b> <b>message</b> <b>file</b> <b>when</b> <b>it</b> <b>is</b> <b>executed</b>
<b>while</b> <b>the</b> <b>Postfix</b> <b>mail</b> <b>system</b> <b>is</b> <b>running.</b> <b>while</b> <b>the</b> <b>Postfix</b> <b>mail</b> <b>system</b> <b>is</b> <b>running.</b>
The scenario is as follows: The scenario is as follows:
<b>o</b> The Postfix queue manager deletes the file <b>o</b> The Postfix queue manager deletes the file
that <b>postsuper</b> was supposed to delete, that <b>postsuper</b> was supposed to delete,
because Postfix was finished with the mes- because Postfix was finished with the mes-
sage. sage.
<b>o</b> New mail arrives, and the new message is <b>o</b> New mail arrives, and the new message is
given the same queue ID as the message that given the same queue ID as the message that
<b>postsuper</b> was supposed to delete. The prob- <b>postsuper</b> was supposed to delete. The prob-
ability for reusing a deleted queue ID is ability for reusing a deleted queue ID is
about 1 in 2**15 (the number of different about 1 in 2**15 (the number of different
microsecond values that the system clock can microsecond values that the system clock can
distinguish). distinguish within a second).
<b>o</b> <b>postsuper</b> deletes the new message file, <b>o</b> <b>postsuper</b> deletes the new message file,
instead of the old file that should have instead of the old file that should have
been deleted. been deleted.
<b>-s</b> Structure check. Move queue files that are in the <b>-r</b> This option ignores any <i>directory</i> argument(s).
wrong place in the file system hierarchy and remove Requeue one message queue file with the named queue
subdirectories that are no longer needed. File
@@ -71,6 +71,26 @@ POSTSUPER(1) POSTSUPER(1)
POSTSUPER(1) POSTSUPER(1) POSTSUPER(1) POSTSUPER(1)
ID. Specify multiple <b>-r</b> options to requeue multi-
ple queue files by name.
Alternatively, if a <i>queue_id</i> of <b>-</b> is specified, the
program reads queue IDs from standard input.
The queue file is moved to the maildrop queue, from
where it is copied by the pickup daemon to a new
file whose name is guaranteed to match the queue
file inode number. This feature is useful for queue
files from another machine or for files restored
from backup. The new queue file is subjected again
to address rewriting and substitution.
The <b>postsuper</b> exit status is non-zero when no mes-
sage queue file was requeued.
<b>-s</b> Structure check. Move queue files that are in the
wrong place in the file system hierarchy and remove
subdirectories that are no longer needed. File
rearrangements are necessary after a change in the rearrangements are necessary after a change in the
<b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b> and/or <b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b> configura- <b>hash</b><i>_</i><b>queue</b><i>_</i><b>names</b> and/or <b>hash</b><i>_</i><b>queue</b><i>_</i><b>depth</b> configura-
tion parameters. It is highly recommended to run tion parameters. It is highly recommended to run
@@ -105,6 +125,18 @@ POSTSUPER(1) POSTSUPER(1)
<b>AUTHOR(S)</b> <b>AUTHOR(S)</b>
Wietse Venema Wietse Venema
IBM T.J. Watson Research IBM T.J. Watson Research
2
POSTSUPER(1) POSTSUPER(1)
P.O. Box 704 P.O. Box 704
Yorktown Heights, NY 10598, USA Yorktown Heights, NY 10598, USA
@@ -128,7 +160,41 @@ POSTSUPER(1) POSTSUPER(1)
2
3
</pre> </body> </html> </pre> </body> </html>

View File

@@ -50,6 +50,7 @@ SMTP(8) SMTP(8)
<a href="http://www.faqs.org/rfcs/rfc1870.html">RFC 1870</a> (Message Size Declaration) <a href="http://www.faqs.org/rfcs/rfc1870.html">RFC 1870</a> (Message Size Declaration)
<a href="http://www.faqs.org/rfcs/rfc2197.html">RFC 2197</a> (Pipelining) <a href="http://www.faqs.org/rfcs/rfc2197.html">RFC 2197</a> (Pipelining)
<a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> (AUTH command) <a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> (AUTH command)
<a href="http://www.faqs.org/rfcs/rfc2821.html">RFC 2821</a> (SMTP protocol)
<b>DIAGNOSTICS</b> <b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8). Cor- Problems and transactions are logged to <b>syslogd</b>(8). Cor-
@@ -58,7 +59,6 @@ SMTP(8) SMTP(8)
Depending on the setting of the <b>notify</b><i>_</i><b>classes</b> parameter, Depending on the setting of the <b>notify</b><i>_</i><b>classes</b> parameter,
the postmaster is notified of bounces, protocol problems, the postmaster is notified of bounces, protocol problems,
and of other trouble.
@@ -71,6 +71,8 @@ SMTP(8) SMTP(8)
SMTP(8) SMTP(8) SMTP(8) SMTP(8)
and of other trouble.
<b>BUGS</b> <b>BUGS</b>
<b>CONFIGURATION</b> <b>PARAMETERS</b> <b>CONFIGURATION</b> <b>PARAMETERS</b>
The following <b>main.cf</b> parameters are especially relevant The following <b>main.cf</b> parameters are especially relevant
@@ -126,8 +128,6 @@ SMTP(8) SMTP(8)
2 2

View File

@@ -44,6 +44,7 @@ SMTPD(8) SMTPD(8)
<a href="http://www.faqs.org/rfcs/rfc1870.html">RFC 1870</a> (Message Size Declaration) <a href="http://www.faqs.org/rfcs/rfc1870.html">RFC 1870</a> (Message Size Declaration)
<a href="http://www.faqs.org/rfcs/rfc1985.html">RFC 1985</a> (ETRN command) <a href="http://www.faqs.org/rfcs/rfc1985.html">RFC 1985</a> (ETRN command)
<a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> (AUTH command) <a href="http://www.faqs.org/rfcs/rfc2554.html">RFC 2554</a> (AUTH command)
<a href="http://www.faqs.org/rfcs/rfc2821.html">RFC 2821</a> (SMTP protocol)
<b>DIAGNOSTICS</b> <b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8). Problems and transactions are logged to <b>syslogd</b>(8).
@@ -61,7 +62,6 @@ SMTPD(8) SMTPD(8)
1 1

View File

@@ -9,8 +9,8 @@ Postfix super intendent
.na .na
.nf .nf
.fi .fi
\fBpostsuper\fR [\fB-d \fIqueue_id\fR] [\fB-p\fR] \fBpostsuper\fR [\fB-psv\fR] [\fB-d \fIqueue_id\fR]
[\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR] [\fB-r \fIqueue_id\fR] [\fIdirectory ...\fR]
.SH DESCRIPTION .SH DESCRIPTION
.ad .ad
.fi .fi
@@ -51,11 +51,28 @@ New mail arrives, and the new message is given the same queue ID
as the message that \fBpostsuper\fR was supposed to delete. as the message that \fBpostsuper\fR was supposed to delete.
The probability for reusing a deleted queue ID is about 1 in 2**15 The probability for reusing a deleted queue ID is about 1 in 2**15
(the number of different microsecond values that the system clock (the number of different microsecond values that the system clock
can distinguish). can distinguish within a second).
.IP \(bu .IP \(bu
\fBpostsuper\fR deletes the new message file, instead of the \fBpostsuper\fR deletes the new message file, instead of the
old file that should have been deleted. old file that should have been deleted.
.RE .RE
.IP \fB-r \fIqueue_id\fR
This option ignores any \fIdirectory\fR argument(s).
Requeue one message queue file with the named queue ID. Specify
multiple \fB-r\fR options to requeue multiple queue files by name.
.sp
Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified, the
program reads queue IDs from standard input.
.sp
The queue file is moved to the maildrop queue, from where
it is copied by the pickup daemon to a new file whose name
is guaranteed to match the queue file inode number. This
feature is useful for queue files from another machine or
for files restored from backup. The new queue file is
subjected again to address rewriting and substitution.
.sp
The \fBpostsuper\fR exit status is non-zero when no message queue
file was requeued.
.IP \fB-s\fR .IP \fB-s\fR
Structure check. Move queue files that are in the wrong place Structure check. Move queue files that are in the wrong place
in the file system hierarchy and remove subdirectories that are in the file system hierarchy and remove subdirectories that are

View File

@@ -60,6 +60,7 @@ RFC 1870 (Message Size Declaration)
RFC 2033 (LMTP protocol) RFC 2033 (LMTP protocol)
RFC 2197 (Pipelining) RFC 2197 (Pipelining)
RFC 2554 (AUTH command) RFC 2554 (AUTH command)
RFC 2821 (SMTP protocol)
.SH DIAGNOSTICS .SH DIAGNOSTICS
.ad .ad
.fi .fi

View File

@@ -51,6 +51,7 @@ RFC 1651 (SMTP service extensions)
RFC 1870 (Message Size Declaration) RFC 1870 (Message Size Declaration)
RFC 2197 (Pipelining) RFC 2197 (Pipelining)
RFC 2554 (AUTH command) RFC 2554 (AUTH command)
RFC 2821 (SMTP protocol)
.SH DIAGNOSTICS .SH DIAGNOSTICS
.ad .ad
.fi .fi

View File

@@ -48,6 +48,7 @@ RFC 1854 (SMTP Pipelining)
RFC 1870 (Message Size Declaration) RFC 1870 (Message Size Declaration)
RFC 1985 (ETRN command) RFC 1985 (ETRN command)
RFC 2554 (AUTH command) RFC 2554 (AUTH command)
RFC 2821 (SMTP protocol)
.SH DIAGNOSTICS .SH DIAGNOSTICS
.ad .ad
.fi .fi

View File

@@ -388,6 +388,11 @@ VSTREAM *mail_queue_enter(const char *queue_name, int mode)
for (count = 0;; count++) { for (count = 0;; count++) {
vstring_sprintf(id_buf, "%05X%s", (int) tv.tv_usec, file_id); vstring_sprintf(id_buf, "%05X%s", (int) tv.tv_usec, file_id);
mail_queue_path(path_buf, queue_name, STR(id_buf)); mail_queue_path(path_buf, queue_name, STR(id_buf));
if (access(STR(path_buf), X_OK) == 0) { /* collision. */
if ((int) ++tv.tv_usec < 0)
tv.tv_usec = 0;
continue;
}
if (sane_rename(STR(temp_path), STR(path_buf)) == 0) /* success */ if (sane_rename(STR(temp_path), STR(path_buf)) == 0) /* success */
break; break;
if (errno == EPERM || errno == EISDIR) {/* collision. weird. */ if (errno == EPERM || errno == EISDIR) {/* collision. weird. */

View File

@@ -15,7 +15,7 @@
* Version of this program. * Version of this program.
*/ */
#define VAR_MAIL_VERSION "mail_version" #define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-20010521" #define DEF_MAIL_VERSION "Snapshot-20010522"
extern char *var_mail_version; extern char *var_mail_version;
/* LICENSE /* LICENSE

View File

@@ -467,7 +467,8 @@ static const char *tok822_comment(TOK822 *tp, const char *str)
/* /*
* XXX We cheat by storing comments in their external form. Otherwise it * XXX We cheat by storing comments in their external form. Otherwise it
* would be a royal pain to preserve \ before (. That would require a * would be a royal pain to preserve \ before (. That would require a
* recursive parser, which could consume unreasonable amounts of memory. * recursive parser; the easy to implement stack-based recursion would be
* too expensive.
*/ */
VSTRING_ADDCH(tp->vstr, '('); VSTRING_ADDCH(tp->vstr, '(');

View File

@@ -50,6 +50,7 @@
/* RFC 2033 (LMTP protocol) /* RFC 2033 (LMTP protocol)
/* RFC 2197 (Pipelining) /* RFC 2197 (Pipelining)
/* RFC 2554 (AUTH command) /* RFC 2554 (AUTH command)
/* RFC 2821 (SMTP protocol)
/* DIAGNOSTICS /* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8). /* Problems and transactions are logged to \fBsyslogd\fR(8).
/* Corrupted message files are marked so that the queue manager can /* Corrupted message files are marked so that the queue manager can

View File

@@ -61,7 +61,7 @@ typedef struct LMTP_STATE {
#define LMTP_FEATURE_8BITMIME (1<<1) #define LMTP_FEATURE_8BITMIME (1<<1)
#define LMTP_FEATURE_PIPELINING (1<<2) #define LMTP_FEATURE_PIPELINING (1<<2)
#define LMTP_FEATURE_SIZE (1<<3) #define LMTP_FEATURE_SIZE (1<<3)
#define SMTP_FEATURE_AUTH (1<<5) #define LMTP_FEATURE_AUTH (1<<5)
/* /*
* lmtp.c * lmtp.c

View File

@@ -215,7 +215,7 @@ int lmtp_lhlo(LMTP_STATE *state)
lines = resp->str; lines = resp->str;
(void) mystrtok(&lines, "\n"); (void) mystrtok(&lines, "\n");
while ((words = mystrtok(&lines, "\n")) != 0) { while ((words = mystrtok(&lines, "\n")) != 0) {
if (mystrtok(&words, "- ") && (word = mystrtok(&words, " \t")) != 0) { if (mystrtok(&words, "- ") && (word = mystrtok(&words, " \t=")) != 0) {
if (strcasecmp(word, "8BITMIME") == 0) if (strcasecmp(word, "8BITMIME") == 0)
state->features |= LMTP_FEATURE_8BITMIME; state->features |= LMTP_FEATURE_8BITMIME;
else if (strcasecmp(word, "PIPELINING") == 0) else if (strcasecmp(word, "PIPELINING") == 0)
@@ -232,7 +232,7 @@ int lmtp_lhlo(LMTP_STATE *state)
msg_info("server features: 0x%x", state->features); msg_info("server features: 0x%x", state->features);
#ifdef USE_SASL_AUTH #ifdef USE_SASL_AUTH
if (var_lmtp_sasl_enable && (state->features & SMTP_FEATURE_AUTH)) if (var_lmtp_sasl_enable && (state->features & LMTP_FEATURE_AUTH))
return (lmtp_sasl_helo_login(state)); return (lmtp_sasl_helo_login(state));
#endif #endif
@@ -483,9 +483,16 @@ static int lmtp_loop(LMTP_STATE *state, int send_state, int recv_state)
* rejected, ignore RCPT TO responses: all recipients are * rejected, ignore RCPT TO responses: all recipients are
* dead already. When all recipients are rejected the * dead already. When all recipients are rejected the
* receiver may apply a course correction. * receiver may apply a course correction.
*
* XXX 2821: Section 4.5.3.1 says that a 552 RCPT TO reply
* must be treated as if the server replied with 452.
*/ */
case LMTP_STATE_RCPT: case LMTP_STATE_RCPT:
if (!mail_from_rejected) { if (!mail_from_rejected) {
#ifndef RFC821_SYNTAX
if (resp->code == 552)
resp->code = 452;
#endif
rcpt = request->rcpt_list.info + recv_rcpt; rcpt = request->rcpt_list.info + recv_rcpt;
if (resp->code / 100 == 2) { if (resp->code / 100 == 2) {
if (survivors == 0) if (survivors == 0)

View File

@@ -14,14 +14,14 @@
/* LMTP_STATE *state; /* LMTP_STATE *state;
/* DESCRIPTION /* DESCRIPTION
/* This module contains random chunks of code that implement /* This module contains random chunks of code that implement
/* the SMTP protocol interface for SASL negotiation. The goal /* the LMTP protocol interface for SASL negotiation. The goal
/* is to reduce clutter in the main LMTP client source code. /* is to reduce clutter in the main LMTP client source code.
/* /*
/* lmtp_sasl_helo_auth() processes the AUTH option in the /* lmtp_sasl_helo_auth() processes the AUTH option in the
/* SMTP server's EHLO response. /* LMTP server's LHLO response.
/* /*
/* lmtp_sasl_helo_login() authenticates the LMTP client to the /* lmtp_sasl_helo_login() authenticates the LMTP client to the
/* SMTP server, using the authentication mechanism information /* LMTP server, using the authentication mechanism information
/* given by the server. The result is a Postfix delivery status /* given by the server. The result is a Postfix delivery status
/* code in case of trouble. /* code in case of trouble.
/* /*
@@ -52,6 +52,10 @@
/* System library. */ /* System library. */
#include <sys_defs.h> #include <sys_defs.h>
#include <string.h>
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
#endif
/* Utility library. */ /* Utility library. */
@@ -79,15 +83,17 @@ void lmtp_sasl_helo_auth(LMTP_STATE *state, const char *words)
* then pretend that the server doesn't support SASL authentication. * then pretend that the server doesn't support SASL authentication.
*/ */
if (state->sasl_mechanism_list) { if (state->sasl_mechanism_list) {
if (strcasecmp(state->sasl_mechanism_list, words) == 0)
return;
myfree(state->sasl_mechanism_list); myfree(state->sasl_mechanism_list);
msg_warn("%s offered AUTH option multiple times", msg_warn("%s offered AUTH option multiple times",
state->session->namaddr); state->session->namaddr);
state->sasl_mechanism_list = 0; state->sasl_mechanism_list = 0;
state->features &= ~SMTP_FEATURE_AUTH; state->features &= ~LMTP_FEATURE_AUTH;
} }
if (strlen(words) > 0) { if (strlen(words) > 0) {
state->sasl_mechanism_list = mystrdup(words); state->sasl_mechanism_list = mystrdup(words);
state->features |= SMTP_FEATURE_AUTH; state->features |= LMTP_FEATURE_AUTH;
} else { } else {
msg_warn("%s offered null AUTH mechanism list", msg_warn("%s offered null AUTH mechanism list",
state->session->namaddr); state->session->namaddr);

View File

@@ -5,8 +5,8 @@
/* Postfix super intendent /* Postfix super intendent
/* SYNOPSIS /* SYNOPSIS
/* .fi /* .fi
/* \fBpostsuper\fR [\fB-d \fIqueue_id\fR] [\fB-p\fR] /* \fBpostsuper\fR [\fB-Rpsv\fR] [\fB-d \fIqueue_id\fR]
/* [\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR] /* [\fB-r \fIqueue_id\fR] [\fIdirectory ...\fR]
/* DESCRIPTION /* DESCRIPTION
/* The \fBpostsuper\fR command does small maintenance jobs. Use of /* The \fBpostsuper\fR command does small maintenance jobs. Use of
/* the command is restricted to the super-user. /* the command is restricted to the super-user.
@@ -29,9 +29,9 @@
/* file was deleted. /* file was deleted.
/* .sp /* .sp
/* .ft B /* .ft B
/* There is a very small possibility that postsuper deletes the /* There is a very small possibility that postsuper deletes the
/* wrong message file when it is executed while the Postfix mail /* wrong message file when it is executed while the Postfix mail
/* system is running. /* system is running.
/* .ft R /* .ft R
/* .sp /* .sp
/* The scenario is as follows: /* The scenario is as follows:
@@ -50,6 +50,34 @@
/* \fBpostsuper\fR deletes the new message file, instead of the /* \fBpostsuper\fR deletes the new message file, instead of the
/* old file that should have been deleted. /* old file that should have been deleted.
/* .RE /* .RE
/* .IP \fB-R\fR
/* This option ignores any \fIdirectory\fR argument(s).
/* Requeue all message queue files. This option is useful for
/* restoring a Postfix queue from another machine or from backup.
/* .sp
/* Each queue file is moved to the maildrop queue, from where
/* it is copied by the pickup daemon to a new file whose name
/* is guaranteed to match the queue file inode number. The
/* new queue file is subjected again to address rewriting and
/* substitution. This is useful when rewriting rules or virtual
/* mappings have changed.
/* .IP \fB-r \fIqueue_id\fR
/* This option ignores any \fIdirectory\fR argument(s).
/* Requeue one message queue file with the named queue ID. Specify
/* multiple \fB-r\fR options to requeue multiple queue files by name.
/* .sp
/* Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified, the
/* program reads queue IDs from standard input.
/* .sp
/* The queue file is moved to the maildrop queue, from where
/* it is copied by the pickup daemon to a new file whose name
/* is guaranteed to match the queue file inode number. The
/* new queue file is subjected again to address rewriting and
/* substitution. This is useful when rewriting rules or virtual
/* mappings have changed.
/* .sp
/* The \fBpostsuper\fR exit status is non-zero when no message queue
/* file was requeued.
/* .IP \fB-s\fR /* .IP \fB-s\fR
/* Structure check. Move queue files that are in the wrong place /* Structure check. Move queue files that are in the wrong place
/* in the file system hierarchy and remove subdirectories that are /* in the file system hierarchy and remove subdirectories that are
@@ -110,6 +138,7 @@
#include <set_ugid.h> #include <set_ugid.h>
#include <argv.h> #include <argv.h>
#include <vstring_vstream.h> #include <vstring_vstream.h>
#include <sane_fsops.h>
/* Global library. */ /* Global library. */
@@ -127,6 +156,8 @@
#define ACTION_STRUCT (1<<0) /* fix file organization */ #define ACTION_STRUCT (1<<0) /* fix file organization */
#define ACTION_PURGE (1<<1) /* purge old temp files */ #define ACTION_PURGE (1<<1) /* purge old temp files */
#define ACTION_DELETE (1<<2) /* delete named queue file(s) */ #define ACTION_DELETE (1<<2) /* delete named queue file(s) */
#define ACTION_REQUEUE (1<<3) /* requeue named queue file(s) */
#define ACTION_REQUEUE_ALL (1<<4) /* requeue all queue file(s) */
#define ACTION_DEFAULT (ACTION_STRUCT | ACTION_PURGE) #define ACTION_DEFAULT (ACTION_STRUCT | ACTION_PURGE)
@@ -173,6 +204,22 @@ static int postunlink(const char *path)
return (ret); return (ret);
} }
/* postrename - rename file with prejudice */
static int postrename(const char *old, const char *new)
{
int ret;
if ((ret = sane_rename(old, new)) == 0) {
msg_info("requeued file %s as %s", old, new);
} else if (errno != ENOENT) {
msg_warn("requeue file %s as %s: %m", old, new);
} else if (msg_verbose) {
msg_info("requeue file %s as %s: %m", old, new);
}
return (ret);
}
/* delete_one - delete one message instance and all its associated files */ /* delete_one - delete one message instance and all its associated files */
static int delete_one(const char *queue_id) static int delete_one(const char *queue_id)
@@ -218,15 +265,51 @@ static int delete_one(const char *queue_id)
return (found); return (found);
} }
/* delete_stream - delete queue IDs given on stream */ /* requeue_one - requeue one message instance and delete its logfiles */
static int delete_stream(VSTREAM *fp) static int requeue_one(const char *queue_id)
{
const char *msg_queue_names[] = {
MAIL_QUEUE_INCOMING, /* twice, to avoid */
MAIL_QUEUE_ACTIVE, /* missing a file while */
MAIL_QUEUE_DEFERRED, /* it is being renamed */
MAIL_QUEUE_INCOMING, /* this is not 100% */
MAIL_QUEUE_ACTIVE, /* foolproof but adequate */
0,
};
struct stat st;
const char **msg_qpp;
const char *old_path;
VSTRING *new_path_buf = vstring_alloc(100);
int found = 0;
/*
* Do not delete defer or bounce logfiles, to avoid losing a race where
* the queue manager decides to bounce mail after all recipients have
* been tried.
*/
for (msg_qpp = msg_queue_names; *msg_qpp != 0; msg_qpp++) {
if (mail_open_ok(*msg_qpp, queue_id, &st, &old_path) != MAIL_OPEN_YES)
continue;
(void) mail_queue_path(new_path_buf, MAIL_QUEUE_MAILDROP, queue_id);
if (postrename(old_path, STR(new_path_buf)) == 0) {
found = 1;
break;
} /* else: lost a race */
}
vstring_free(new_path_buf);
return (found);
}
/* operate_stream - operate on queue IDs given on stream */
static int operate_stream(VSTREAM *fp, int (*operator) (const char *))
{ {
VSTRING *buf = vstring_alloc(20); VSTRING *buf = vstring_alloc(20);
int found = 0; int found = 0;
while (vstring_get_nonl(buf, fp) != VSTREAM_EOF) while (vstring_get_nonl(buf, fp) != VSTREAM_EOF)
found |= delete_one(STR(buf)); found |= operator(STR(buf));
vstring_free(buf); vstring_free(buf);
return (found); return (found);
@@ -354,6 +437,30 @@ static void super(char **queues, int action)
if (mail_queue_id_ok(path) == 0) if (mail_queue_id_ok(path) == 0)
continue; continue;
/*
* Requeue this message. This means the pickup daemon will copy
* it to a new queue file, and that address rewriting is applied
* again. XXX Share more code with requeue_one(). Note, that this
* option is intended for large-scale mail queue restore
* operations so that at this stage, the queue file may not even
* be in the "right" place for the current machine. We therefore
* cannot rely on the mail_queue(3) API.()
*/
if ((action & ACTION_REQUEUE_ALL)
&& strcmp(queue_name, MAIL_QUEUE_MAILDROP) != 0) {
(void) mail_queue_path(wanted_path, MAIL_QUEUE_MAILDROP, path);
if (rename(STR(actual_path), STR(wanted_path)) < 0) {
if (errno != ENOENT)
msg_fatal("rename %s to %s: %m", STR(actual_path),
STR(wanted_path));
} else {
if (msg_verbose)
msg_info("rename %s to %s", STR(actual_path),
STR(wanted_path));
}
continue;
}
/* /*
* See if this file sits in the right place in the file system * See if this file sits in the right place in the file system
* hierarchy. Its place may be wrong after a change to the * hierarchy. Its place may be wrong after a change to the
@@ -364,17 +471,19 @@ static void super(char **queues, int action)
* to do everything with the postfix owner privileges regardless, * to do everything with the postfix owner privileges regardless,
* in order to limit the amount of damage that we can do. * in order to limit the amount of damage that we can do.
*/ */
(void) mail_queue_path(wanted_path, queue_name, path); if (action & ACTION_STRUCT) {
if (strcmp(STR(actual_path), STR(wanted_path)) != 0) { (void) mail_queue_path(wanted_path, queue_name, path);
if (rename(STR(actual_path), STR(wanted_path)) < 0) if (strcmp(STR(actual_path), STR(wanted_path)) != 0) {
if (errno != ENOENT if (rename(STR(actual_path), STR(wanted_path)) < 0)
|| mail_queue_mkdirs(STR(wanted_path)) < 0 if (errno != ENOENT
|| rename(STR(actual_path), STR(wanted_path)) < 0) || mail_queue_mkdirs(STR(wanted_path)) < 0
msg_fatal("rename %s to %s: %m", STR(actual_path), || rename(STR(actual_path), STR(wanted_path)) < 0)
STR(wanted_path)); msg_fatal("rename %s to %s: %m", STR(actual_path),
if (msg_verbose) STR(wanted_path));
msg_info("rename %s to %s", STR(actual_path), if (msg_verbose)
STR(wanted_path)); msg_info("rename %s to %s", STR(actual_path),
STR(wanted_path));
}
} }
} }
scan_dir_close(info); scan_dir_close(info);
@@ -473,21 +582,31 @@ int main(int argc, char **argv)
while ((c = GETOPT(argc, argv, "d:spv")) > 0) { while ((c = GETOPT(argc, argv, "d:spv")) > 0) {
switch (c) { switch (c) {
default: default:
msg_fatal("usage: %s [-d queue_id] [-p (purge stale files)] [-s (fix structure)]", msg_fatal("usage: %s [-d queue_id (delete message)] [-p (purge stale files)] [-r queue_id (requeue message)] [-R (requeue all)] [-s (fix structure)]",
argv[0]); argv[0]);
case 'd': case 'd':
if (strcmp(optarg, "-") == 0) if (strcmp(optarg, "-") == 0)
found |= delete_stream(VSTREAM_IN); found |= operate_stream(VSTREAM_IN, delete_one);
else else
found |= delete_one(optarg); found |= delete_one(optarg);
action |= ACTION_DELETE; action |= ACTION_DELETE;
break; break;
case 's':
action |= ACTION_STRUCT;
break;
case 'p': case 'p':
action |= ACTION_PURGE; action |= ACTION_PURGE;
break; break;
case 'r':
if (strcmp(optarg, "-") == 0)
found |= operate_stream(VSTREAM_IN, requeue_one);
else
found |= requeue_one(optarg);
action |= ACTION_REQUEUE;
break;
case 'R':
action |= ACTION_REQUEUE_ALL;
break;
case 's':
action |= ACTION_STRUCT;
break;
case 'v': case 'v':
msg_verbose++; msg_verbose++;
break; break;
@@ -505,8 +624,9 @@ int main(int argc, char **argv)
else else
queues = argv + optind; queues = argv + optind;
if (action & ~ACTION_DELETE) #define ACTIONS_ON_THE_FLY (ACTION_DELETE | ACTION_REQUEUE)
super(queues, action & ~ACTION_DELETE);
exit((action & ACTION_DELETE) ? !found : 0); if (action & ~ACTIONS_ON_THE_FLY)
super(queues, action & ~ACTIONS_ON_THE_FLY);
exit((action & ACTIONS_ON_THE_FLY) ? !found : 0);
} }

View File

@@ -41,6 +41,7 @@
/* RFC 1870 (Message Size Declaration) /* RFC 1870 (Message Size Declaration)
/* RFC 2197 (Pipelining) /* RFC 2197 (Pipelining)
/* RFC 2554 (AUTH command) /* RFC 2554 (AUTH command)
/* RFC 2821 (SMTP protocol)
/* DIAGNOSTICS /* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8). /* Problems and transactions are logged to \fBsyslogd\fR(8).
/* Corrupted message files are marked so that the queue manager can /* Corrupted message files are marked so that the queue manager can

View File

@@ -52,6 +52,10 @@
/* System library. */ /* System library. */
#include <sys_defs.h> #include <sys_defs.h>
#include <string.h>
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
#endif
/* Utility library. */ /* Utility library. */
@@ -79,6 +83,8 @@ void smtp_sasl_helo_auth(SMTP_STATE *state, const char *words)
* then pretend that the server doesn't support SASL authentication. * then pretend that the server doesn't support SASL authentication.
*/ */
if (state->sasl_mechanism_list) { if (state->sasl_mechanism_list) {
if (strcasecmp(state->sasl_mechanism_list, words) == 0)
return;
myfree(state->sasl_mechanism_list); myfree(state->sasl_mechanism_list);
msg_warn("%s offered AUTH option multiple times", msg_warn("%s offered AUTH option multiple times",
state->session->namaddr); state->session->namaddr);

View File

@@ -38,6 +38,7 @@
/* RFC 1870 (Message Size Declaration) /* RFC 1870 (Message Size Declaration)
/* RFC 1985 (ETRN command) /* RFC 1985 (ETRN command)
/* RFC 2554 (AUTH command) /* RFC 2554 (AUTH command)
/* RFC 2821 (SMTP protocol)
/* DIAGNOSTICS /* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8). /* Problems and transactions are logged to \fBsyslogd\fR(8).
/* /*