summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_map.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-14 16:55:36 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-14 16:55:36 +0100
commit4ce9dbece67d8497ea2b703d6e966aba71aceb18 (patch)
treef1e6edff93dfbc72f0db1991b80d0400b6ae3fef /src/lua/lua_map.c
parent0d4212eb6cf416c2c02a030195462993bdc84fea (diff)
downloadrspamd-4ce9dbece67d8497ea2b703d6e966aba71aceb18.tar.gz
rspamd-4ce9dbece67d8497ea2b703d6e966aba71aceb18.zip
[Minor] Add glob_multi map type
Diffstat (limited to 'src/lua/lua_map.c')
-rw-r--r--src/lua/lua_map.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c
index 1621abf0d..9cf50f1a2 100644
--- a/src/lua/lua_map.c
+++ b/src/lua/lua_map.c
@@ -639,6 +639,23 @@ lua_config_add_map (lua_State *L)
}
m->lua_map = map;
}
+ else if (strcmp (type, "glob_multi") == 0) {
+ map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
+ map->data.re_map = NULL;
+ map->type = RSPAMD_LUA_MAP_REGEXP_MULTIPLE;
+
+ if ((m = rspamd_map_add_from_ucl (cfg, map_obj, description,
+ rspamd_glob_list_read_multiple,
+ rspamd_regexp_list_fin,
+ rspamd_regexp_list_dtor,
+ (void **) &map->data.re_map)) == NULL) {
+ lua_pushnil (L);
+ ucl_object_unref (map_obj);
+
+ return 1;
+ }
+ m->lua_map = map;
+ }
else {
ret = luaL_error (L, "invalid arguments: unknown type '%s'", type);
ucl_object_unref (map_obj);