]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Use is_config_binary() where CONFIG_BINARY macro does not propagate
authorMarco Bettini <marco.bettini@open-xchange.com>
Wed, 30 Mar 2022 15:28:24 +0000 (15:28 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Thu, 7 Apr 2022 12:52:23 +0000 (12:52 +0000)
Not all the *-settings.c sources are embeded in the generated all-settings.c
source file, which is the only scope where the CONFIG_BINARY macro is defined.
This specifically applies to master-service-ssl-settings.c which contained
code never activated by the #ifdef(s) on the macro as this file is not part
of the synthesized code.

src/config/main.c
src/lib-master/master-service-ssl-settings.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index 01a80ba827de5e414df649b25f3e991f836fcf54..13dc76d26403dbcc53a59c0ecfbcf498e287590c 100644 (file)
@@ -30,6 +30,7 @@ int main(int argc, char *argv[])
        restrict_access_by_env(RESTRICT_ACCESS_FLAG_ALLOW_ROOT, NULL);
        restrict_access_allow_coredumps(TRUE);
 
+       set_config_binary(TRUE);
        config_parse_load_modules();
 
        path = master_service_get_config_path(master_service);
index 5da607daf1a53cea2fb9b3677c2acc53ec886887..2f25c9f8597fb3606793be37a9629ff985866f2b 100644 (file)
@@ -136,14 +136,12 @@ master_service_ssl_settings_check(void *_set, pool_t pool ATTR_UNUSED,
           and few of those tools care about SSL settings. so don't check
           ssl_cert/ssl_key/etc validity here except in doveconf, because it
           usually is just an extra annoyance. */
-#ifdef CONFIG_BINARY
-       T_BEGIN {
+       if (is_config_binary()) T_BEGIN {
                const char *proto = t_str_ucase(set->ssl_min_protocol);
                if (strstr(proto, "ANY") != NULL)
                        i_warning("ssl_min_protocol=ANY is used - This is "
-                                       "insecure and intended only for testing");
+                                 "insecure and intended only for testing");
        } T_END;
-#endif
 
        if (set->ssl_verify_client_cert && *set->ssl_ca == '\0') {
                *error_r = "ssl_verify_client_cert set, but ssl_ca not";
index 1675740afaf369f619d728446b6835b8b21da7e2..a64ee66cb194bb3e442bb4d0a31af2a5049c03a8 100644 (file)
@@ -2232,3 +2232,15 @@ const char *settings_section_escape(const char *name)
        return str_c(str);
 }
 
+static bool config_binary = FALSE;
+
+bool is_config_binary(void)
+{
+       return config_binary;
+}
+
+void set_config_binary(bool value)
+{
+       config_binary = value;
+}
+
index 21d00604d6cf1d4b2e98785b800785a0fd02801e..81ce318aa10d2f999d613bf584a596f58fff7ba1 100644 (file)
@@ -280,4 +280,8 @@ int settings_get_size(const char *str, uoff_t *bytes_r,
 /* Parse boolean string, return as boolean */
 int settings_get_bool(const char *value, bool *result_r,
                      const char **error_r);
+
+void set_config_binary(bool value);
+bool is_config_binary(void);
+
 #endif