dovecot-1.1: deliver: Kludge more to get boolean settings with "...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 9 06:11:44 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/066e7def5fe2
changeset: 7619:066e7def5fe2
user: Timo Sirainen <tss at iki.fi>
date: Mon Jun 09 06:11:38 2008 +0300
description:
deliver: Kludge more to get boolean settings with "yes" as default value to
work correctly.
diffstat:
1 file changed, 27 insertions(+), 2 deletions(-)
src/deliver/deliver.c | 29 +++++++++++++++++++++++++++--
diffs (61 lines):
diff -r 41ad0996c84c -r 066e7def5fe2 src/deliver/deliver.c
--- a/src/deliver/deliver.c Mon Jun 09 06:04:01 2008 +0300
+++ b/src/deliver/deliver.c Mon Jun 09 06:11:38 2008 +0300
@@ -273,6 +273,18 @@ static bool setting_is_bool(const char *
return FALSE;
}
+/* more ugly kludging because we have our own config parsing code.
+ hopefully this goes away in v1.2. */
+static struct {
+ const char *name;
+ bool set;
+} default_yes_settings[] = {
+ { "dotlock_use_excl", TRUE },
+ { "maildir_copy_with_hardlinks", TRUE },
+ { "mbox_dirty_syncs", TRUE },
+ { "mbox_lazy_writes", TRUE }
+};
+
static void config_file_init(const char *path)
{
struct istream *input;
@@ -282,7 +294,7 @@ static void config_file_init(const char
bool lda_section = FALSE, pop3_section = FALSE, plugin_section = FALSE;
bool ns_section = FALSE, ns_location = FALSE, ns_list = FALSE;
bool ns_subscriptions = FALSE;
- unsigned int ns_idx = 0;
+ unsigned int i, ns_idx = 0;
size_t len;
plugin_pool = pool_alloconly_create("Plugin strings", 512);
@@ -412,8 +424,14 @@ static void config_file_init(const char
value = str_unescape(p_strndup(unsafe_data_stack_pool,
value+1, len - 2));
}
- if (setting_is_bool(key) && strcasecmp(value, "yes") != 0)
+ if (setting_is_bool(key) && strcasecmp(value, "yes") != 0) {
+ for (i = 0; i < N_ELEMENTS(default_yes_settings); i++) {
+ if (strcmp(default_yes_settings[i].name,
+ key) == 0)
+ default_yes_settings[i].set = FALSE;
+ }
continue;
+ }
if (!plugin_section) {
env_put(t_strconcat(t_str_ucase(key), "=",
@@ -427,6 +445,13 @@ static void config_file_init(const char
}
}
i_stream_unref(&input);
+
+ for (i = 0; i < N_ELEMENTS(default_yes_settings); i++) {
+ if (default_yes_settings[i].set) {
+ key = default_yes_settings[i].name;
+ env_put(t_strconcat(t_str_ucase(key), "=1", NULL));
+ }
+ }
}
static const struct var_expand_table *
More information about the dovecot-cvs
mailing list