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