TLS: move from SUPPORT_TLS to DISABLE_TLS macro for the build
[exim.git] / src / src / readconf.c
index d7e9d30fa1d860096757b6d8223da3893b665536..cffee4a0803afd437734f9443815a070da5dae3c 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           *
@@ -60,7 +60,7 @@ static optionlist optionlist_config[] = {
   { "acl_smtp_predata",         opt_stringptr,   &acl_smtp_predata },
   { "acl_smtp_quit",            opt_stringptr,   &acl_smtp_quit },
   { "acl_smtp_rcpt",            opt_stringptr,   &acl_smtp_rcpt },
-#ifdef SUPPORT_TLS
+#ifndef DISABLE_TLS
   { "acl_smtp_starttls",        opt_stringptr,   &acl_smtp_starttls },
 #endif
   { "acl_smtp_vrfy",            opt_stringptr,   &acl_smtp_vrfy },
@@ -149,13 +149,14 @@ static optionlist optionlist_config[] = {
   { "exim_group",               opt_gid,         &exim_gid },
   { "exim_path",                opt_stringptr,   &exim_path },
   { "exim_user",                opt_uid,         &exim_uid },
+  { "exim_version",             opt_stringptr,   &version_string },
   { "extra_local_interfaces",   opt_stringptr,   &extra_local_interfaces },
   { "extract_addresses_remove_arguments", opt_bool, &extract_addresses_remove_arguments },
   { "finduser_retries",         opt_int,         &finduser_retries },
   { "freeze_tell",              opt_stringptr,   &freeze_tell },
   { "gecos_name",               opt_stringptr,   &gecos_name },
   { "gecos_pattern",            opt_stringptr,   &gecos_pattern },
-#ifdef SUPPORT_TLS
+#ifndef DISABLE_TLS
   { "gnutls_allow_auto_pkcs11", opt_bool,        &gnutls_allow_auto_pkcs11 },
   { "gnutls_compat_mode",       opt_bool,        &gnutls_compat_mode },
 #endif
@@ -223,7 +224,7 @@ static optionlist optionlist_config[] = {
   { "mysql_servers",            opt_stringptr,   &mysql_servers },
 #endif
   { "never_users",              opt_uidlist,     &never_users },
-#ifdef SUPPORT_TLS
+#ifndef DISABLE_TLS
   { "openssl_options",          opt_stringptr,   &openssl_options },
 #endif
 #ifdef LOOKUP_ORACLE
@@ -354,10 +355,7 @@ static optionlist optionlist_config[] = {
   { "timeout_frozen_after",     opt_time,        &timeout_frozen_after },
   { "timezone",                 opt_stringptr,   &timezone_string },
   { "tls_advertise_hosts",      opt_stringptr,   &tls_advertise_hosts },
-#ifdef SUPPORT_TLS
-# ifdef EXPERIMENTAL_REQUIRETLS
-  { "tls_advertise_requiretls", opt_stringptr,   &tls_advertise_requiretls },
-# endif
+#ifndef DISABLE_TLS
   { "tls_certificate",          opt_stringptr,   &tls_certificate },
   { "tls_crl",                  opt_stringptr,   &tls_crl },
   { "tls_dh_max_bits",          opt_int,         &tls_dh_max_bits },
@@ -370,6 +368,9 @@ static optionlist optionlist_config[] = {
   { "tls_privatekey",           opt_stringptr,   &tls_privatekey },
   { "tls_remember_esmtp",       opt_bool,        &tls_remember_esmtp },
   { "tls_require_ciphers",      opt_stringptr,   &tls_require_ciphers },
+# ifdef EXPERIMENTAL_TLS_RESUME
+  { "tls_resumption_hosts",     opt_stringptr,   &tls_resumption_hosts },
+# endif
   { "tls_try_verify_hosts",     opt_stringptr,   &tls_try_verify_hosts },
   { "tls_verify_certificates",  opt_stringptr,   &tls_verify_certificates },
   { "tls_verify_hosts",         opt_stringptr,   &tls_verify_hosts },
@@ -392,7 +393,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)
@@ -557,6 +559,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)
 
 
 /*************************************************
@@ -959,7 +963,7 @@ for (;;)
 
   /* Handle conditionals, which are also applied to physical lines. Conditions
   are of the form ".ifdef ANYTEXT" and are treated as true if any macro
-  expansion occured on the rest of the line. A preliminary test for the leading
+  expansion occurred on the rest of the line. A preliminary test for the leading
   '.' saves effort on most lines. */
 
   if (*ss == '.')
@@ -1525,9 +1529,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
   {
@@ -2123,7 +2134,7 @@ switch (type)
   inttype = US"octal ";
 
   /*  Integer: a simple(ish) case; allow octal and hex formats, and
-  suffixes K, M and G. The different types affect output, not input. */
+  suffixes K, M, G, and T.  The different types affect output, not input. */
 
   case opt_mkint:
   case opt_int:
@@ -2140,7 +2151,7 @@ switch (type)
 
     if (errno != ERANGE && *endptr)
       {
-      uschar * mp = US"GgMmKk\0";      /* YyZzEePpTtGgMmKk */
+      uschar * mp = US"TtGgMmKk\0";    /* YyZzEePpTtGgMmKk */
 
       if ((mp = Ustrchr(mp, *endptr)))
        {
@@ -2175,8 +2186,7 @@ switch (type)
     *(int *)ol->value = value;
   break;
 
-  /*  Integer held in K: again, allow octal and hex formats, and suffixes K, M,
-  G and T. */
+  /*  Integer held in K: again, allow formats and suffixes as above. */
 
   case opt_Kint:
     {
@@ -2190,12 +2200,12 @@ switch (type)
 
     if (errno != ERANGE && *endptr)
       {
-      uschar * mp = US"EePpTtGgMmKk\0";        /* YyZzEePpTtGgMmKk */
+      uschar * mp = US"ZzEePpTtGgMmKk\0";      /* YyZzEePpTtGgMmKk */
 
       if ((mp = Ustrchr(mp, *endptr)))
        {
        endptr++;
-       do
+       while (*(mp += 2))
          {
          if (lvalue > EXIM_ARITH_MAX/1024 || lvalue < EXIM_ARITH_MIN/1024)
            {
@@ -2204,7 +2214,6 @@ switch (type)
            }
          lvalue *= 1024;
          }
-       while (*(mp += 2));
        }
       else
        lvalue = (lvalue + 512)/1024;
@@ -2323,7 +2332,7 @@ switch (type)
   case opt_func:
     {
     void (*fn)() = ol->value;
-    fn(name, s);
+    fn(name, s, 0);
     break;
     }
   }
@@ -2482,6 +2491,7 @@ switch(ol->type & opt_mask)
     int_eximarith_t x = *((int_eximarith_t *)value);
     if (!no_labels) printf("%s = ", name);
     if (x == 0) printf("0\n");
+    else if ((x & ((1<<30)-1)) == 0) printf(PR_EXIM_ARITH "T\n", x >> 30);
     else if ((x & ((1<<20)-1)) == 0) printf(PR_EXIM_ARITH "G\n", x >> 20);
     else if ((x & ((1<<10)-1)) == 0) printf(PR_EXIM_ARITH "M\n", x >> 10);
     else printf(PR_EXIM_ARITH "K\n", x);
@@ -2661,6 +2671,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;
 }
@@ -3065,7 +3082,7 @@ Assumes:  tls_require_ciphers has been set, if it will be
 Returns:  bool for "okay"; false will cause caller to immediately exit.
 */
 
-#ifdef SUPPORT_TLS
+#ifndef DISABLE_TLS
 static BOOL
 tls_dropprivs_validate_require_cipher(BOOL nowarn)
 {
@@ -3118,7 +3135,7 @@ signal(SIGCHLD, oldsignal);
 
 return status == 0;
 }
-#endif /* SUPPORT_TLS */
+#endif /*DISABLE_TLS*/
 
 
 
@@ -3605,7 +3622,7 @@ if (host_number_string)
   host_number = n;
   }
 
-#ifdef SUPPORT_TLS
+#ifndef DISABLE_TLS
 /* If tls_verify_hosts is set, tls_verify_certificates must also be set */
 
 if ((tls_verify_hosts || tls_try_verify_hosts) && !tls_verify_certificates)
@@ -3638,7 +3655,7 @@ if (openssl_options)
       "openssl_options parse error: %s", openssl_options);
 # endif
   }
-#endif /*SUPPORT_TLS*/
+#endif /*DISABLE_TLS*/
 
 if (!nowarn && !keep_environment && environ && *environ)
   log_write(0, LOG_MAIN,