]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-lua - Fix invalid stack empty check
authorMarvin W <git@larma.de>
Mon, 16 Nov 2020 19:55:14 +0000 (20:55 +0100)
committerjeff.sipek <jeff.sipek@open-xchange.com>
Wed, 16 Dec 2020 14:06:30 +0000 (14:06 +0000)
3e11b97 introduced assertions to ensure the lua stack is empty after
execution.  In auth_lua_call_password_verify() this check was inserted
*before* popping the error message from the stack, ultimately causing the
assertion to fail every time the lua script has a runtime error, leading to
process crashing.

src/auth/db-lua.c

index 2ce28884a1c66e0df4ffe5153fd831615b060c82..afc3cc21e167386d3b6ac6561b2f7263fdf5cc30 100644 (file)
@@ -627,8 +627,8 @@ auth_lua_call_password_verify(struct dlua_script *script,
                *error_r = t_strdup_printf("db-lua: %s(req, password) failed: %s",
                                           AUTH_LUA_PASSWORD_VERIFY,
                                           lua_tostring(script->L, -1));
-               i_assert(lua_gettop(script->L) == 0);
                lua_pop(script->L, 1);
+               i_assert(lua_gettop(script->L) == 0);
                return PASSDB_RESULT_INTERNAL_FAILURE;
        } else if (!lua_isnumber(script->L, -2)) {
                *error_r = t_strdup_printf("db-lua: %s invalid return value "