diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-13 17:54:07 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-13 17:54:07 +0000 |
commit | b4ba6f65a0231eae9a777e42e4662b104049554a (patch) | |
tree | 0ded27bdc088df2b2827fac30826c03fc3989fe0 /src/lua/lua_map.c | |
parent | 2f1cf619fc28ed3582cf641201aee3c0dc8c6c84 (diff) | |
download | rspamd-b4ba6f65a0231eae9a777e42e4662b104049554a.tar.gz rspamd-b4ba6f65a0231eae9a777e42e4662b104049554a.zip |
[Minor] Add flag for embedded maps
Diffstat (limited to 'src/lua/lua_map.c')
-rw-r--r-- | src/lua/lua_map.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c index 934d69122..6a2cb4139 100644 --- a/src/lua/lua_map.c +++ b/src/lua/lua_map.c @@ -173,6 +173,7 @@ lua_config_radix_from_config (lua_State *L) map->data.radix = radix_create_compressed (); map->type = RSPAMD_LUA_MAP_RADIX; map->data.radix = radix_create_compressed (); + map->flags |= RSPAMD_LUA_MAP_FLAG_EMBEDDED; radix_add_generic_iplist (ucl_obj_tostring (obj), &map->data.radix); pmap = lua_newuserdata (L, sizeof (void *)); *pmap = map; @@ -507,7 +508,7 @@ lua_map_get_proto (lua_State *L) const gchar *ret = "undefined"; if (map != NULL) { - if (map->map == NULL) { + if ((map->flags & RSPAMD_LUA_MAP_FLAG_EMBEDDED) || map->map == NULL) { ret = "embedded"; } else { @@ -536,6 +537,11 @@ lua_map_get_sign_key (lua_State *L) GString *ret = NULL; if (map != NULL) { + if (map->flags & RSPAMD_LUA_MAP_FLAG_EMBEDDED) { + lua_pushnil (L); + + return 1; + } if (map->map && map->map->trusted_pubkey) { ret = rspamd_pubkey_print (map->map->trusted_pubkey, RSPAMD_KEYPAIR_PUBKEY|RSPAMD_KEYPAIR_BASE32); @@ -568,7 +574,7 @@ lua_map_set_sign_key (lua_State *L) if (map && pk_str) { - if (!map->map) { + if ((map->flags & RSPAMD_LUA_MAP_FLAG_EMBEDDED) || !map->map) { return luaL_error (L, "cannot set key for embedded maps"); } @@ -620,7 +626,7 @@ lua_map_get_uri (lua_State *L) const gchar *ret = "undefined"; if (map != NULL) { - if (map->map == NULL) { + if ((map->flags & RSPAMD_LUA_MAP_FLAG_EMBEDDED) || map->map == NULL) { ret = "embedded"; } else { |