]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Remove X-STATE command
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Wed, 9 Feb 2022 09:04:36 +0000 (10:04 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 11 Feb 2022 13:34:35 +0000 (13:34 +0000)
This was a Dovecot-specific extension that never even worked. It simply
answered "NO Command is disabled for now."

src/imap/Makefile.am
src/imap/cmd-x-state.c [deleted file]
src/imap/imap-commands.c
src/imap/imap-commands.h
src/imap/imap-state.c
src/imap/imap-state.h

index 0a45fd3926c016e24c769b4ad72e0a291511307b..3570b66b75ecaf77b996448f6976f106a5e01153 100644 (file)
@@ -65,8 +65,7 @@ cmds = \
        cmd-unselect.c \
        cmd-unsubscribe.c \
        cmd-urlfetch.c \
-       cmd-x-cancel.c \
-       cmd-x-state.c
+       cmd-x-cancel.c
 
 common_sources = \
        $(cmds) \
diff --git a/src/imap/cmd-x-state.c b/src/imap/cmd-x-state.c
deleted file mode 100644 (file)
index 8809998..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
-
-#include "imap-common.h"
-#include "base64.h"
-#include "str.h"
-#include "imap-commands.h"
-#include "imap-state.h"
-
-bool cmd_x_state(struct client_command_context *cmd)
-{
-       /* FIXME: state importing can cause unnecessarily large memory usage
-          by specifying an old modseq, because the EXPUNGE/FETCH replies
-          aren't currently sent asynchronously. so this command is disabled
-          for now. */
-#if 0
-       const struct imap_arg *args;
-       const char *str, *error;
-       buffer_t *state, *state_encoded;
-       int ret;
-
-       if (!client_read_args(cmd, 0, 0, &args))
-               return FALSE;
-
-       state = buffer_create_dynamic(cmd->pool, 256);
-       if (imap_arg_get_astring(&args[0], &str)) {
-               if (cmd->client->mailbox != NULL) {
-                       client_send_tagline(cmd,
-                               "BAD Can't be used in SELECTED state");
-                       return TRUE;
-               }
-               if (base64_decode(str, strlen(str), NULL, state) < 0)
-                       ret = 0;
-               else {
-                       ret = imap_state_import_external(cmd->client,
-                               state->data, state->used, &error);
-               }
-               if (ret < 0) {
-                       client_send_tagline(cmd, t_strdup_printf(
-                               "NO Failed to restore state: %s", error));
-               } else if (ret == 0) {
-                       client_send_tagline(cmd, t_strdup_printf(
-                               "BAD Broken state: %s", error));
-               } else {
-                       client_send_tagline(cmd, "OK State imported.");
-               }
-               return TRUE;
-       } else if (args[0].type == IMAP_ARG_EOL) {
-               if (!imap_state_export_external(cmd->client, state, &error)) {
-                       client_send_tagline(cmd, t_strdup_printf(
-                               "NO Can't save state: %s", error));
-                       return TRUE;
-               }
-               state_encoded = buffer_create_dynamic(cmd->pool,
-                               MAX_BASE64_ENCODED_SIZE(state->used)+10);
-               str_append(state_encoded, "* STATE ");
-               base64_encode(state->data, state->used, state_encoded);
-               client_send_line(cmd->client, str_c(state_encoded));
-               client_send_tagline(cmd, "OK State exported.");
-               return TRUE;
-       } else {
-               client_send_command_error(cmd, "Invalid arguments.");
-               return TRUE;
-       }
-#else
-       client_send_command_error(cmd, "Command is disabled for now.");
-       return TRUE;
-#endif
-}
index b78d0a17a753c4f68534f6f852f8cc55e4dd056c..8280e5cdbb046afc15ad2e8461e1273d09662a58 100644 (file)
@@ -77,7 +77,6 @@ static const struct command imap_ext_commands[] = {
        { "UID THREAD",         cmd_thread,      COMMAND_FLAG_BREAKS_SEQS },
        { "UNSELECT",           cmd_unselect,    COMMAND_FLAG_BREAKS_MAILBOX },
        { "X-CANCEL",           cmd_x_cancel,    0 },
-       { "X-STATE",            cmd_x_state,     COMMAND_FLAG_REQUIRES_SYNC },
        { "XLIST",              cmd_list,        0 },
        /* IMAP URLAUTH (RFC4467): */
        { "GENURLAUTH",         cmd_genurlauth,  0 },
index 651a6df9d0877e096d90e262df5e1d471e7528bd..df28a65a0376c65424f37965ff55e9776b335cd2 100644 (file)
@@ -122,7 +122,6 @@ bool cmd_uid_expunge(struct client_command_context *cmd);
 bool cmd_move(struct client_command_context *cmd);
 bool cmd_unselect(struct client_command_context *cmd);
 bool cmd_x_cancel(struct client_command_context *cmd);
-bool cmd_x_state(struct client_command_context *cmd);
 
 /* IMAP URLAUTH (RFC4467): */
 bool cmd_genurlauth(struct client_command_context *cmd);
index 2b064ec80971ec1bfabb20288bb7fbff4d7ad89d..2298bafc9fba6a9348f30241a1265d82e4a1027b 100644 (file)
@@ -91,7 +91,7 @@ import_seq_range(const unsigned char **data, const unsigned char *end,
 int imap_state_export_internal(struct client *client, buffer_t *dest,
                               const char **error_r)
 {
-       /* the only IMAP command we allow running is IDLE or X-STATE */
+       /* the only IMAP command we allow running is IDLE */
        if (client->command_queue_size > 1) {
                *error_r = "Multiple commands in progress";
                return 0;
@@ -107,19 +107,6 @@ int imap_state_export_internal(struct client *client, buffer_t *dest,
        return client->v.state_export(client, TRUE, dest, error_r);
 }
 
-int imap_state_export_external(struct client *client, buffer_t *dest,
-                              const char **error_r)
-{
-       if (client->command_queue_size > 1) {
-               *error_r = "Multiple commands in progress";
-               return 0;
-       }
-
-       i_assert(client->command_queue_size == 1);
-       i_assert(strcmp(client->command_queue->name, "X-STATE") == 0);
-       return client->v.state_export(client, FALSE, dest, error_r);
-}
-
 static int
 imap_state_import(struct client *client, bool internal,
                  const unsigned char *data, size_t size, const char **error_r)
index ee0037607e81f43eec853135ea2004336a26877b..f95337e4cbefaa62fc60e49c56f5d6216e90795f 100644 (file)
@@ -5,8 +5,6 @@
    0 if state couldn't be exported, -1 if temporary internal error error. */
 int imap_state_export_internal(struct client *client, buffer_t *dest,
                               const char **error_r);
-int imap_state_export_external(struct client *client, buffer_t *dest,
-                              const char **error_r);
 
 /* Returns 1 if ok, 0 if state was corrupted, -1 if other error. Internal state
    comes from another Dovecot component, which can override IP addresses,