]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-cmd-auth - Fix AUTH response error handling so that it stops...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 25 Apr 2019 07:51:32 +0000 (09:51 +0200)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 25 Apr 2019 08:31:43 +0000 (10:31 +0200)
Otherwise, it may try to read more data from the stream as the next AUTH
response, which causes an assert crash in the command parser later on. Even when
the parser finds no input from the stream, it will advance its state
towards AUTH response parsing, which is a problem when the next command is
subsequently being parsed.

Panic was:

Panic: file smtp-command-parser.c: line 438 (smtp_command_parse_next): assertion failed: (!parser->auth_response || parser->state.state == SMTP_COMMAND_PARSE_STATE_INIT || parser->state.state == SMTP_COMMAND_PARSE_STATE_ERROR)

src/lib-smtp/smtp-server-cmd-auth.c

index 74a219787d4adda2cc862dc3851f51c031d5e04a..1490340d5d34a486e70dfcbb9cf761fee402b874 100644 (file)
@@ -99,6 +99,7 @@ static void cmd_auth_input(struct smtp_server_cmd_ctx *cmd)
                        e_debug(conn->event,
                                "Client sent invalid AUTH response: %s", error);
 
+                       smtp_server_command_input_lock(cmd);
                        switch (error_code) {
                        case SMTP_COMMAND_PARSE_ERROR_BROKEN_COMMAND:
                                conn->input_broken = TRUE;