diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-06 20:33:31 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-06 20:33:31 +0400 |
commit | 6af303bd3ab37702ad4a6d50b74e95d2a2808e85 (patch) | |
tree | 044acffcfe2dd8527f914cdeb3949d5e93e70cee /src/lua/lua_config.c | |
parent | 1d63fed447d8b74d81468a57af9773773f654210 (diff) | |
download | rspamd-6af303bd3ab37702ad4a6d50b74e95d2a2808e85.tar.gz rspamd-6af303bd3ab37702ad4a6d50b74e95d2a2808e85.zip |
Add /maps and /getmap commands to webui.
Identify maps by id.
Initialize secure random numbers using openssl.
Add description to maps.
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r-- | src/lua/lua_config.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index ba9dfab37..b84879df0 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -560,14 +560,15 @@ static gint lua_config_add_radix_map (lua_State *L) { struct config_file *cfg = lua_check_config (L); - const gchar *map_line; + const gchar *map_line, *description; radix_tree_t **r, ***ud; if (cfg) { map_line = luaL_checkstring (L, 2); + description = lua_tostring (L, 3); r = memory_pool_alloc (cfg->cfg_pool, sizeof (radix_tree_t *)); *r = radix_tree_create (); - if (!add_map (cfg, map_line, read_radix_list, fin_radix_list, (void **)r)) { + if (!add_map (cfg, map_line, description, read_radix_list, fin_radix_list, (void **)r)) { msg_warn ("invalid radix map %s", map_line); radix_tree_free (*r); lua_pushnil (L); @@ -589,14 +590,15 @@ static gint lua_config_add_hash_map (lua_State *L) { struct config_file *cfg = lua_check_config (L); - const gchar *map_line; + const gchar *map_line, *description; GHashTable **r, ***ud; if (cfg) { map_line = luaL_checkstring (L, 2); + description = lua_tostring (L, 3); r = memory_pool_alloc (cfg->cfg_pool, sizeof (GHashTable *)); *r = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal); - if (!add_map (cfg, map_line, read_host_list, fin_host_list, (void **)r)) { + if (!add_map (cfg, map_line, description, read_host_list, fin_host_list, (void **)r)) { msg_warn ("invalid hash map %s", map_line); g_hash_table_destroy (*r); lua_pushnil (L); @@ -619,14 +621,15 @@ static gint lua_config_add_kv_map (lua_State *L) { struct config_file *cfg = lua_check_config (L); - const gchar *map_line; + const gchar *map_line, *description; GHashTable **r, ***ud; if (cfg) { map_line = luaL_checkstring (L, 2); + description = lua_tostring (L, 3); r = memory_pool_alloc (cfg->cfg_pool, sizeof (GHashTable *)); *r = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal); - if (!add_map (cfg, map_line, read_kv_list, fin_kv_list, (void **)r)) { + if (!add_map (cfg, map_line, description, read_kv_list, fin_kv_list, (void **)r)) { msg_warn ("invalid hash map %s", map_line); g_hash_table_destroy (*r); lua_pushnil (L); |