]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-command - Guarantee that non-destroy hooks aren't called for...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 24 Mar 2020 11:13:43 +0000 (12:13 +0100)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 1 Apr 2020 08:49:24 +0000 (11:49 +0300)
src/lib-smtp/smtp-server-command.c

index ac25933a64ca403c0e0b95f55ec82b3989dd31ca..a4d0bc70b69189a16af548dc66e256e8304f4fcc 100644 (file)
@@ -389,8 +389,11 @@ bool smtp_server_command_call_hooks(struct smtp_server_command **_cmd,
        struct smtp_server_command *cmd = *_cmd;
        struct smtp_server_command_hook *hook;
 
-       if (type != SMTP_SERVER_COMMAND_HOOK_DESTROY)
+       if (type != SMTP_SERVER_COMMAND_HOOK_DESTROY) {
+               if (cmd->state >= SMTP_SERVER_COMMAND_STATE_FINISHED)
+                       return FALSE;
                smtp_server_command_ref(cmd);
+       }
 
        hook = cmd->hooks_head;
        while (hook != NULL) {