summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-05-16 11:41:53 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-05-16 11:41:53 +0100
commit68a07a2c1d66746a9265ddcf539c494b96a5f63f (patch)
tree590ba9c712c4195ae06982fb75983c0fc99cceb4 /src
parent27a70696afb78709e2d528ca033e4ba1cc85c7c8 (diff)
downloadrspamd-68a07a2c1d66746a9265ddcf539c494b96a5f63f.tar.gz
rspamd-68a07a2c1d66746a9265ddcf539c494b96a5f63f.zip
[Minor] Fix newindex
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_config.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index b0e2a475c..680203c1e 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -2729,7 +2729,7 @@ lua_config_newindex (lua_State *L)
/* Deal with flags and ids */
lua_pushstring (L, "flags");
- lua_gettable (L, 2);
+ lua_gettable (L, -2);
if (lua_type(L, -1) == LUA_TSTRING) {
flags = lua_parse_symbol_flags (lua_tostring (L, -1));
}
@@ -2741,7 +2741,7 @@ lua_config_newindex (lua_State *L)
lua_pop (L, 1); /* Clean flags */
lua_pushstring(L, "allowed_ids");
- lua_gettable (L, 2);
+ lua_gettable (L, -2);
if (lua_type(L, -1) == LUA_TSTRING) {
allowed_ids = rspamd_process_id_list(lua_tostring (L, -1));
}
@@ -2755,6 +2755,21 @@ lua_config_newindex (lua_State *L)
}
lua_pop (L, 1);
+ lua_pushstring(L, "forbidden_ids");
+ lua_gettable (L, -2);
+ if (lua_type(L, -1) == LUA_TSTRING) {
+ forbidden_ids = rspamd_process_id_list(lua_tostring (L, -1));
+ }
+ else if (lua_type(L, -1) == LUA_TTABLE) {
+ forbidden_ids = g_array_sized_new(FALSE, FALSE, sizeof (guint32),
+ rspamd_lua_table_size(L, -1));
+ for (lua_pushnil (L); lua_next (L, -2); lua_pop (L, 1)) {
+ guint32 v = lua_tointeger(L, -1);
+ g_array_append_val(forbidden_ids, v);
+ }
+ }
+ lua_pop (L, 1);
+
id = rspamd_register_symbol_fromlua (L,
cfg,
name,