]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-lua - Add method for creating request event
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 21 Feb 2019 12:18:08 +0000 (14:18 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 22 Feb 2019 00:13:47 +0000 (00:13 +0000)
This is needed to make sure that correct event is used when
prefix logging is wanted.

src/auth/db-lua.c

index c6cbcb0142d4820dbc180366293f771a72c2cc9a..2d7497672f77467ddc4da2e1b687e4762ce0878e 100644 (file)
@@ -230,6 +230,15 @@ static int auth_request_lua_password_verify(lua_State *L)
        return 2;
 }
 
+static int auth_request_lua_event(lua_State *L)
+{
+       struct dlua_script *script = dlua_script_from_state(L);
+       struct auth_request *request = auth_lua_check_auth_request(script, 1);
+       struct event *event = event_create(authdb_event(request));
+
+       dlua_push_event(script, event);
+       return 1;
+}
 
 /* put all methods here */
 static const luaL_Reg auth_request_methods[] ={
@@ -240,6 +249,7 @@ static const luaL_Reg auth_request_methods[] ={
        { "log_warning", auth_request_lua_log_warning },
        { "log_error", auth_request_lua_log_error },
        { "password_verify", auth_request_lua_password_verify },
+       { "event", auth_request_lua_event },
        { NULL, NULL }
 };