the showq command was extended to safely list the possibly
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
+ 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
address of "postmaster" without domain name. File:
smtpd/smtpd_check.c.
after 554 greeting. File: smtpd/smtpd.c.
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.
The default setting of smtp_always_send_ehlo has changed
from 0 (send EHLO if server greets with ESMTP) to 1 (always
- greet with EHLO). In all cases, Postfix falls back to HELO
- if the remote host does not support EHLO.
+ send EHLO). In all cases, Postfix falls back to HELO if
+ the server does not support EHLO. File: smtp/smtp_proto.c.
20010507
20010520
- Standard: deleted the "via" portion from Received: headers
- generated by Postfix bounce or other notification processes.
- File: global/post_mail.c.
+ Standard: deleted the non-standard "via" portion from
+ Received: headers generated by Postfix bounce or other
+ notification processes. File: global/post_mail.c.
Robustness: eliminated stack-based recursion from the RFC
822 address parser. File: global/tok822_parse.c.
Standard: annotated the source code with comments based on
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
the applications to the library, so that a Postfix shared
library does not suffer from undefined references. Files:
smtp/smtp.c, lmtp/lmtp.c, smtpd/smtpd.c, global/mail_params.c.
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.
+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
====================================
<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/rfc2554.html">RFC 2554</a> (AUTH command)
+ <a href="http://www.faqs.org/rfcs/rfc2821.html">RFC 2821</a> (SMTP protocol)
<b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8). Cor-
<b>Authentication</b> <b>controls</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>
- (SASL). By default, Postfix is built without SASL
LMTP(8) LMTP(8)
+ (SASL). By default, Postfix is built without SASL
support.
<b>lmtp</b><i>_</i><b>sasl</b><i>_</i><b>password</b><i>_</i><b>maps</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
- destination via this mail delivery transport.
LMTP(8) LMTP(8)
+ destination via this mail delivery transport.
<i>transport</i> is the name of the service as specified
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>
-
4
postsuper - Postfix super intendent
<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>
- 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.
- 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-
fix queue directories (default: all). Directory names are
relative to the Postfix top-level queue directory.
Options:
<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
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 <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.
- <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>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>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:
- <b>o</b> The Postfix queue manager deletes the file
- that <b>postsuper</b> was supposed to delete,
- because Postfix was finished with the mes-
+ <b>o</b> The Postfix queue manager deletes the file
+ that <b>postsuper</b> was supposed to delete,
+ because Postfix was finished with the mes-
sage.
- <b>o</b> New mail arrives, and the new message is
- given the same queue ID as the message that
+ <b>o</b> New mail arrives, and the new message is
+ given the same queue ID as the message that
<b>postsuper</b> was supposed to delete. The prob-
- ability for reusing a deleted queue ID is
- about 1 in 2**15 (the number of different
+ ability for reusing a deleted queue ID is
+ about 1 in 2**15 (the number of different
microsecond values that the system clock can
- distinguish).
+ distinguish within a second).
<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.
- <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
+ <b>-r</b> This option ignores any <i>directory</i> argument(s).
+ Requeue one message queue file with the named queue
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
<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
<b>AUTHOR(S)</b>
Wietse Venema
IBM T.J. Watson Research
+
+
+
+ 2
+
+
+
+
+
+POSTSUPER(1) POSTSUPER(1)
+
+
P.O. Box 704
Yorktown Heights, NY 10598, USA
- 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3
</pre> </body> </html>
<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/rfc2554.html">RFC 2554</a> (AUTH command)
+ <a href="http://www.faqs.org/rfcs/rfc2821.html">RFC 2821</a> (SMTP protocol)
<b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8). Cor-
Depending on the setting of the <b>notify</b><i>_</i><b>classes</b> parameter,
the postmaster is notified of bounces, protocol problems,
- and of other trouble.
SMTP(8) SMTP(8)
+ and of other trouble.
+
<b>BUGS</b>
<b>CONFIGURATION</b> <b>PARAMETERS</b>
The following <b>main.cf</b> parameters are especially relevant
-
-
2
<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/rfc2554.html">RFC 2554</a> (AUTH command)
+ <a href="http://www.faqs.org/rfcs/rfc2821.html">RFC 2821</a> (SMTP protocol)
<b>DIAGNOSTICS</b>
Problems and transactions are logged to <b>syslogd</b>(8).
-
1
.na
.nf
.fi
-\fBpostsuper\fR [\fB-d \fIqueue_id\fR] [\fB-p\fR]
-[\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR]
+\fBpostsuper\fR [\fB-psv\fR] [\fB-d \fIqueue_id\fR]
+[\fB-r \fIqueue_id\fR] [\fIdirectory ...\fR]
.SH DESCRIPTION
.ad
.fi
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 number of different microsecond values that the system clock
-can distinguish).
+can distinguish within a second).
.IP \(bu
\fBpostsuper\fR deletes the new message file, instead of the
old file that should have been deleted.
.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
Structure check. Move queue files that are in the wrong place
in the file system hierarchy and remove subdirectories that are
RFC 2033 (LMTP protocol)
RFC 2197 (Pipelining)
RFC 2554 (AUTH command)
+RFC 2821 (SMTP protocol)
.SH DIAGNOSTICS
.ad
.fi
RFC 1870 (Message Size Declaration)
RFC 2197 (Pipelining)
RFC 2554 (AUTH command)
+RFC 2821 (SMTP protocol)
.SH DIAGNOSTICS
.ad
.fi
RFC 1870 (Message Size Declaration)
RFC 1985 (ETRN command)
RFC 2554 (AUTH command)
+RFC 2821 (SMTP protocol)
.SH DIAGNOSTICS
.ad
.fi
for (count = 0;; count++) {
vstring_sprintf(id_buf, "%05X%s", (int) tv.tv_usec, file_id);
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 */
break;
if (errno == EPERM || errno == EISDIR) {/* collision. weird. */
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "Snapshot-20010521"
+#define DEF_MAIL_VERSION "Snapshot-20010522"
extern char *var_mail_version;
/* LICENSE
/*
* XXX We cheat by storing comments in their external form. Otherwise it
* 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, '(');
/* RFC 2033 (LMTP protocol)
/* RFC 2197 (Pipelining)
/* RFC 2554 (AUTH command)
+/* RFC 2821 (SMTP protocol)
/* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8).
/* Corrupted message files are marked so that the queue manager can
#define LMTP_FEATURE_8BITMIME (1<<1)
#define LMTP_FEATURE_PIPELINING (1<<2)
#define LMTP_FEATURE_SIZE (1<<3)
-#define SMTP_FEATURE_AUTH (1<<5)
+#define LMTP_FEATURE_AUTH (1<<5)
/*
* lmtp.c
lines = resp->str;
(void) mystrtok(&lines, "\n");
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)
state->features |= LMTP_FEATURE_8BITMIME;
else if (strcasecmp(word, "PIPELINING") == 0)
msg_info("server features: 0x%x", state->features);
#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));
#endif
* rejected, ignore RCPT TO responses: all recipients are
* dead already. When all recipients are rejected the
* 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:
if (!mail_from_rejected) {
+#ifndef RFC821_SYNTAX
+ if (resp->code == 552)
+ resp->code = 452;
+#endif
rcpt = request->rcpt_list.info + recv_rcpt;
if (resp->code / 100 == 2) {
if (survivors == 0)
/* LMTP_STATE *state;
/* DESCRIPTION
/* 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.
/*
/* 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
-/* 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
/* code in case of trouble.
/*
/* System library. */
#include <sys_defs.h>
+#include <string.h>
+#ifdef STRCASECMP_IN_STRINGS_H
+#include <strings.h>
+#endif
/* Utility library. */
* then pretend that the server doesn't support SASL authentication.
*/
if (state->sasl_mechanism_list) {
+ if (strcasecmp(state->sasl_mechanism_list, words) == 0)
+ return;
myfree(state->sasl_mechanism_list);
msg_warn("%s offered AUTH option multiple times",
state->session->namaddr);
state->sasl_mechanism_list = 0;
- state->features &= ~SMTP_FEATURE_AUTH;
+ state->features &= ~LMTP_FEATURE_AUTH;
}
if (strlen(words) > 0) {
state->sasl_mechanism_list = mystrdup(words);
- state->features |= SMTP_FEATURE_AUTH;
+ state->features |= LMTP_FEATURE_AUTH;
} else {
msg_warn("%s offered null AUTH mechanism list",
state->session->namaddr);
/* Postfix super intendent
/* SYNOPSIS
/* .fi
-/* \fBpostsuper\fR [\fB-d \fIqueue_id\fR] [\fB-p\fR]
-/* [\fB-s\fR] [\fB-v\fR] [\fIdirectory ...\fR]
+/* \fBpostsuper\fR [\fB-Rpsv\fR] [\fB-d \fIqueue_id\fR]
+/* [\fB-r \fIqueue_id\fR] [\fIdirectory ...\fR]
/* DESCRIPTION
/* The \fBpostsuper\fR command does small maintenance jobs. Use of
/* the command is restricted to the super-user.
/* file was deleted.
/* .sp
/* .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
-/* system is running.
+/* system is running.
/* .ft R
/* .sp
/* The scenario is as follows:
/* \fBpostsuper\fR deletes the new message file, instead of the
/* old file that should have been deleted.
/* .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
/* Structure check. Move queue files that are in the wrong place
/* in the file system hierarchy and remove subdirectories that are
#include <set_ugid.h>
#include <argv.h>
#include <vstring_vstream.h>
+#include <sane_fsops.h>
/* Global library. */
#define ACTION_STRUCT (1<<0) /* fix file organization */
#define ACTION_PURGE (1<<1) /* purge old temp files */
#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)
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 */
static int delete_one(const char *queue_id)
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);
int found = 0;
while (vstring_get_nonl(buf, fp) != VSTREAM_EOF)
- found |= delete_one(STR(buf));
+ found |= operator(STR(buf));
vstring_free(buf);
return (found);
if (mail_queue_id_ok(path) == 0)
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
* hierarchy. Its place may be wrong after a change to the
* to do everything with the postfix owner privileges regardless,
* in order to limit the amount of damage that we can do.
*/
- (void) mail_queue_path(wanted_path, queue_name, path);
- if (strcmp(STR(actual_path), STR(wanted_path)) != 0) {
- if (rename(STR(actual_path), STR(wanted_path)) < 0)
- if (errno != ENOENT
- || mail_queue_mkdirs(STR(wanted_path)) < 0
- || rename(STR(actual_path), STR(wanted_path)) < 0)
- msg_fatal("rename %s to %s: %m", STR(actual_path),
- STR(wanted_path));
- if (msg_verbose)
- msg_info("rename %s to %s", STR(actual_path),
- STR(wanted_path));
+ if (action & ACTION_STRUCT) {
+ (void) mail_queue_path(wanted_path, queue_name, path);
+ if (strcmp(STR(actual_path), STR(wanted_path)) != 0) {
+ if (rename(STR(actual_path), STR(wanted_path)) < 0)
+ if (errno != ENOENT
+ || mail_queue_mkdirs(STR(wanted_path)) < 0
+ || rename(STR(actual_path), STR(wanted_path)) < 0)
+ msg_fatal("rename %s to %s: %m", STR(actual_path),
+ STR(wanted_path));
+ if (msg_verbose)
+ msg_info("rename %s to %s", STR(actual_path),
+ STR(wanted_path));
+ }
}
}
scan_dir_close(info);
while ((c = GETOPT(argc, argv, "d:spv")) > 0) {
switch (c) {
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]);
case 'd':
if (strcmp(optarg, "-") == 0)
- found |= delete_stream(VSTREAM_IN);
+ found |= operate_stream(VSTREAM_IN, delete_one);
else
found |= delete_one(optarg);
action |= ACTION_DELETE;
break;
- case 's':
- action |= ACTION_STRUCT;
- break;
case 'p':
action |= ACTION_PURGE;
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':
msg_verbose++;
break;
else
queues = argv + optind;
- if (action & ~ACTION_DELETE)
- super(queues, action & ~ACTION_DELETE);
+#define ACTIONS_ON_THE_FLY (ACTION_DELETE | ACTION_REQUEUE)
- 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);
}
/* RFC 1870 (Message Size Declaration)
/* RFC 2197 (Pipelining)
/* RFC 2554 (AUTH command)
+/* RFC 2821 (SMTP protocol)
/* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8).
/* Corrupted message files are marked so that the queue manager can
/* System library. */
#include <sys_defs.h>
+#include <string.h>
+#ifdef STRCASECMP_IN_STRINGS_H
+#include <strings.h>
+#endif
/* Utility library. */
* then pretend that the server doesn't support SASL authentication.
*/
if (state->sasl_mechanism_list) {
+ if (strcasecmp(state->sasl_mechanism_list, words) == 0)
+ return;
myfree(state->sasl_mechanism_list);
msg_warn("%s offered AUTH option multiple times",
state->session->namaddr);
/* RFC 1870 (Message Size Declaration)
/* RFC 1985 (ETRN command)
/* RFC 2554 (AUTH command)
+/* RFC 2821 (SMTP protocol)
/* DIAGNOSTICS
/* Problems and transactions are logged to \fBsyslogd\fR(8).
/*