aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-24 17:35:06 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-24 17:35:06 +0100
commit3efef0fad233598784af91407f7acda08026265b (patch)
tree44495508ecd0479b12427c84a3a1ef1ad3291b6f
parentc28687631ba49d7339ca728c4255194911ecca98 (diff)
downloadrspamd-3efef0fad233598784af91407f7acda08026265b.tar.gz
rspamd-3efef0fad233598784af91407f7acda08026265b.zip
[Fix] Propagate key when import implicit array from Lua
-rw-r--r--contrib/libucl/lua_ucl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/libucl/lua_ucl.c b/contrib/libucl/lua_ucl.c
index 15d41471e..e1a784753 100644
--- a/contrib/libucl/lua_ucl.c
+++ b/contrib/libucl/lua_ucl.c
@@ -297,7 +297,7 @@ ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array)
static ucl_object_t *
ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags)
{
- ucl_object_t *obj, *top = NULL;
+ ucl_object_t *obj, *top = NULL, *cur;
size_t keylen;
const char *k;
bool is_array = true, is_implicit = false, found_mt = false;
@@ -407,6 +407,13 @@ ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags)
if (obj != NULL) {
ucl_object_insert_key (top, obj, k, keylen, true);
+
+ DL_FOREACH (obj, cur) {
+ if (cur->keylen == 0) {
+ cur->keylen = keylen;
+ cur->key = k;
+ }
+ }
}
lua_pop (L, 2);
}