Blame SOURCES/dovecot-2.3.13-CVE_2020_25275-part2.patch

2c808a
From eea57c8683325f9767b2eb1b44a0b23352541c1e Mon Sep 17 00:00:00 2001
2c808a
From: Timo Sirainen <timo.sirainen@open-xchange.com>
2c808a
Date: Mon, 17 Aug 2020 17:59:19 +0300
2c808a
Subject: [PATCH] imap: Split off client_command_failed_early()
2c808a
2c808a
---
2c808a
 src/imap/imap-client.c | 19 ++++++++++++++-----
2c808a
 1 file changed, 14 insertions(+), 5 deletions(-)
2c808a
2c808a
diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c
2c808a
index 07b2a8018b..0bf03caa97 100644
2c808a
--- a/src/imap/imap-client.c
2c808a
+++ b/src/imap/imap-client.c
2c808a
@@ -1176,6 +1176,19 @@ bool client_handle_unfinished_cmd(struct client_command_context *cmd)
2c808a
 	return TRUE;
2c808a
 }
2c808a
 
2c808a
+static void
2c808a
+client_command_failed_early(struct client_command_context **_cmd,
2c808a
+			    const char *error)
2c808a
+{
2c808a
+	struct client_command_context *cmd = *_cmd;
2c808a
+
2c808a
+	io_loop_time_refresh();
2c808a
+	command_stats_start(cmd);
2c808a
+	client_send_command_error(cmd, error);
2c808a
+	cmd->param_error = TRUE;
2c808a
+	client_command_free(_cmd);
2c808a
+}
2c808a
+
2c808a
 static bool client_command_input(struct client_command_context *cmd)
2c808a
 {
2c808a
 	struct client *client = cmd->client;
2c808a
@@ -1239,11 +1252,7 @@ static bool client_command_input(struct client_command_context *cmd)
2c808a
 
2c808a
 	if (cmd->func == NULL) {
2c808a
 		/* unknown command */
2c808a
-		io_loop_time_refresh();
2c808a
-		command_stats_start(cmd);
2c808a
-		client_send_command_error(cmd, "Unknown command.");
2c808a
-		cmd->param_error = TRUE;
2c808a
-		client_command_free(&cmd);
2c808a
+		client_command_failed_early(&cmd, "Unknown command.");
2c808a
 		return TRUE;
2c808a
 	} else {
2c808a
 		i_assert(!client->disconnected);