]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.11-20251130
authorWietse Z Venema <wietse@porcupine.org>
Sun, 30 Nov 2025 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <ietf-dane@dukhovni.org>
Tue, 2 Dec 2025 04:23:39 +0000 (15:23 +1100)
postfix/HISTORY
postfix/proto/stop.double-history
postfix/src/global/mail_params.c
postfix/src/global/mail_version.h
postfix/src/postmulti/Makefile.in
postfix/src/postmulti/postmulti.c
postfix/src/util/mac_midna.c

index 1e543007e5f29013945761f5761410929a3beb29..0285554264a873fbdf99e9d315ebfcef7b32a55a 100644 (file)
@@ -29900,10 +29900,11 @@ Apologies for any names omitted.
        tlsproxy_client_policy, virtual_maps. Files: mantools/postlink,
        proto/DEPRECATION_README.html, postconf/postconf_unused.c.
 
-       Cleanup: SMTP client null pointer crash when an STS policy
-       plugin sends no policy_string or no mx_pattern attributes.
-       This can happen only during tests with a fake STS plugin.
-       File: smtp/smtp_tlsrpt.c.
+       Bugfix (defect introduced: Postfix 3.10, date: 20240902):
+       SMTP client null pointer crash when an STS policy plugin
+       sends no policy_string or no mx_pattern attributes. This
+       can happen only during tests with a fake STS plugin. File:
+       smtp/smtp_tlsrpt.c.
 
 20251028
 
@@ -30085,5 +30086,24 @@ Apologies for any names omitted.
 
 20251125
 
-       Cleanup: too many braces in postmulti JSON output.  Files:
+       Cleanup: too many braces in postmulti JSON output. Files:
        postmulti/Makefile.in, postmulti/postmulti.c.
+
+20251130
+
+       Bugfix (defect introduced: Postfix 3.11, date: 20251103):
+       postconf panic (in mac_expand_add_named_fn) because an
+       attempt was made to register a function more than once.
+       Files: util/mac_midna.c, global/mail_params.c.
+
+       Cleanup: in postmulti(1) tests link the fake_strcmp wrapper
+       statically, and speed up tests by back-dating test main.cf
+       files. Files: postmulti/Makefile.in.
+
+       Usability: enable postmulti(1) logging to STDERR even when
+       STDERR is not connected to a terminal, just like most other
+       Postfix command utilities. This makes the command easier
+       to integrate into (test) scripts. File: postmulti/postmulti.c.
+
+       Testing: test that postmulti(1) will reject a non-default
+       config_directory setting. File: postmulti/Makefile.in.
index c882e8ed6365e50f6ad3c034e589234c1dc43e0f..cfb9a50c9c127b8ae908b2adc21731cbbde292dd 100644 (file)
@@ -255,3 +255,5 @@ proto  proto REQUIRETLS_README html global mail_params hc
  postalias postalias c 
  postconf postconf hc postconf postconf_main c 
  and JSON output Files postmulti postmulti c 
+ postmulti Makefile in postmulti postmulti c 
+ to integrate into test scripts File postmulti postmulti c 
index 607ab3a9091cf1270a8a143af31106b8eb50fda5..cee69696ecb663bc0649117a7d97654845ff1bd9 100644 (file)
@@ -930,15 +930,11 @@ void    mail_params_init()
        0,
     };
     const char *cp;
-    static int first = 1;
 
     /*
      * Register named functions.
      */
-    if (first) {
-       mac_midna_register();
-       first = 0;
-    }
+    mac_midna_register();
 
     /*
      * Extract compatibility level first, so that we can determine what
index 7116469dd0ad3df699d6bea7f87190a15dd19ad3..97fc2bcf2e8782e237764a76da6de80082ca9ae9 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      "20251125"
+#define MAIL_RELEASE_DATE      "20251130"
 #define MAIL_VERSION_NUMBER    "3.11"
 
 #ifdef SNAPSHOT
index e9309b9844f40b2080441356d6df3f8c98559219..790d97dc69ba322b6ea53da4b3762a5470a4eed6 100644 (file)
@@ -7,62 +7,78 @@ DEFS  = -I. -I$(INC_DIR) -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
 FILES  = Makefile $(SRCS) $(HDRS)
 INC_DIR        = ../../include
-TESTPROG=
+TESTPROG= postmulti_test
 PROG   = postmulti
 LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
        ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
-LIB_SO = fake_strcmp.so
+TESTOBJ        = fake_strcmp.o
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
        $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
-$(OBJS): ../../conf/makedefs.out
+$(TESTPROG):   $(OBJS) fake_strcmp.o $(LIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) fake_strcmp.o $(LIBS) $(SYSLIBS)
+
+$(OBJS) $(TESTOBJ): ../../conf/makedefs.out
 
 Makefile: Makefile.in
        cat ../../conf/makedefs.out $? >$@
 
 test:  $(TESTPROG)
 
-# Force strcmp(var_config_dir, DEF_CONFIG_DIR) to always succeeed. Outside
-# tests, postmulti MUST abort when their values differ.
-fake_strcmp.so: fake_strcmp.c
-       $(CC) $(CFLAGS) -fPIC -shared -o $@ fake_strcmp.c $(LIBS)
-
-tests: single_test json_tests
+tests: single_test json_tests config_dir_test
 
 # Single instance, original output format.
-single_test: $(PROG) fake_strcmp.so
-       @echo; echo RUN single_test
+single_test: $(TESTPROG)
+       @echo RUN single_test
        rm -f main.cf single_test.tmp
        echo config_directory = . >>main.cf
        echo command_directory = ../../bin >> main.cf
        echo daemon_directory = ../../libexec >> main.cf
        echo meta_directory = . >> main.cf
        echo shlib_directory = ../../lib >> main.cf
+       touch -t 197101010000 main.cf
        printf "%-15s %-15s %-9s %s\n" - - y . >single_test.tmp
-       $(SHLIB_ENV) ${VALGRIND} LD_PRELOAD=./fake_strcmp.so MAIL_CONFIG=. \
-           ./$(PROG) -l | diff single_test.tmp -
+       $(SHLIB_ENV) ${VALGRIND} MAIL_CONFIG=. \
+           ./$(TESTPROG) -l | diff single_test.tmp -
        rm -f main.cf single_test.tmp
-       @echo PASS single_test
+       @echo PASS single_test; echo 
 
 json_tests: json_single_test
 
 # Single instance, JSON output format.
-json_single_test: $(PROG) fake_strcmp.so
-       @echo; echo RUN json_single_test
+json_single_test: $(TESTPROG)
+       @echo RUN json_single_test
        rm -f main.cf json_single_test.tmp
        echo config_directory = . >>main.cf
        echo command_directory = ../../bin >> main.cf
        echo daemon_directory = ../../libexec >> main.cf
        echo meta_directory = . >> main.cf
        echo shlib_directory = ../../lib >> main.cf
+       touch -t 197101010000 main.cf
        echo "{\"name\": \"-\",\"group\": \"-\",\"enabled\": \"y\",\"config_directory\": \".\"}" >> json_single_test.tmp
-       $(SHLIB_ENV) ${VALGRIND} LD_PRELOAD=./fake_strcmp.so MAIL_CONFIG=. \
-           ./$(PROG) -lj | diff json_single_test.tmp -
+       $(SHLIB_ENV) ${VALGRIND} MAIL_CONFIG=. \
+           ./$(TESTPROG) -lj | diff json_single_test.tmp -
        rm -f main.cf json_single_test.tmp
-       @echo PASS json_single_test
+       @echo PASS json_single_test; echo
+
+# Reject non-default config_directory.
+config_dir_test:  $(PROG)
+       @echo RUN config_dir_test
+       rm -f main.cf config_dir_test.tmp
+       echo config_directory = . >>main.cf
+       echo command_directory = ../../bin >> main.cf
+       echo daemon_directory = ../../libexec >> main.cf
+       echo meta_directory = . >> main.cf
+       echo shlib_directory = ../../lib >> main.cf
+       touch -t 197101010000 main.cf
+       echo "postmulti: fatal: Non-default configuration directory: MAIL_CONFIG=." > config_dir_test.tmp
+       ($(SHLIB_ENV) ${VALGRIND} MAIL_CONFIG=. ./$(PROG) -l 2>&1 || exit 0) \
+           | diff config_dir_test.tmp -
+       rm -f config_dir_test.tmp
+       @echo PASS config_dir_test; echo
 
 root_tests:
 
@@ -72,7 +88,7 @@ update: ../../bin/$(PROG)
        cp $(PROG) ../../bin
 
 clean:
-       rm -f *.o *core $(PROG) $(TESTPROG) $(LIB_SO) junk
+       rm -f *.o *core $(PROG) $(TESTPROG) $(TESTOBJ) *.tmp main.cf junk
 
 tidy:  clean
 
index 5bd0b27a743e3cb751a5b681b26b53780dfad50f..1c737de6556c50650ee633300dbd34b325fa5e03 100644 (file)
@@ -1758,8 +1758,7 @@ int     main(int argc, char **argv)
      */
     if ((slash = strrchr(argv[0], '/')) != 0 && slash[1])
        argv[0] = slash + 1;
-    if (isatty(STDERR_FILENO))
-       msg_vstream_init(argv[0], VSTREAM_ERR);
+    msg_vstream_init(argv[0], VSTREAM_ERR);
     maillog_client_init(argv[0], MAILLOG_CLIENT_FLAG_LOGWRITER_FALLBACK);
 
     /*
index ed54118a1aa58ef90dd39ca062300a172f21106f..c52d62e6102e28eea6dcae2a512bcb6b9380982e 100644 (file)
@@ -83,6 +83,11 @@ static int mac_midna_to_u_label_eval(VSTRING *out, const char *name)
 /* mac_midna_register - register caller-defined function */
 void    mac_midna_register(void)
 {
-    mac_expand_add_named_fn(NAME_TO_A_LABEL, mac_midna_domain_to_ascii_eval);
-    mac_expand_add_named_fn(NAME_TO_U_LABEL, mac_midna_to_u_label_eval);
+    static int first = 1;
+
+    if (first) {
+       mac_expand_add_named_fn(NAME_TO_A_LABEL, mac_midna_domain_to_ascii_eval);
+       mac_expand_add_named_fn(NAME_TO_U_LABEL, mac_midna_to_u_label_eval);
+       first = 0;
+    }
 }