Fix "-bP smtp_receive_timeout". Bug 2384
authorJeremy Harris <jgh146exb@wizmail.org>
Fri, 22 Mar 2019 15:00:23 +0000 (15:00 +0000)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Mon, 2 Sep 2019 22:17:35 +0000 (00:17 +0200)
(cherry picked from commit e6024a5e9e193f559508d05ee401ae8f7f3c25ae)
(cherry picked from commit 2cf1c24f203b3995cfa4434907cff05917a55c90)
(cherry picked from commit 9cfb6ebeb68fcefc83e261cff036aaf444d7d4c5)

doc/doc-txt/ChangeLog
src/src/readconf.c

index 3c16c3d12f15db6e71caa33beba56477b6f9ee4c..f0704c7d9e44d2c8c45cc5bf8d22cc3b2b847d71 100644 (file)
@@ -49,6 +49,9 @@ JH/11 Harden plaintext authenticator against a badly misconfigured client-send
       string.  Previously it was possible to cause undefined behaviour in a
       library routine (usually a crash).  Found by "zerons".
 
+JH/12 Bug 2384: fix "-bP smtp_receive_timeout".  Previously it returned no
+      output.
+
 
 
 Exim version 4.92
index 5742d10ae24da0b16c7196d4445366a9bf5cea8a..10bde5576ca881035c7cc0ec3f3b437520ffbf7f 100644 (file)
@@ -19,7 +19,7 @@ implementation of the conditional .ifdef etc. */
 
 
 static uschar * syslog_facility_str;
-static void fn_smtp_receive_timeout(const uschar *, const uschar *);
+static void fn_smtp_receive_timeout(const uschar *, const uschar *, unsigned);
 
 /*************************************************
 *           Main configuration options           *
@@ -392,7 +392,8 @@ static int optionlist_config_size = nelem(optionlist_config);
 
 #ifdef MACRO_PREDEF
 
-static void fn_smtp_receive_timeout(const uschar * name, const uschar * str) {/*Dummy*/}
+static void
+fn_smtp_receive_timeout(const uschar * name, const uschar * str, unsigned flags) {/*Dummy*/}
 
 void
 options_main(void)
@@ -559,6 +560,8 @@ static syslog_fac_item syslog_list[] = {
 static int syslog_list_size = sizeof(syslog_list)/sizeof(syslog_fac_item);
 
 
+#define opt_fn_print           BIT(0)
+#define opt_fn_print_label     BIT(1)
 
 
 /*************************************************
@@ -1532,9 +1535,16 @@ return yield;
 *            Custom-handler options              *
 *************************************************/
 static void
-fn_smtp_receive_timeout(const uschar * name, const uschar * str)
+fn_smtp_receive_timeout(const uschar * name, const uschar * str, unsigned flags)
 {
-if (*str == '$')
+if (flags & opt_fn_print)
+  {
+  if (flags & opt_fn_print_label) printf("%s = ", name);
+  printf("%s\n", smtp_receive_timeout_s
+    ? string_printing2(smtp_receive_timeout_s, FALSE)
+    : readconf_printtime(smtp_receive_timeout));
+  }
+else if (*str == '$')
   smtp_receive_timeout_s = string_copy(str);
 else
   {
@@ -2328,7 +2338,7 @@ switch (type)
   case opt_func:
     {
     void (*fn)() = ol->value;
-    fn(name, s);
+    fn(name, s, 0);
     break;
     }
   }
@@ -2670,6 +2680,13 @@ switch(ol->type & opt_mask)
   case opt_bool_set:
     printf("%s%s\n", (*((BOOL *)value))? "" : "no_", name);
     break;
+
+  case opt_func:
+    {
+    void (*fn)() = ol->value;
+    fn(name, NULL, no_labels ? opt_fn_print : opt_fn_print|opt_fn_print_label);
+    break;
+    }
   }
 return TRUE;
 }