[exim-cvs] Fix "-bP smtp_receive_timeout". Bug 2384

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Fix "-bP smtp_receive_timeout". Bug 2384
Gitweb: https://git.exim.org/exim.git/commitdiff/e6024a5e9e193f559508d05ee401ae8f7f3c25ae
Commit:     e6024a5e9e193f559508d05ee401ae8f7f3c25ae
Parent:     dbb8fff1d199ba2f88bbbc09a87b883022d77f3f
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri Mar 22 15:00:23 2019 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Mar 22 15:02:44 2019 +0000


    Fix "-bP smtp_receive_timeout".  Bug 2384
---
 doc/doc-txt/ChangeLog |  3 +++
 src/src/readconf.c    | 27 ++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index fa8f467..6217a4d 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -52,6 +52,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
-----------------
diff --git a/src/src/readconf.c b/src/src/readconf.c
index 71cdae8..150d797 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -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           *
@@ -389,7 +389,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)
@@ -554,6 +555,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)



 /*************************************************
@@ -1522,9 +1525,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
   {
@@ -2318,7 +2328,7 @@ switch (type)
   case opt_func:
     {
     void (*fn)() = ol->value;
-    fn(name, s);
+    fn(name, s, 0);
     break;
     }
   }
@@ -2657,6 +2667,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;
 }