]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.10-20120426
authorWietse Venema <wietse@porcupine.org>
Thu, 26 Apr 2012 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:38:09 +0000 (06:38 +0000)
postfix/HISTORY
postfix/src/global/mail_version.h
postfix/src/postconf/Makefile.in
postfix/src/postconf/postconf_user.c
postfix/src/postconf/test4b.ref [new file with mode: 0644]

index bcbe233dd389717748ce505ea283bed0486a236d..d95e00ddb8c25ccde5aa5c38159cb75c61d8d77f 100644 (file)
@@ -17738,3 +17738,11 @@ Apologies for any names omitted.
        Workaround: bugs in 10-year old gcc versions break compilation
        with #ifdef inside a macro invocation (NOT: definition).
        Files: tls/tls.h, tls/tls_client.c, tls/tls_server.c.
+
+20120426
+
+       Bugfix (introduced Postfix 2.9): postconf flagged parameters
+       defined in master.cf as "unused" when they were used only
+       in main.cf. Problem reported by Michael Tokarev. Files:
+       postconf/postconf_user.c, postconf/test4b.ref, postconf
+       Makefile.in.
index a57108141ad9c9c92559a5b8478dca6ea50b3cab..1a8f59b2d9794854f692329c6856e5efb87eab3d 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      "20120425"
+#define MAIL_RELEASE_DATE      "20120426"
 #define MAIL_VERSION_NUMBER    "2.10"
 
 #ifdef SNAPSHOT
index b757205db8da6000e09f4a54cf500230d920a0f9..6fb859340fddca64098780e3d6e3375fdbc5e1c7 100644 (file)
@@ -42,7 +42,7 @@ test: $(TESTPROG)
 
 tests: test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
        test12 test13 test14 test15 test16 test17 test18 test19 test20 test21 \
-       test22 test23 test24 test25 test26 test27 test28 test29 test30
+       test22 test23 test24 test25 test26 test27 test28 test29 test30 test4b
 
 root_tests:
 
@@ -80,7 +80,7 @@ test2:        $(PROG) test2.ref
        diff test2.ref test2.tmp
        rm -f main.cf master.cf test2.tmp
 
-# Define one parameter in main,cf, validate it with main.cf.
+# Define one parameter in main.cf, validate it with main.cf.
 
 test3: $(PROG) test3.ref
        rm -f main.cf master.cf
@@ -105,6 +105,21 @@ test4:     $(PROG) test4.ref
        diff test4.ref test4.tmp
        rm -f main.cf master.cf test4.tmp
 
+# Define one parameter in master.cf, validate it with main.cf.
+
+test4b:        $(PROG) test4b.ref
+       rm -f main.cf master.cf
+       touch main.cf master.cf
+       echo 'always_bcc = $$foo' >> main.cf
+       echo 'biff = $$bar' >> main.cf
+       echo 'bar = aaa' >> main.cf
+       echo smtpd1 unix - n n - 0 smtpd >> master.cf
+       echo ' -o foo=xxx -o bar=yyy -o baz=zzz' >> master.cf
+       echo '#smtpd1 unix - n n - 0 smtpd' >> master.cf
+       ./$(PROG) -nc . >test4b.tmp 2>&1
+       diff test4b.ref test4b.tmp
+       rm -f main.cf master.cf test4b.tmp
+
 # Define one user-defined parameter with name=value in master.cf,
 # validate it with known_parameter=$$name in master.cf.
 
index d3ff7e3184faac97f818673c66d863a44ab1f258..1ad955869c855bb29965e6f6e142919654f32def 100644 (file)
@@ -126,15 +126,28 @@ static const char *flag_user_parameter(const char *mac_name,
      * compatibility after a feature name change.
      */
     if (local_scope && dict_get(local_scope->all_params, mac_name)) {
+       /* $name in master.cf references name=value in master.cf. */
        if (PC_PARAM_TABLE_LOCATE(local_scope->valid_names, mac_name) == 0)
            PC_PARAM_TABLE_ENTER(local_scope->valid_names, mac_name,
                                 PC_PARAM_FLAG_USER, PC_PARAM_NO_DATA,
                                 convert_user_parameter);
     } else if (mail_conf_lookup(mac_name) != 0) {
+       /* $name in main/master.cf references name=value in main.cf. */
        if (PC_PARAM_TABLE_LOCATE(param_table, mac_name) == 0)
            PC_PARAM_TABLE_ENTER(param_table, mac_name, PC_PARAM_FLAG_USER,
                                 PC_PARAM_NO_DATA, convert_user_parameter);
     }
+    if (local_scope == 0) {
+       for (local_scope = master_table; local_scope->argv; local_scope++) {
+           if (local_scope->all_params != 0
+               && dict_get(local_scope->all_params, mac_name) != 0
+           /* $name in main.cf references name=value in master.cf. */
+               && PC_PARAM_TABLE_LOCATE(local_scope->valid_names, mac_name) == 0)
+               PC_PARAM_TABLE_ENTER(local_scope->valid_names, mac_name,
+                                    PC_PARAM_FLAG_USER, PC_PARAM_NO_DATA,
+                                    convert_user_parameter);
+       }
+    }
     return (0);
 }
 
@@ -277,21 +290,7 @@ void    register_user_parameters(void)
     rest_class_table = htable_create(1);
 
     /*
-     * Scan parameter values that are left at their defaults in the global
-     * name space. Some defaults contain the $name of an obsolete parameter
-     * for backwards compatilility purposes. We might warn that an explicit
-     * name=value is obsolete, but we must not warn that the parameter is
-     * unused.
-     */
-    scan_default_parameter_values(param_table, CONFIG_DICT, (PC_MASTER_ENT *) 0);
-
-    /*
-     * Scan the explicit name=value entries in the global name space.
-     */
-    scan_user_parameter_namespace(CONFIG_DICT, (PC_MASTER_ENT *) 0);
-
-    /*
-     * Scan the "-o parameter=value" instances in each master.cf name space.
+     * Initialize the per-service parameter name spaces.
      */
     for (masterp = master_table; (argv = masterp->argv) != 0; masterp++) {
        for (field = PC_MASTER_MIN_FIELDS; argv->argv[field] != 0; field++) {
@@ -309,7 +308,27 @@ void    register_user_parameters(void)
        if ((dict = dict_handle(masterp->name_space)) != 0) {
            masterp->all_params = dict;
            masterp->valid_names = htable_create(1);
-           scan_user_parameter_namespace(masterp->name_space, masterp);
        }
     }
+
+    /*
+     * Scan parameter values that are left at their defaults in the global
+     * name space. Some defaults contain the $name of an obsolete parameter
+     * for backwards compatilility purposes. We might warn that an explicit
+     * name=value is obsolete, but we must not warn that the parameter is
+     * unused.
+     */
+    scan_default_parameter_values(param_table, CONFIG_DICT, (PC_MASTER_ENT *) 0);
+
+    /*
+     * Scan the explicit name=value entries in the global name space.
+     */
+    scan_user_parameter_namespace(CONFIG_DICT, (PC_MASTER_ENT *) 0);
+
+    /*
+     * Scan the "-o parameter=value" instances in each master.cf name space.
+     */
+    for (masterp = master_table; masterp->argv != 0; masterp++)
+       if (masterp->all_params != 0)
+           scan_user_parameter_namespace(masterp->name_space, masterp);
 }
diff --git a/postfix/src/postconf/test4b.ref b/postfix/src/postconf/test4b.ref
new file mode 100644 (file)
index 0000000..5dda033
--- /dev/null
@@ -0,0 +1,5 @@
+always_bcc = $foo
+bar = aaa
+biff = $bar
+config_directory = .
+./postconf: warning: ./master.cf: unused parameter: baz=zzz