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

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