]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-command - Emit smtp_server_command_started event a little later.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sun, 14 Nov 2021 22:27:00 +0000 (23:27 +0100)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Sun, 14 Nov 2021 22:27:00 +0000 (23:27 +0100)
This way cmd_*args fields are available for the event.

src/lib-smtp/smtp-server-command.c

index ff7a313c6dbeae41de02ee1a13bd8e36f2a05f6c..e40de9f8d687bd5e013f363265d9b1a6f56924bd 100644 (file)
@@ -186,10 +186,7 @@ smtp_server_command_new_invalid(struct smtp_server_connection *conn)
        cmd = smtp_server_command_alloc(conn);
        smtp_server_command_update_event(cmd);
 
-       struct event_passthrough *e =
-               event_create_passthrough(cmd->context.event)->
-               set_name("smtp_server_command_started");
-       e_debug(e->event(), "Invalid command");
+       e_debug(cmd->context.event, "Invalid command");
 
        return cmd;
 }
@@ -207,10 +204,7 @@ smtp_server_command_new(struct smtp_server_connection *conn,
 
        smtp_server_command_update_event(cmd);
 
-       struct event_passthrough *e =
-               event_create_passthrough(cmd->context.event)->
-               set_name("smtp_server_command_started");
-       e_debug(e->event(), "New command");
+       e_debug(cmd->context.event, "New command");
 
        return cmd;
 }
@@ -225,6 +219,11 @@ void smtp_server_command_execute(struct smtp_server_command *cmd,
                event_add_str(cmd->context.event, "cmd_human_args", params);
        }
 
+       struct event_passthrough *e =
+               event_create_passthrough(cmd->context.event)->
+               set_name("smtp_server_command_started");
+       e_debug(e->event(), "Execute command");
+
        if (cmd->reg == NULL) {
                /* RFC 5321, Section 4.2.4: Reply Code 502