summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_map.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-23 10:38:55 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-23 10:42:05 +0100
commit12383cf84693cf54874ce8a33f0e1d26d1a6b1a4 (patch)
tree3997feaeb606f969bfe5f2d0655328637e0d73f1 /src/lua/lua_map.c
parent79f15b27c647f6a7028b6167f9c243ca3f6fa96a (diff)
downloadrspamd-12383cf84693cf54874ce8a33f0e1d26d1a6b1a4.tar.gz
rspamd-12383cf84693cf54874ce8a33f0e1d26d1a6b1a4.zip
[Feature] Implement glob maps in addition to regexp maps
Diffstat (limited to 'src/lua/lua_map.c')
-rw-r--r--src/lua/lua_map.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c
index e01c1308d..7325dbf0e 100644
--- a/src/lua/lua_map.c
+++ b/src/lua/lua_map.c
@@ -547,6 +547,21 @@ lua_config_add_map (lua_State *L)
return 1;
}
}
+ else if (strcmp (type, "glob") == 0) {
+ map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
+ map->data.re_map = NULL;
+ map->type = RSPAMD_LUA_MAP_REGEXP;
+
+ if ((m = rspamd_map_add_from_ucl (cfg, map_obj, description,
+ rspamd_glob_list_read_single,
+ rspamd_regexp_list_fin,
+ (void **) &map->data.re_map)) == NULL) {
+ lua_pushnil (L);
+ ucl_object_unref (map_obj);
+
+ return 1;
+ }
+ }
else {
ret = luaL_error (L, "invalid arguments: unknown type '%s'", type);
ucl_object_unref (map_obj);