summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_map.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-26 14:12:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-26 14:12:52 +0100
commit0329cde5bda00eaf4ede9ebc9948937766ac002d (patch)
treeb057064c0d06d9f2f08b0fbd86fea7e7024074c6 /src/lua/lua_map.c
parentca2d20981bc6061df455f7f7a2ccb787ad595783 (diff)
downloadrspamd-0329cde5bda00eaf4ede9ebc9948937766ac002d.tar.gz
rspamd-0329cde5bda00eaf4ede9ebc9948937766ac002d.zip
[Minor] Link map and lua_map object
Diffstat (limited to 'src/lua/lua_map.c')
-rw-r--r--src/lua/lua_map.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c
index 8ac41bef4..27e79ac2b 100644
--- a/src/lua/lua_map.c
+++ b/src/lua/lua_map.c
@@ -138,6 +138,7 @@ lua_config_add_radix_map (lua_State *L)
}
map->map = m;
+ m->lua_map = map;
pmap = lua_newuserdata (L, sizeof (void *));
*pmap = map;
rspamd_lua_setclass (L, "rspamd{map}", -1);
@@ -195,6 +196,7 @@ lua_config_radix_from_config (lua_State *L)
ucl_object_unref (fake_obj);
pmap = lua_newuserdata (L, sizeof (void *));
map->map = m;
+ m->lua_map = map;
*pmap = map;
rspamd_lua_setclass (L, "rspamd{map}", -1);
}
@@ -253,6 +255,7 @@ lua_config_radix_from_ucl (lua_State *L)
ucl_object_unref (fake_obj);
pmap = lua_newuserdata (L, sizeof (void *));
map->map = m;
+ m->lua_map = map;
*pmap = map;
rspamd_lua_setclass (L, "rspamd{map}", -1);
@@ -289,6 +292,7 @@ lua_config_add_hash_map (lua_State *L)
}
map->map = m;
+ m->lua_map = map;
pmap = lua_newuserdata (L, sizeof (void *));
*pmap = map;
rspamd_lua_setclass (L, "rspamd{map}", -1);
@@ -327,6 +331,7 @@ lua_config_add_kv_map (lua_State *L)
}
map->map = m;
+ m->lua_map = map;
pmap = lua_newuserdata (L, sizeof (void *));
*pmap = map;
rspamd_lua_setclass (L, "rspamd{map}", -1);
@@ -472,6 +477,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else if (strcmp (type, "set") == 0) {
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
@@ -487,6 +493,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else if (strcmp (type, "map") == 0 || strcmp (type, "hash") == 0) {
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
@@ -502,6 +509,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else if (strcmp (type, "radix") == 0) {
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
@@ -517,6 +525,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else if (strcmp (type, "regexp") == 0) {
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
@@ -532,6 +541,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else if (strcmp (type, "regexp_multi") == 0) {
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
@@ -547,6 +557,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else if (strcmp (type, "glob") == 0) {
map = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (*map));
@@ -562,6 +573,7 @@ lua_config_add_map (lua_State *L)
return 1;
}
+ m->lua_map = map;
}
else {
ret = luaL_error (L, "invalid arguments: unknown type '%s'", type);