]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.10-20121227
authorWietse Venema <wietse@porcupine.org>
Thu, 27 Dec 2012 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:38:25 +0000 (06:38 +0000)
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/WISHLIST
postfix/html/postconf.1.html
postfix/man/man1/postconf.1
postfix/src/global/mail_version.h
postfix/src/postconf/postconf.c
postfix/src/postconf/postconf.h
postfix/src/postconf/postconf_main.c

index 79c4f0881638951efcc3cf39c7f7f93aabbcfb94..f245078d829f08416492e170750afe7711d8ab51 100644 (file)
@@ -18185,9 +18185,16 @@ Apologies for any names omitted.
 
 20121226
 
-       Miscellaneous cleanups of postconf internal APIs,
-       identifiers and comments. No changes in behavior.
+       Miscellaneous cleanups of postconf internal APIs, identifiers
+       and comments. No changes in behavior.
 
-       Bugfix (omission in feature 20111203): the SMTP server
+       Bugfix (omission in feature 20111203): the SMTP server only
        supported time-dependent address-verification sender addresses
-       only with RCPT TO but not with MAIL FROM. File: smtpd/smtpd.c.
+       with RCPT TO but not with MAIL FROM. File: smtpd/smtpd.c.
+
+20121227
+
+       Feature: "postconf -o name=value" support to override main.cf
+       settings (for example, "postconf -x -o stress=whatever"
+       shows effective settings under overload). Files:
+       postconf/postconf.c, postconf/postconf_main.c.
index ccd464e8301e46f7009ee47c32f9cbf99748f98a..8a70de0436e34463cc40473c206732562bb8573a 100644 (file)
@@ -36,8 +36,8 @@ expanded parameter values.
 - "postconf -x" now expands $name in main.cf and master.cf parameter
   values.
 
-- "postconf -Mn" now shows only master.cf entries with "-o name=value"
-  parameter settings.
+- "postconf -Mn" now shows services that have "-o name=value"
+  parameter settings in master.cf.
 
 - postconf warns about attempts to modify a read-only parameter
   (process_name, process_id) in main.cf or master.cf.
@@ -46,6 +46,12 @@ expanded parameter values.
   main.cf or master.cf (except for backwards-compatibility parameters
   such as $virtual_maps).
 
+Added with snapshot 20121227:
+
+- "postconf -o name=value" overrides main.cf parameter settings.
+  This can be used, for example, to examine stress-dependent settings
+  with "postconf -x -o stress=yes".
+
 Incompatible changes with snapshot 20121123
 ===========================================
 
index 130a442d482e0e17782bc39bd6ae9e6173e169ec..2fad322d2c4c890aaf6500f656ecb8949e5177ba 100644 (file)
@@ -11,6 +11,8 @@ Wish list:
        Don't forget Apple's code donation for fetching mail from
        IMAP server.
 
+       Should postconf -o refuse to work without the -x option?
+
        Make errno white/blacklist for getpwnam_r etc. and mailbox
        write errors.
 
index 3c7f55962845bacc33a870629931a0e174944027..edc146836244014fdd80270bbbc0087068baf1d4 100644 (file)
@@ -12,8 +12,8 @@ POSTCONF(1)                                                        POSTCONF(1)
 <b>SYNOPSIS</b>
        <b>Managing <a href="postconf.5.html">main.cf</a>:</b>
 
-       <b>postconf</b> [<b>-dfhnvx</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-C</b> <i>class,...</i>] [<i>parame-</i>
-       <i>ter ...</i>]
+       <b>postconf</b> [<b>-dfhnovx</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<b>-C</b> <i>class,...</i>] [<i>param-</i>
+       <i>eter ...</i>]
 
        <b>postconf</b> [<b>-ev</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter=value ...</i>]
 
@@ -21,7 +21,7 @@ POSTCONF(1)                                                        POSTCONF(1)
 
        <b>Managing <a href="master.5.html">master.cf</a>:</b>
 
-       <b>postconf</b> [<b>-fMnvx</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>service ...</i>]
+       <b>postconf</b> [<b>-fMnovx</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>service ...</i>]
 
        <b>Managing bounce message templates:</b>
 
@@ -115,7 +115,7 @@ POSTCONF(1)                                                        POSTCONF(1)
               for human readability (Postfix 2.9 and later).
 
        <b>-e</b>     Edit  the  <a href="postconf.5.html"><b>main.cf</b></a>  configuration  file, and update
-              parameter settings with the "<i>name</i>=<i>value</i>"  pairs  on
+              parameter settings with the "<i>name=value</i>"  pairs  on
               the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line. The file is copied to
               a temporary file then renamed into place.   Specify
               quotes to protect special characters and whitespace
@@ -295,12 +295,19 @@ POSTCONF(1)                                                        POSTCONF(1)
               This  feature  is  available  with  Postfix 2.9 and
               later.
 
-       <b>-n</b>     Print only <i>name</i>=<i>value</i> parameter settings  that  are
-              explicitly  specified  in  <a href="postconf.5.html"><b>main.cf</b></a>.  When specified
-              with <b>-M</b>, print only <a href="master.5.html"><b>master.cf</b></a> entries that have "-o
-              <i>name</i>=<i>value</i>"  parameter  settings  (Postfix 2.10 and
-              later).  Specify <b>-nf</b> to fold long lines  for  human
-              readability (Postfix 2.9 and later).
+       <b>-n</b>     Show  only  configuration  parameters   that   have
+              explicit  <i>name=value</i>  settings  in  <a href="postconf.5.html"><b>main.cf</b></a>.   When
+              specified with <b>-M</b>, show  only  services  that  have
+              explicit  "-o  <i>name=value</i>"  settings  in  <a href="master.5.html"><b>master.cf</b></a>
+              (Postfix 2.10 and later).  Specify <b>-nf</b> to fold long
+              lines   for  human  readability  (Postfix  2.9  and
+              later).
+
+       <b>-o</b> <i>name=value</i>
+              Override <a href="postconf.5.html"><b>main.cf</b></a> parameter settings.
+
+              This feature is available  with  Postfix  2.10  and
+              later.
 
        <b>-t</b> [<i>template</i><b>_</b><i>file</i>]
               Display  the templates for text that appears at the
@@ -333,7 +340,7 @@ POSTCONF(1)                                                        POSTCONF(1)
               parameters named on the <a href="postconf.1.html"><b>postconf</b>(1)</a>  command  line.
               The file is copied to a temporary file then renamed
               into place.  Specify a list of parameter names, not
-              "<i>name</i>=<i>value</i>"  pairs.   There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> com-
+              "<i>name=value</i>"  pairs.   There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> com-
               mand to perform the reverse operation.
 
               This feature is available  with  Postfix  2.10  and
@@ -344,7 +351,7 @@ POSTCONF(1)                                                        POSTCONF(1)
               line,  so  that  those  parameters  revert to their
               default values.  The file is copied to a  temporary
               file  then  renamed  into place.  Specify a list of
-              parameter names, not "<i>name</i>=<i>value</i>" pairs.  There  is
+              parameter names, not "<i>name=value</i>" pairs.  There  is
               no <a href="postconf.1.html"><b>postconf</b>(1)</a> command to perform the reverse oper-
               ation.
 
index a9903f4ca8d084a5eb6c53f218d530de99f5c279..c45a2d7ee8900e07bdf931726ad46bb726deba0c 100644 (file)
@@ -11,7 +11,7 @@ Postfix configuration utility
 .fi
 \fBManaging main.cf:\fR
 
-\fBpostconf\fR [\fB-dfhnvx\fR] [\fB-c \fIconfig_dir\fR]
+\fBpostconf\fR [\fB-dfhnovx\fR] [\fB-c \fIconfig_dir\fR]
 [\fB-C \fIclass,...\fR] [\fIparameter ...\fR]
 
 \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
@@ -22,7 +22,7 @@ Postfix configuration utility
 
 \fBManaging master.cf:\fR
 
-\fBpostconf\fR [\fB-fMnvx\fR] [\fB-c \fIconfig_dir\fR]
+\fBpostconf\fR [\fB-fMnovx\fR] [\fB-c \fIconfig_dir\fR]
 [\fIservice ...\fR]
 
 \fBManaging bounce message templates:\fR
@@ -114,7 +114,7 @@ Specify \fB-df\fR to fold long lines for human readability
 (Postfix 2.9 and later).
 .IP \fB-e\fR
 Edit the \fBmain.cf\fR configuration file, and update
-parameter settings with the "\fIname\fR=\fIvalue\fR" pairs
+parameter settings with the "\fIname=value\fR" pairs
 on the \fBpostconf\fR(1) command line. The file is copied
 to a temporary file then renamed into place.
 Specify quotes to protect special characters and whitespace
@@ -259,13 +259,17 @@ or with a \fIservice-name.service-type\fR pair, where
 
 This feature is available with Postfix 2.9 and later.
 .IP \fB-n\fR
-Print only \fIname\fR=\fIvalue\fR parameter settings that
-are explicitly specified in \fBmain.cf\fR. When specified
-with \fB-M\fR, print only \fBmaster.cf\fR entries that have
-"-o \fIname\fR=\fIvalue\fR" parameter settings (Postfix
-2.10 and later).
+Show only configuration parameters that have explicit
+\fIname=value\fR settings in \fBmain.cf\fR.
+When specified with \fB-M\fR, show only services that have
+explicit "-o \fIname=value\fR" settings in \fBmaster.cf\fR
+(Postfix 2.10 and later).
 Specify \fB-nf\fR to fold long lines for human readability
 (Postfix 2.9 and later).
+.IP "\fB-o \fIname=value\fR"
+Override \fBmain.cf\fR parameter settings.
+
+This feature is available with Postfix 2.10 and later.
 .IP "\fB-t\fR [\fItemplate_file\fR]"
 Display the templates for text that appears at the beginning
 of delivery status notification (DSN) messages, without
@@ -294,7 +298,7 @@ Edit the \fBmain.cf\fR configuration file, and remove
 the parameters named on the \fBpostconf\fR(1) command line.
 The file is copied to a temporary file then renamed into
 place.
-Specify a list of parameter names, not "\fIname\fR=\fIvalue\fR"
+Specify a list of parameter names, not "\fIname=value\fR"
 pairs.  There is no \fBpostconf\fR(1) command to perform
 the reverse operation.
 
@@ -305,7 +309,7 @@ the parameters named on the \fBpostconf\fR(1) command line,
 so that those parameters revert to their default values.
 The file is copied to a temporary file then renamed into
 place.
-Specify a list of parameter names, not "\fIname\fR=\fIvalue\fR"
+Specify a list of parameter names, not "\fIname=value\fR"
 pairs.  There is no \fBpostconf\fR(1) command to perform
 the reverse operation.
 
index 9cd5501eef25468a330b22cc3a69042acbcc6d2b..9e5aa210c7d5dbaf01c6546339314cfa442b02e8 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20121226"
+#define MAIL_RELEASE_DATE      "20121227"
 #define MAIL_VERSION_NUMBER    "2.10"
 
 #ifdef SNAPSHOT
index e4619e11bde4089a89aab22531b531117b17521a..71969edc33a7d2497eedbfaf7b96164e2c87fa45 100644 (file)
@@ -7,7 +7,7 @@
 /* .fi
 /*     \fBManaging main.cf:\fR
 /*
-/*     \fBpostconf\fR [\fB-dfhnvx\fR] [\fB-c \fIconfig_dir\fR]
+/*     \fBpostconf\fR [\fB-dfhnovx\fR] [\fB-c \fIconfig_dir\fR]
 /*     [\fB-C \fIclass,...\fR] [\fIparameter ...\fR]
 /*
 /*     \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
@@ -18,7 +18,7 @@
 /*
 /*     \fBManaging master.cf:\fR
 /*
-/*     \fBpostconf\fR [\fB-fMnvx\fR] [\fB-c \fIconfig_dir\fR]
+/*     \fBpostconf\fR [\fB-fMnovx\fR] [\fB-c \fIconfig_dir\fR]
 /*     [\fIservice ...\fR]
 /*
 /*     \fBManaging bounce message templates:\fR
 /*     (Postfix 2.9 and later).
 /* .IP \fB-e\fR
 /*     Edit the \fBmain.cf\fR configuration file, and update
-/*     parameter settings with the "\fIname\fR=\fIvalue\fR" pairs
+/*     parameter settings with the "\fIname=value\fR" pairs
 /*     on the \fBpostconf\fR(1) command line. The file is copied
 /*     to a temporary file then renamed into place.
 /*     Specify quotes to protect special characters and whitespace
 /*
 /*     This feature is available with Postfix 2.9 and later.
 /* .IP \fB-n\fR
-/*     Print only \fIname\fR=\fIvalue\fR parameter settings that
-/*     are explicitly specified in \fBmain.cf\fR. When specified
-/*     with \fB-M\fR, print only \fBmaster.cf\fR entries that have
-/*     "-o \fIname\fR=\fIvalue\fR" parameter settings (Postfix
-/*     2.10 and later).
+/*     Show only configuration parameters that have explicit
+/*     \fIname=value\fR settings in \fBmain.cf\fR.
+/*     When specified with \fB-M\fR, show only services that have
+/*     explicit "-o \fIname=value\fR" settings in \fBmaster.cf\fR
+/*     (Postfix 2.10 and later).
 /*     Specify \fB-nf\fR to fold long lines for human readability
 /*     (Postfix 2.9 and later).
+/* .IP "\fB-o \fIname=value\fR"
+/*     Override \fBmain.cf\fR parameter settings.
+/*
+/*     This feature is available with Postfix 2.10 and later.
 /* .IP "\fB-t\fR [\fItemplate_file\fR]"
 /*     Display the templates for text that appears at the beginning
 /*     of delivery status notification (DSN) messages, without
 /*     the parameters named on the \fBpostconf\fR(1) command line.
 /*     The file is copied to a temporary file then renamed into
 /*     place.
-/*     Specify a list of parameter names, not "\fIname\fR=\fIvalue\fR"
+/*     Specify a list of parameter names, not "\fIname=value\fR"
 /*     pairs.  There is no \fBpostconf\fR(1) command to perform
 /*     the reverse operation.
 /*
 /*     so that those parameters revert to their default values.
 /*     The file is copied to a temporary file then renamed into
 /*     place.
-/*     Specify a list of parameter names, not "\fIname\fR=\fIvalue\fR"
+/*     Specify a list of parameter names, not "\fIname=value\fR"
 /*     pairs.  There is no \fBpostconf\fR(1) command to perform
 /*     the reverse operation.
 /*
 #include <stringops.h>
 #include <name_mask.h>
 #include <warn_stat.h>
+#include <mymalloc.h>
 
 /* Global library. */
 
@@ -409,6 +414,7 @@ int     main(int argc, char **argv)
        "all", PC_PARAM_MASK_CLASS,
        0,
     };
+    ARGV   *override_params = 0;
 
     /*
      * Fingerprint executables and core dumps.
@@ -438,7 +444,7 @@ int     main(int argc, char **argv)
     /*
      * Parse JCL.
      */
-    while ((ch = GETOPT(argc, argv, "aAbc:C:deEf#hlmMntvxX")) > 0) {
+    while ((ch = GETOPT(argc, argv, "aAbc:C:deEf#hlmMno:tvxX")) > 0) {
        switch (ch) {
        case 'a':
            cmd_mode |= SHOW_SASL_SERV;
@@ -469,11 +475,9 @@ int     main(int argc, char **argv)
        case 'f':
            cmd_mode |= FOLD_LINE;
            break;
-
        case '#':
            cmd_mode = COMMENT_OUT;
            break;
-
        case 'h':
            cmd_mode &= ~SHOW_NAME;
            break;
@@ -489,6 +493,11 @@ int     main(int argc, char **argv)
        case 'n':
            cmd_mode |= SHOW_NONDEF;
            break;
+       case 'o':
+           if (override_params == 0)
+               override_params = argv_alloc(2);
+           argv_add(override_params, optarg, (char *) 0);
+           break;
        case 't':
            if (ext_argv)
                msg_fatal("specify one of -b and -t");
@@ -525,6 +534,8 @@ int     main(int argc, char **argv)
        msg_fatal("do not specify -x with -a, -A, -b, -e, -#, -l, -m, or -X");
     if ((cmd_mode & SHOW_NONDEF) != 0 && junk != 0 && junk != SHOW_MASTER)
        msg_fatal("do not specify -n with -a, -A, -b, -d, -e, -#, -l, -m, or -X");
+    if (override_params != 0 && junk != 0 && junk != SHOW_MASTER)
+       msg_fatal("do not specify -o with -a, -A, -b, -d, -e, -#, -l, -m, or -X");
 
     /*
      * Display bounce template information and exit.
@@ -568,6 +579,8 @@ int     main(int argc, char **argv)
     else if (cmd_mode & SHOW_MASTER) {
        read_master(FAIL_ON_OPEN_ERROR);
        read_parameters();
+       if (override_params)
+           set_parameters(override_params->argv);
        register_builtin_parameters(basename(argv[0]), getpid());
        register_service_parameters();
        register_user_parameters();
@@ -599,6 +612,8 @@ int     main(int argc, char **argv)
     else {
        if ((cmd_mode & SHOW_DEFS) == 0) {
            read_parameters();
+           if (override_params)
+               set_parameters(override_params->argv);
        }
        register_builtin_parameters(basename(argv[0]), getpid());
 
index 363d4d48deffafa81dcc9e648d266a5b35647ac3..ca575c12577b2c242f0d4dfd3cd8f994d17beb1b 100644 (file)
@@ -141,7 +141,7 @@ extern void set_config_dir(void);
   * postconf_main.c
   */
 extern void read_parameters(void);
-extern void set_parameters(void);
+extern void set_parameters(char **);
 extern void show_parameters(int, int, char **);
 
  /*
index a2e2e34aac640b8a3cc18387ea0f393d4b806396..8b89476ee76d1694e6593b05a05b4f604e78b42a 100644 (file)
@@ -15,6 +15,9 @@
 /* DESCRIPTION
 /*     read_parameters() reads parameters from main.cf.
 /*
+/*     set_parameters() takes an array of \fIname=value\fR pairs
+/*     and overrides settings read with read_parameters().
+/*
 /*     show_parameters() writes main.cf parameters to the standard
 /*     output stream.
 /*
@@ -106,6 +109,23 @@ void    read_parameters(void)
     myfree(path);
 }
 
+/* set_parameters - add or override name=value pairs */
+
+void    set_parameters(char **name_val_array)
+{
+    char   *name, *value, *junk;
+    const char *err;
+    char  **cpp;
+
+    for (cpp = name_val_array; *cpp; cpp++) {
+       junk = mystrdup(*cpp);
+       if ((err = split_nameval(junk, &name, &value)) != 0)
+           msg_fatal("invalid parameter override: %s: %s", *cpp, err);
+       mail_conf_update(name, value);
+       myfree(junk);
+    }
+}
+
 /* print_line - show line possibly folded, and with normalized whitespace */
 
 static void print_line(int mode, const char *fmt,...)