]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-lua - Do not assert-crash if given parameter was not auth_request
authorAki Tuomi <aki.tuomi@dovecot.fi>
Sat, 20 Jan 2018 13:44:56 +0000 (15:44 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Mar 2018 07:05:03 +0000 (09:05 +0200)
Use luaL_error instead that will back out more gracefully.

Fixes Panic: file db-lua.c: line 279 (auth_lua_check_auth_request): assertion failed: (lua_istable(script->L, arg))

src/auth/db-lua.c

index c7bee974dedc85d7312252f53aaa35fde401c6a1..1c602f0942f2659d002f8c02b394a14a4c2d2087 100644 (file)
@@ -275,7 +275,11 @@ static void auth_lua_push_auth_request(struct dlua_script *script, struct auth_r
 static struct auth_request *
 auth_lua_check_auth_request(struct dlua_script *script, int arg)
 {
-       i_assert(lua_istable(script->L, arg));
+       if (!lua_istable(script->L, arg)) {
+               (void)luaL_error(script->L, "Bad argument #%d, expected %s got %s",
+                                arg, "auth_request",
+                                lua_typename(script->L, lua_type(script->L, arg)));
+       }
        lua_pushstring(script->L, "item");
        lua_rawget(script->L, arg);
        void *bp = (void*)lua_touserdata(script->L, -1);