diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-11 12:24:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-11 12:24:29 +0100 |
commit | b38a1ad26bbbc0a40bbdddf2b7d6dea6c3bd049a (patch) | |
tree | f3120ef16c20c103fd14e003303c27b288201ad5 /src/lua | |
parent | a7e4a0407bc316c0c1d19bcf18df0f8a31727a64 (diff) | |
download | rspamd-b38a1ad26bbbc0a40bbdddf2b7d6dea6c3bd049a.tar.gz rspamd-b38a1ad26bbbc0a40bbdddf2b7d6dea6c3bd049a.zip |
[Minor] Add default limit for rbl requests
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_config.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index f047f1530..f75899f08 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -810,6 +810,13 @@ LUA_FUNCTION_DEF (config, init_subsystem); */ LUA_FUNCTION_DEF (config, get_tld_path); +/*** + * @method rspamd_config:get_dns_max_requests() + * Returns limit of DNS requests per task + * @return {number} number of dns requests allowed + */ +LUA_FUNCTION_DEF (config, get_dns_max_requests); + static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, get_module_opt), LUA_INTERFACE_DEF (config, get_mempool), @@ -882,6 +889,7 @@ static const struct luaL_reg configlib_m[] = { LUA_INTERFACE_DEF (config, init_modules), LUA_INTERFACE_DEF (config, init_subsystem), LUA_INTERFACE_DEF (config, get_tld_path), + LUA_INTERFACE_DEF (config, get_dns_max_requests), {"__tostring", rspamd_lua_class_tostring}, {"__newindex", lua_config_newindex}, {NULL, NULL} @@ -4302,6 +4310,22 @@ lua_config_get_tld_path (lua_State *L) } static gint +lua_config_get_dns_max_requests (lua_State *L) +{ + LUA_TRACE_POINT; + struct rspamd_config *cfg = lua_check_config (L, 1); + + if (cfg != NULL) { + lua_pushinteger (L, cfg->dns_max_requests); + } + else { + return luaL_error (L, "invalid arguments"); + } + + return 1; +} + +static gint lua_monitored_alive (lua_State *L) { LUA_TRACE_POINT; |