]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.0.9-20030419
authorWietse Venema <wietse@porcupine.org>
Sat, 19 Apr 2003 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:28:51 +0000 (06:28 +0000)
12 files changed:
postfix/HISTORY
postfix/html/postcat.1.html
postfix/html/postsuper.1.html
postfix/man/man1/postcat.1
postfix/man/man1/postsuper.1
postfix/src/global/mail_version.h
postfix/src/global/rec_type.c
postfix/src/postcat/Makefile.in
postfix/src/postcat/postcat.c
postfix/src/postfix/postfix.c
postfix/src/postsuper/postsuper.c
postfix/src/sendmail/sendmail.c

index 3e6bca4a42e348f55451f7172e45aaa669bd6f75..54ca787a78f9a40c43c1f7953ea4713ca3969f05 100644 (file)
@@ -8014,6 +8014,12 @@ Apologies for any names omitted.
 
        Bugfix: "sendmail -t" broke with unrecognized message headers.
 
+20030419
+
+       Feature: "postcat -q" searches the queue for the named file.
+
+       Cleanup: made postcat "record names" output more consistent.
+
 Open problems:
 
        Low: smtp-source may block when sending large test messages.
index 94e6d8ee0879afca0ea0b4d562cd7dee8e9de1ff..3d70fb1293bcba8a2d173b0d690f4c05c5075518 100644 (file)
@@ -5,25 +5,47 @@ POSTCAT(1)                                             POSTCAT(1)
        postcat - show Postfix queue file contents
 
 <b>SYNOPSIS</b>
-       <b>postcat</b> [<b>-v</b>] [<i>files</i>...]
+       <b>postcat</b> [<b>-vq</b>] [<b>-c</b> <i>config_dir</i>] [<i>files</i>...]
 
 <b>DESCRIPTION</b>
-       The <b>postcat</b> command prints the contents of the named Post-
-       fix queue <i>files</i> in human-readable form. If  no  <i>files</i>  are
-       specified  on  the  command  line,  the program reads from
-       standard input.
+       The <b>postcat</b> command prints the contents of the named <i>files</i>
+       in human-readable form. The files are expected  to  be  in
+       Postfix  queue  file  format. If no <i>files</i> are specified on
+       the command line, the program reads from standard input.
 
        Options:
 
+       <b>-c</b> <i>config_dir</i>
+              The <b>main.cf</b> configuration  file  is  in  the  named
+              directory  instead  of  the  default  configuration
+              directory.
+
+       <b>-q</b>     Search the Postfix queue  for  <i>files</i>.  By  default,
+              file names are taken literally.
+
        <b>-v</b>     Enable verbose logging for debugging purposes. Mul-
-              tiple  <b>-v</b>  options  make  the software increasingly
+              tiple <b>-v</b> options  make  the  software  increasingly
               verbose.
 
 <b>DIAGNOSTICS</b>
        Problems are reported to the standard error stream.
 
+<b>ENVIRONMENT</b>
+       <b>MAIL</b><i>_</i><b>CONFIG</b>
+              Directory with Postfix configuration files.
+
+<b>CONFIGURATION</b> <b>PARAMETERS</b>
+       See  the  Postfix  <b>main.cf</b> file for syntax details and for
+       default values. Use the <b>postfix</b>  <b>reload</b>  command  after  a
+       configuration change.
+
+       <b>queue</b><i>_</i><b>directory</b>
+              Top-level  directory  of the Postfix queue. This is
+              also the root directory of Postfix daemons that run
+              chrooted.
+
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>AUTHOR(S)</b>
index f80d1da047c968a9d37078d22fc7f3151ba8da5f..2a8ff15ac1f4c105bf7ae59eeabd3272cc0f29a3 100644 (file)
@@ -174,6 +174,11 @@ POSTSUPER(1)                                         POSTSUPER(1)
               The  names of queues that are organized into multi-
               ple levels of subdirectories.
 
+       <b>queue</b><i>_</i><b>directory</b>
+              Top-level directory of the Postfix queue.  This  is
+              also the root directory of Postfix daemons that run
+              chrooted.
+
 <b>SEE</b> <b>ALSO</b>
        <a href="sendmail.1.html">sendmail(1)</a> sendmail-compatible user interface
        <a href="postqueue.1.html">postqueue(1)</a> unprivileged queue operations
index 2ab5fe048db1233be55be04ae36661417b1ff85f..5b7f28a5f1511a180f9c35210d39ac8d15af52ca 100644 (file)
@@ -8,16 +8,23 @@ show Postfix queue file contents
 .SH SYNOPSIS
 .na
 .nf
-\fBpostcat\fR [\fB-v\fR] [\fIfiles\fR...]
+\fBpostcat\fR [\fB-vq\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...]
 .SH DESCRIPTION
 .ad
 .fi
 The \fBpostcat\fR command prints the contents of the named
-Postfix queue \fIfiles\fR in human-readable form. If no
+\fIfiles\fR in human-readable form. The files are expected
+to be in Postfix queue file format. If no
 \fIfiles\fR are specified on the command line, the program
 reads from standard input.
 
 Options:
+.IP "\fB-c \fIconfig_dir\fR"
+The \fBmain.cf\fR configuration file is in the named directory
+instead of the default configuration directory.
+.IP \fB-q\fR
+Search the Postfix queue for \fIfiles\fR. By default,
+file names are taken literally.
 .IP \fB-v\fR
 Enable verbose logging for debugging purposes. Multiple \fB-v\fR
 options make the software increasingly verbose.
@@ -25,6 +32,24 @@ options make the software increasingly verbose.
 .ad
 .fi
 Problems are reported to the standard error stream.
+.SH ENVIRONMENT
+.na
+.nf
+.ad
+.fi
+.IP \fBMAIL_CONFIG\fR
+Directory with Postfix configuration files.
+.SH CONFIGURATION PARAMETERS
+.na
+.nf
+.ad
+.fi
+See the Postfix \fBmain.cf\fR file for syntax details and for
+default values. Use the \fBpostfix reload\fR command after a
+configuration change.
+.IP \fBqueue_directory\fR
+Top-level directory of the Postfix queue. This is also the root
+directory of Postfix daemons that run chrooted.
 .SH LICENSE
 .na
 .nf
index cbd50485dfddeaabfe77a9b9fd5ccd2becc629c7..5cbbbc0273dceef197678027fbe6fc33f61d4507 100644 (file)
@@ -178,6 +178,9 @@ Number of subdirectory levels for hashed queues.
 .IP \fBhash_queue_names\fR
 The names of queues that are organized into multiple levels of
 subdirectories.
+.IP \fBqueue_directory\fR
+Top-level directory of the Postfix queue. This is also the root
+directory of Postfix daemons that run chrooted.
 .SH SEE ALSO
 .na
 .nf
index 35ca549af882f0d09269491fa67bbb73d1fd6da8..fef966f828add2a035f6d002fe526a80960308bd 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change the patchlevel and the release date. Snapshots change the
   * release date only, unless they include the same bugfix as a patch release.
   */
-#define MAIL_RELEASE_DATE      "20030418"
+#define MAIL_RELEASE_DATE      "20030419"
 
 #define VAR_MAIL_VERSION       "mail_version"
 #define DEF_MAIL_VERSION       "2.0.9-" MAIL_RELEASE_DATE
index d1e630b3709620a7d8b1fa36da6670085ba9fa8c..2f993591907f77631173b5b2004e7c96fa25304d 100644 (file)
@@ -41,25 +41,27 @@ REC_TYPE_NAME rec_type_names[] = {
     REC_TYPE_EOF, "end-of-file",       /* not Postfix-specific. */
     REC_TYPE_ERROR, "error",           /* not Postfix-specific. */
     REC_TYPE_SIZE, "message_size",
-    REC_TYPE_TIME, "time",
-    REC_TYPE_FULL, "fullname",
+    REC_TYPE_TIME, "message_arrival_time",
+    REC_TYPE_FULL, "sender_fullname",
     REC_TYPE_INSP, "content_inspector",
     REC_TYPE_FILT, "content_filter",
     REC_TYPE_FROM, "sender",
-    REC_TYPE_DONE, "done",
+    REC_TYPE_DONE, "done_recipient",
     REC_TYPE_RCPT, "recipient",
-    REC_TYPE_ORCP, "original recipient",
+    REC_TYPE_ORCP, "original_recipient",
     REC_TYPE_WARN, "warning_message_time",
-    REC_TYPE_ATTR, "named attribute",
+    REC_TYPE_ATTR, "named_attribute",
     REC_TYPE_MESG, "message_content",
-    REC_TYPE_CONT, "unterminated",
-    REC_TYPE_NORM, "normal_data",
+    REC_TYPE_CONT, "unterminated_text",
+    REC_TYPE_NORM, "regular_text",
     REC_TYPE_XTRA, "extracted_info",
     REC_TYPE_RRTO, "return_receipt",
     REC_TYPE_ERTO, "errors_to",
     REC_TYPE_PRIO, "priority",
     REC_TYPE_VERP, "verp_delimiters",
     REC_TYPE_END, "message_end",
+    REC_TYPE_RDR, "redirect_to",
+    REC_TYPE_FLGS, "flags",
     0, 0,
 };
 
index 65cf7576f3a32630f0ad782408823dc8078e27a4..dca6108806e3c0a6c5375b0ea3290c5043d584f6 100644 (file)
@@ -65,3 +65,6 @@ postcat.o: ../../include/msg_vstream.h
 postcat.o: ../../include/vstring_vstream.h
 postcat.o: ../../include/record.h
 postcat.o: ../../include/rec_type.h
+postcat.o: ../../include/mail_queue.h
+postcat.o: ../../include/mail_conf.h
+postcat.o: ../../include/mail_params.h
index 824c95422669cd4347ddd4e2810e926ebb8d029a..993528a17fdbcd0d7bcab567871d083e66065955 100644 (file)
@@ -4,19 +4,40 @@
 /* SUMMARY
 /*     show Postfix queue file contents
 /* SYNOPSIS
-/*     \fBpostcat\fR [\fB-v\fR] [\fIfiles\fR...]
+/*     \fBpostcat\fR [\fB-vq\fR] [\fB-c \fIconfig_dir\fR] [\fIfiles\fR...]
 /* DESCRIPTION
 /*     The \fBpostcat\fR command prints the contents of the named
-/*     Postfix queue \fIfiles\fR in human-readable form. If no
+/*     \fIfiles\fR in human-readable form. The files are expected
+/*     to be in Postfix queue file format. If no
 /*     \fIfiles\fR are specified on the command line, the program
 /*     reads from standard input.
 /*
 /*     Options:
+/* .IP "\fB-c \fIconfig_dir\fR"
+/*     The \fBmain.cf\fR configuration file is in the named directory
+/*     instead of the default configuration directory.
+/* .IP \fB-q\fR
+/*     Search the Postfix queue for \fIfiles\fR. By default,
+/*     file names are taken literally.
 /* .IP \fB-v\fR
 /*     Enable verbose logging for debugging purposes. Multiple \fB-v\fR
 /*     options make the software increasingly verbose.
 /* DIAGNOSTICS
 /*     Problems are reported to the standard error stream.
+/* ENVIRONMENT
+/* .ad
+/* .fi
+/* .IP \fBMAIL_CONFIG\fR
+/*     Directory with Postfix configuration files.
+/* CONFIGURATION PARAMETERS
+/* .ad
+/* .fi
+/*     See the Postfix \fBmain.cf\fR file for syntax details and for
+/*     default values. Use the \fBpostfix reload\fR command after a
+/*     configuration change.
+/* .IP \fBqueue_directory\fR
+/*     Top-level directory of the Postfix queue. This is also the root
+/*     directory of Postfix daemons that run chrooted.
 /* LICENSE
 /* .ad
 /* .fi
 
 #include <record.h>
 #include <rec_type.h>
+#include <mail_queue.h>
+#include <mail_conf.h>
+#include <mail_params.h>
 
 /* Application-specific. */
 
+#define PC_FLAG_QUEUE  (1<<0)          /* search queue */
+
 #define STR    vstring_str
 
 /* postcat - visualize Postfix queue file contents */
@@ -86,7 +112,7 @@ static void postcat(VSTREAM *fp, VSTRING *buffer)
        if (rec_type == REC_TYPE_ERROR)
            msg_fatal("record read error");
        if (rec_type == REC_TYPE_EOF)
-           return;
+           break;
        if (first == 1) {
            vstream_printf("*** ENVELOPE RECORDS %s ***\n", VSTREAM_PATH(fp));
            first = 0;
@@ -94,26 +120,23 @@ static void postcat(VSTREAM *fp, VSTRING *buffer)
        if (prev_type == REC_TYPE_CONT && !TEXT_RECORD(rec_type))
            VSTREAM_PUTCHAR('\n');
        switch (rec_type) {
-       case REC_TYPE_SIZE:
-           vstream_printf("message_size: %s\n", STR(buffer));
-           break;
        case REC_TYPE_TIME:
-           time = atol(STR(buffer));
-           vstream_printf("arrival_time: %s", asctime(localtime(&time)));
-           break;
        case REC_TYPE_WARN:
            time = atol(STR(buffer));
-           vstream_printf("defer_warn_time: %s", asctime(localtime(&time)));
+           vstream_printf("%s: %s", rec_type_name(rec_type),
+                          asctime(localtime(&time)));
            break;
        case REC_TYPE_CONT:
            if (msg_verbose)
-               vstream_printf("non-final line fragment: %s\n", STR(buffer));
+               vstream_printf("%s: %s\n", rec_type_name(rec_type),
+                              STR(buffer));
            else
                vstream_printf("%s", STR(buffer));
            break;
        case REC_TYPE_NORM:
            if (msg_verbose)
-               vstream_printf("final line fragment: %s\n", STR(buffer));
+               vstream_printf("%s: %s\n", rec_type_name(rec_type),
+                              STR(buffer));
            else
                vstream_printf("%s\n", STR(buffer));
            break;
@@ -131,15 +154,16 @@ static void postcat(VSTREAM *fp, VSTRING *buffer)
            break;
        }
        prev_type = rec_type;
-       vstream_fflush(VSTREAM_OUT);
     }
+    vstream_fflush(VSTREAM_OUT);
 }
 
 /* usage - explain and terminate */
 
 static NORETURN usage(char *myname)
 {
-    msg_fatal("usage: %s [-v] [file(s)...]", myname);
+    msg_fatal("usage: %s [-c config_dir] [-q (access queue)] [-v] [file(s)...]",
+             myname);
 }
 
 int     main(int argc, char **argv)
@@ -149,6 +173,17 @@ int     main(int argc, char **argv)
     int     ch;
     int     fd;
     struct stat st;
+    int     flags = 0;
+    static char *queue_names[] = {
+       MAIL_QUEUE_MAILDROP,
+       MAIL_QUEUE_INCOMING,
+       MAIL_QUEUE_ACTIVE,
+       MAIL_QUEUE_DEFERRED,
+       MAIL_QUEUE_HOLD,
+       0,
+    };
+    char  **cpp;
+    int     tries;
 
     /*
      * To minimize confusion, make sure that the standard file descriptors
@@ -168,8 +203,15 @@ int     main(int argc, char **argv)
     /*
      * Parse JCL.
      */
-    while ((ch = GETOPT(argc, argv, "v")) > 0) {
+    while ((ch = GETOPT(argc, argv, "c:qv")) > 0) {
        switch (ch) {
+       case 'c':
+           if (setenv(CONF_ENV_PATH, optarg, 1) < 0)
+               msg_fatal("out of memory");
+           break;
+       case 'q':
+           flags |= PC_FLAG_QUEUE;
+           break;
        case 'v':
            msg_verbose++;
            break;
@@ -178,6 +220,11 @@ int     main(int argc, char **argv)
        }
     }
 
+    /*
+     * Further initialization...
+     */
+    mail_conf_read();
+
     /*
      * Initialize.
      */
@@ -193,6 +240,22 @@ int     main(int argc, char **argv)
        postcat(VSTREAM_IN, buffer);
     }
 
+    /*
+     * Copy the named queue files in the specified order.
+     */
+    else if (flags & PC_FLAG_QUEUE) {
+       if (chdir(var_queue_dir))
+           msg_fatal("chdir %s: %m", var_queue_dir);
+       while (optind < argc) {
+           for (fp = 0, tries = 0; fp == 0 && tries < 2; tries++)
+               for (cpp = queue_names; fp == 0 && *cpp != 0; cpp++)
+                   fp = mail_queue_open(*cpp, argv[optind], O_RDONLY, 0);
+           if (fp == 0)
+               msg_fatal("open queue file %s: %m", argv[optind]);
+           optind++;
+       }
+    }
+
     /*
      * Copy the named files in the specified order.
      */
@@ -206,6 +269,10 @@ int     main(int argc, char **argv)
            optind++;
        }
     }
+
+    /*
+     * Clean up.
+     */
     vstring_free(buffer);
     exit(0);
 }
index 5912b7bf0aa05c5cc70062e7a8f796beabc33b18..51ee0ea9ac3f77aee02182b7632ff5deaaac0ecb 100644 (file)
@@ -257,9 +257,7 @@ int     main(int argc, char **argv)
 
     /*
      * Copy a bunch of configuration parameters into the environment for easy
-     * access by the maintenance shell script. XXX There should be a postconf
-     * utility that makes config parameters easily accessible for shell
-     * scripts.
+     * access by the maintenance shell script.
      */
     mail_conf_read();
     get_mail_conf_str_table(str_table);
index a5c4ded8651825a23c44d4ef4b7cd6984741972e..7c89898938244c970c8ec2bfe26363da1dbc7cb0 100644 (file)
 /* .IP \fBhash_queue_names\fR
 /*     The names of queues that are organized into multiple levels of
 /*     subdirectories.
+/* .IP \fBqueue_directory\fR
+/*     Top-level directory of the Postfix queue. This is also the root
+/*     directory of Postfix daemons that run chrooted.
 /* SEE ALSO
 /*     sendmail(1) sendmail-compatible user interface
 /*     postqueue(1) unprivileged queue operations
index 184d283045017566dd90183d16506dde0dfed6a7..fd12206f1b072b9feb9fc26a5f89cfb37a965c9d 100644 (file)
@@ -633,7 +633,9 @@ static void enqueue(const int flags, const char *encoding, const char *sender,
     }
 
     /*
-     * Finish up MIME processing.
+     * Finish MIME processing. We need a final mime_state_update() call in
+     * order to flush text that is still buffered. That can happen when the
+     * last line did not end in newline.
      */
     if (mime_state) {
        mime_errs = mime_state_update(mime_state, REC_TYPE_EOF, "", 0);