]> 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)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 20 May 2020 07:21:18 +0000 (07:21 +0000)
src/lib-smtp/smtp-server-command.c

index 1ae190e37352f48a76f1e10d2c64a73b490f2a29..c9b551b6ac687b8a37d1c9b72052e552f6389edf 100644 (file)
@@ -394,8 +394,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) {