]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20010522
authorWietse Venema <wietse@porcupine.org>
Tue, 22 May 2001 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:27:17 +0000 (06:27 +0000)
21 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/html/lmtp.8.html
postfix/html/postsuper.1.html
postfix/html/smtp.8.html
postfix/html/smtpd.8.html
postfix/man/man1/postsuper.1
postfix/man/man8/lmtp.8
postfix/man/man8/smtp.8
postfix/man/man8/smtpd.8
postfix/src/global/mail_queue.c
postfix/src/global/mail_version.h
postfix/src/global/tok822_parse.c
postfix/src/lmtp/lmtp.c
postfix/src/lmtp/lmtp.h
postfix/src/lmtp/lmtp_proto.c
postfix/src/lmtp/lmtp_sasl_proto.c
postfix/src/postsuper/postsuper.c
postfix/src/smtp/smtp.c
postfix/src/smtp/smtp_sasl_proto.c
postfix/src/smtpd/smtpd.c

index 5b48437ed11a7529206fbcb81782888e07fde326..ef773ce676212e2e9a4dd0c2f29813be43714ec4 100644 (file)
@@ -5126,8 +5126,16 @@ Apologies for any names omitted.
        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.
@@ -5136,13 +5144,13 @@ Apologies for any names omitted.
        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
 
@@ -5158,9 +5166,9 @@ Apologies for any names omitted.
 
 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.
@@ -5168,8 +5176,24 @@ Apologies for any names omitted.
        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.
index 47940a31d3fcc7ba6f1131bb4d47c89e0d015ca5..9fc8bffe8d5196b2f6c133bf8a33bf1203f8faa8 100644 (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
 ====================================
 
index 653d5d8e40c5ee3611107b4edde55dd9d5c85930..f6c5cdc6dadd76d17de8d7ac864ff3d1edfeae3d 100644 (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/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-
@@ -124,7 +125,6 @@ LMTP(8)                                                   LMTP(8)
 <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
 
 
 
@@ -137,6 +137,7 @@ LMTP(8)                                                   LMTP(8)
 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>
@@ -190,7 +191,6 @@ LMTP(8)                                                   LMTP(8)
 
        <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.
 
 
 
@@ -203,6 +203,7 @@ 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
               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>
@@ -259,7 +260,6 @@ LMTP(8)                                                   LMTP(8)
 
 
 
-
                                                                 4
 
 
index 562450a29a83466313273e59b32f8bcedf196405..c608c6e0129c1407ecca5f45c436edf98d73af8a 100644 (file)
@@ -9,13 +9,14 @@ POSTSUPER(1)                                         POSTSUPER(1)
        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.
@@ -23,42 +24,41 @@ POSTSUPER(1)                                         POSTSUPER(1)
        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
 
 
 
@@ -71,6 +71,26 @@ 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
               <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
@@ -105,6 +125,18 @@ POSTSUPER(1)                                         POSTSUPER(1)
 <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
 
@@ -128,7 +160,41 @@ POSTSUPER(1)                                         POSTSUPER(1)
 
 
 
-                                                                2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                                                                3
 
 
 </pre> </body> </html>
index b493e7090e4f47f74860fb97ad7775e447f232fe..95ae82b6315d0a7e4bf6562a2efa135472d1eadb 100644 (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/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-
@@ -58,7 +59,6 @@ SMTP(8)                                                   SMTP(8)
 
        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.
 
 
 
@@ -71,6 +71,8 @@ SMTP(8)                                                   SMTP(8)
 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
@@ -126,8 +128,6 @@ SMTP(8)                                                   SMTP(8)
 
 
 
-
-
                                                                 2
 
 
index 0e96e6860a58c52f721f6293645d20bd025f978a..4ec83ebacca2830ca9f0d46512c953b9814e5439 100644 (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/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).
@@ -61,7 +62,6 @@ SMTPD(8)                                                 SMTPD(8)
 
 
 
-
                                                                 1
 
 
index ea22b0a9852c7648b2a64c71f7bdc190e0714140..4b5e83b43c78f6256c500bb983104aaa8cf6c8d6 100644 (file)
@@ -9,8 +9,8 @@ Postfix super intendent
 .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
@@ -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.
 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
index 0521d53e5b54b34a132824a020e827856a797b7d..51e54e05d785cb6d724a68ede98fa0e4ff6b30a9 100644 (file)
@@ -60,6 +60,7 @@ RFC 1870 (Message Size Declaration)
 RFC 2033 (LMTP protocol)
 RFC 2197 (Pipelining)
 RFC 2554 (AUTH command)
+RFC 2821 (SMTP protocol)
 .SH DIAGNOSTICS
 .ad
 .fi
index ac6b37604ebb01b9dac57e344894db3f2d464fbc..3fd07aa090127fe2392baa28842cbb2b96115911 100644 (file)
@@ -51,6 +51,7 @@ RFC 1651 (SMTP service extensions)
 RFC 1870 (Message Size Declaration)
 RFC 2197 (Pipelining)
 RFC 2554 (AUTH command)
+RFC 2821 (SMTP protocol)
 .SH DIAGNOSTICS
 .ad
 .fi
index 7b5a4ea6e917e384890e8d08736d3e0fdb8f1f0b..9c3b9236b4aa15696fccf410f1c49ce2b381c499 100644 (file)
@@ -48,6 +48,7 @@ RFC 1854 (SMTP Pipelining)
 RFC 1870 (Message Size Declaration)
 RFC 1985 (ETRN command)
 RFC 2554 (AUTH command)
+RFC 2821 (SMTP protocol)
 .SH DIAGNOSTICS
 .ad
 .fi
index d58bade6c585361138d5d8ff91fc6bfcac7f5543..a8c3673c39aec3bff004c2ef89fcb901ad5d0274 100644 (file)
@@ -388,6 +388,11 @@ VSTREAM *mail_queue_enter(const char *queue_name, int mode)
     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. */
index 9d866ed9bec81d9fb909af5524cc4450abb7d684..7e53c391a3ce73fe0ea5e5d796f2acf009419ab8 100644 (file)
@@ -15,7 +15,7 @@
   * 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
index 4bb54dc5d0164d8856474306825773f50781b255..e8c1a977494a4670bd6c943497089ccb86f70912 100644 (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
      * 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, '(');
 
index af74d8dd0a754732455cae69a0f4f42a8daf2f57..62bf023a1e9ceb2a9374b3c0640050f5fbbf1440 100644 (file)
@@ -50,6 +50,7 @@
 /*     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
index 9574b648ac06ea9642719a54e7137a85cf5f7b9f..419cb38d5b0059b67e8ab7332c8e91e2b0a9121b 100644 (file)
@@ -61,7 +61,7 @@ typedef struct LMTP_STATE {
 #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
index 93c40d543ad683032124f449817cd117f6cd4126..b2a01e59f9a3550c22dae9c26416e7650cc8c97f 100644 (file)
@@ -215,7 +215,7 @@ int     lmtp_lhlo(LMTP_STATE *state)
     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)
@@ -232,7 +232,7 @@ int     lmtp_lhlo(LMTP_STATE *state)
        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
 
@@ -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
                     * 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)
index 8eaeafd14897c64a0a8696252e5d7d427719c419..b8c280c019c92b385f3c08f5917e174774d3e193 100644 (file)
 /*     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. */
 
@@ -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.
      */
     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);
index daed362062e6defb9c5480c510fdc903298c040f..da6ab3fd982fde433ef8aa439b936166a35bf5fa 100644 (file)
@@ -5,8 +5,8 @@
 /*     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.
@@ -29,9 +29,9 @@
 /*     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)
 
@@ -173,6 +204,22 @@ static int postunlink(const char *path)
     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)
@@ -218,15 +265,51 @@ 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);
@@ -354,6 +437,30 @@ static void super(char **queues, int action)
            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
@@ -364,17 +471,19 @@ static void super(char **queues, int action)
             * 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);
@@ -473,21 +582,31 @@ int     main(int argc, char **argv)
     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;
@@ -505,8 +624,9 @@ int     main(int argc, char **argv)
     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);
 }
index ab541accee9c4ec6aa53284151aa7bbfcc6aad72..32c41a8d3a3ad0876d6890b46a25d50f7b898fc4 100644 (file)
@@ -41,6 +41,7 @@
 /*     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
index f3818236520b70b9f9ddc280624be4aae0e4be7d..97c2592c02eb3cec0542eb290f2fae3819c72ad1 100644 (file)
 /* System library. */
 
 #include <sys_defs.h>
+#include <string.h>
+#ifdef STRCASECMP_IN_STRINGS_H
+#include <strings.h>
+#endif
 
 /* 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.
      */
     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);
index 1fc3877e3b8ed84f667f6df000dd013a4dace3ba..5b7bc98e230f3acd012e6d473feb30db75ff8255 100644 (file)
@@ -38,6 +38,7 @@
 /*     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).
 /*