]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-lua - Deref script in auth_lua_call_passdb_lookup() only once
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Thu, 17 Dec 2020 22:47:03 +0000 (17:47 -0500)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 15 Jan 2021 14:56:37 +0000 (14:56 +0000)
src/auth/db-lua.c

index 0abef4e1ad2658d34d10f31b90960fa5c8ca4cd9..37822e6a2cdfeb24f5da0d6f8e4d3f2b42b58cc3 100644 (file)
@@ -646,14 +646,16 @@ auth_lua_call_passdb_lookup(struct dlua_script *script,
                            struct auth_request *req, const char **scheme_r,
                            const char **password_r, const char **error_r)
 {
+       lua_State *L = script->L;
+
        *scheme_r = *password_r = NULL;
-       if (auth_lua_call_lookup(script->L, AUTH_LUA_PASSDB_LOOKUP, req, error_r) < 0) {
-               lua_gc(script->L, LUA_GCCOLLECT, 0);
-               i_assert(lua_gettop(script->L) == 0);
+       if (auth_lua_call_lookup(L, AUTH_LUA_PASSDB_LOOKUP, req, error_r) < 0) {
+               lua_gc(L, LUA_GCCOLLECT, 0);
+               i_assert(lua_gettop(L) == 0);
                return PASSDB_RESULT_INTERNAL_FAILURE;
        }
 
-       return auth_lua_call_lookup_finish(script->L, req, scheme_r, password_r, error_r);
+       return auth_lua_call_lookup_finish(L, req, scheme_r, password_r, error_r);
 }