]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-client - Fix sending of duplicate QUIT command.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 6 Feb 2019 21:34:32 +0000 (22:34 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 4 Apr 2019 10:58:59 +0000 (13:58 +0300)
The command name comparison function was broken after the command was sent. Made
the function robust against addition/removal of CRLF to the command line.

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

index ba04bf7117dcf99e120768f5acc570cb52dad641..1b870cdb112a37d332c7de1cef569451acae49d5 100644 (file)
@@ -169,16 +169,11 @@ bool smtp_client_command_name_equals(struct smtp_client_command *cmd,
        data = cmd->data->data;
        data_len = cmd->data->used;
 
-       if (cmd->state >= SMTP_CLIENT_COMMAND_STATE_SUBMITTED) {
-               /* ignore CRLF, which is added at command submission */
-               i_assert(data_len >= 2);
-               data_len -= 2;
-       }
-
        if (data_len < name_len ||
                i_memcasecmp(data, name, name_len) != 0)
                return FALSE;
-       return (data_len == name_len || data[name_len] == ' ');
+       return (data_len == name_len ||
+               data[name_len] == ' ' || data[name_len] == '\r');
 }
 
 void smtp_client_command_lock(struct smtp_client_command *cmd)