diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-02 18:02:00 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-02 18:02:00 +0100 |
commit | 9145d76eed392cfb7096c5c3879cd05adeeb6e37 (patch) | |
tree | 155318768c596ad76232ef3b17b60f5d5b72f33e /src/lua | |
parent | 70eeb25c715ae22800aa96385221f9d8054be375 (diff) | |
download | rspamd-9145d76eed392cfb7096c5c3879cd05adeeb6e37.tar.gz rspamd-9145d76eed392cfb7096c5c3879cd05adeeb6e37.zip |
[Minor] Export allowed/forbidden ids for symbols
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_config.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 6abddc4ff..db0105cbc 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -3338,6 +3338,36 @@ lua_metric_symbol_inserter (gpointer k, gpointer v, gpointer ud) guint sflags = rspamd_symcache_get_symbol_flags (cbd->cfg->cache, sym); lua_push_symbol_flags (L, sflags, LUA_SYMOPT_FLAG_USE_MAP); + + guint nids; + const guint *allowed_ids = rspamd_symcache_get_allowed_settings_ids (cbd->cfg->cache, + sym, &nids); + + if (allowed_ids && nids > 0) { + lua_createtable (L, nids, 0); + + for (i = 0; i < nids; i ++) { + lua_pushinteger (L, allowed_ids[i]); + lua_rawseti (L, -2, i + 1); + } + + lua_setfield (L, -2, "allowed_ids"); + } + + const guint *forbidden_ids = rspamd_symcache_get_forbidden_settings_ids ( + cbd->cfg->cache, + sym, &nids); + + if (forbidden_ids && nids > 0) { + lua_createtable (L, nids, 0); + + for (i = 0; i < nids; i ++) { + lua_pushinteger (L, forbidden_ids[i]); + lua_rawseti (L, -2, i + 1); + } + + lua_setfield (L, -2, "forbidden_ids"); + } } lua_settable (L, -3); /* Flags -> flags_table */ |