aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-02 15:20:31 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-02 15:20:31 +0100
commit6b8faf40fbacbcfc85ab1f9a4bc2e22f4a61c463 (patch)
tree6122c84b4a890e96e4cbdcc89b223cbe3ce592b5
parent1f95ccccae7d0ef3ae431a8f26b86faeb5633491 (diff)
downloadrspamd-6b8faf40fbacbcfc85ab1f9a4bc2e22f4a61c463.tar.gz
rspamd-6b8faf40fbacbcfc85ab1f9a4bc2e22f4a61c463.zip
Add default options for options section.
-rw-r--r--src/cfg_rcl.c42
-rw-r--r--src/cfg_rcl.h2
2 files changed, 41 insertions, 3 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c
index b1c7a522c..077c63d49 100644
--- a/src/cfg_rcl.c
+++ b/src/cfg_rcl.c
@@ -247,6 +247,44 @@ rspamd_rcl_config_init (void)
*/
sub = rspamd_rcl_add_section (new, "options", rspamd_rcl_empty_handler, RSPAMD_CL_OBJECT,
FALSE, TRUE);
+ rspamd_rcl_add_default_handler (sub, "statfile_pool_size", rspamd_rcl_parse_struct_integer,
+ G_STRUCT_OFFSET (struct config_file, max_statfile_size), RSPAMD_CL_FLAG_INT_SIZE);
+ rspamd_rcl_add_default_handler (sub, "cache_file", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, cache_filename), 0);
+ rspamd_rcl_add_default_handler (sub, "dns_timeout", rspamd_rcl_parse_struct_time,
+ G_STRUCT_OFFSET (struct config_file, dns_timeout), RSPAMD_CL_FLAG_TIME_INTEGER);
+ rspamd_rcl_add_default_handler (sub, "dns_retransmits", rspamd_rcl_parse_struct_integer,
+ G_STRUCT_OFFSET (struct config_file, dns_retransmits), RSPAMD_CL_FLAG_INT_32);
+ rspamd_rcl_add_default_handler (sub, "raw_mode", rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct config_file, raw_mode), 0);
+ rspamd_rcl_add_default_handler (sub, "one_shot", rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct config_file, one_shot_mode), 0);
+ rspamd_rcl_add_default_handler (sub, "check_attachements", rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct config_file, check_text_attachements), 0);
+ rspamd_rcl_add_default_handler (sub, "tempdir", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, temp_dir), 0);
+ rspamd_rcl_add_default_handler (sub, "pidfile", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, pid_file), 0);
+ rspamd_rcl_add_default_handler (sub, "filters", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, filters_str), 0);
+ rspamd_rcl_add_default_handler (sub, "sync_interval", rspamd_rcl_parse_struct_time,
+ G_STRUCT_OFFSET (struct config_file, statfile_sync_interval), RSPAMD_CL_FLAG_TIME_INTEGER);
+ rspamd_rcl_add_default_handler (sub, "sync_timeout", rspamd_rcl_parse_struct_time,
+ G_STRUCT_OFFSET (struct config_file, statfile_sync_timeout), RSPAMD_CL_FLAG_TIME_INTEGER);
+ rspamd_rcl_add_default_handler (sub, "max_diff", rspamd_rcl_parse_struct_integer,
+ G_STRUCT_OFFSET (struct config_file, max_diff), RSPAMD_CL_FLAG_INT_SIZE);
+ rspamd_rcl_add_default_handler (sub, "map_watch_interval", rspamd_rcl_parse_struct_time,
+ G_STRUCT_OFFSET (struct config_file, map_timeout), RSPAMD_CL_FLAG_TIME_FLOAT);
+ rspamd_rcl_add_default_handler (sub, "dynamic_conf", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, dynamic_conf), 0);
+ rspamd_rcl_add_default_handler (sub, "rrd", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, rrd_file), 0);
+ rspamd_rcl_add_default_handler (sub, "history_file", rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct config_file, history_file), 0);
+ rspamd_rcl_add_default_handler (sub, "use_mlock", rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct config_file, mlock_statfile_pool), 0);
+
+
return new;
}
@@ -411,7 +449,7 @@ rspamd_rcl_parse_struct_integer (struct config_file *cfg, rspamd_cl_object_t *ob
}
*target.i64p = val;
}
- else if (pd->flags == RSPAMD_CL_FLAG_SIZE) {
+ else if (pd->flags == RSPAMD_CL_FLAG_INT_SIZE) {
target.sp = (gsize *)(((gchar *)pd->user_struct) + pd->offset);
if (!rspamd_cl_obj_toint_safe (obj, &val)) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "cannot convert param to integer");
@@ -490,7 +528,7 @@ rspamd_rcl_parse_struct_time (struct config_file *cfg, rspamd_cl_object_t *obj,
}
else if (pd->flags == RSPAMD_CL_FLAG_TIME_INTEGER) {
target.psec = (gint *)(((gchar *)pd->user_struct) + pd->offset);
- *target.psec = val;
+ *target.psec = val * 1000;
}
else {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "invalid flags to parse time value");
diff --git a/src/cfg_rcl.h b/src/cfg_rcl.h
index 7d232cee6..223431d79 100644
--- a/src/cfg_rcl.h
+++ b/src/cfg_rcl.h
@@ -48,7 +48,7 @@ struct rspamd_rcl_struct_parser {
RSPAMD_CL_FLAG_INT_16 = 0x1 << 4,
RSPAMD_CL_FLAG_INT_32 = 0x1 << 5,
RSPAMD_CL_FLAG_INT_64 = 0x1 << 6,
- RSPAMD_CL_FLAG_SIZE = 0x1 << 7
+ RSPAMD_CL_FLAG_INT_SIZE = 0x1 << 7
} flags;
};