diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-12 15:44:58 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-12 15:44:58 +0000 |
commit | 3f86aa3aafbc193460cab91ec1657dba0dee1433 (patch) | |
tree | 6646e2e062e8126c464f9a2d2a25097cb34442dd /src/lua/lua_upstream.c | |
parent | 7d3f1e16638e114ad365a1e1647af53e9008e86a (diff) | |
download | rspamd-3f86aa3aafbc193460cab91ec1657dba0dee1433.tar.gz rspamd-3f86aa3aafbc193460cab91ec1657dba0dee1433.zip |
[Minor] Fix table argument parsing
Diffstat (limited to 'src/lua/lua_upstream.c')
-rw-r--r-- | src/lua/lua_upstream.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c index 680b2c61b..e403d34af 100644 --- a/src/lua/lua_upstream.c +++ b/src/lua/lua_upstream.c @@ -210,15 +210,17 @@ lua_upstream_list_create (lua_State *L) rspamd_lua_setclass (L, "rspamd{upstream_list}", -1); *pnew = new; + lua_pushvalue (L, top); + for (lua_pushnil (L); lua_next (L, -2); lua_pop (L, 1)) { def = lua_tostring (L, -1); if (!def || !rspamd_upstreams_parse_line (new, def, default_port, NULL)) { - rspamd_upstreams_destroy (new); - msg_warn ("cannot parse %s", def); - lua_pushnil (L); + msg_warn ("cannot parse upstream %s", def); } } + + lua_pop (L, 1); } else { return luaL_error (L, "invalid arguments"); |