]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix ENABLE UTF8=ACCEPT to not return it to client if mail_utf8_extensions=no
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 10 Feb 2025 07:44:12 +0000 (09:44 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:39 +0000 (12:34 +0200)
src/imap/cmd-enable.c
src/imap/imap-client.c
src/imap/imap-client.h

index 904d6db356e5b5419e5bae0e4700ba447dde20cb..84b9c72c2f6cd116c8bae7182f237abba5c9cb05 100644 (file)
@@ -21,8 +21,8 @@ bool cmd_enable(struct client_command_context *cmd)
                        client_send_command_error(cmd, "Invalid arguments.");
                        return TRUE;
                }
-               if (imap_feature_lookup(str, &feature_idx)) {
-                       client_enable(cmd->client, feature_idx);
+               if (imap_feature_lookup(str, &feature_idx) &&
+                   client_enable(cmd->client, feature_idx)) {
                        str_append_c(reply, ' ');
                        str_append(reply, t_str_ucase(str));
                }
index 2bdc984bed259e0791d5ba62664661fc6f505266..b94624dd444b1c5c4ed0124034a49d9ff553cc24 100644 (file)
@@ -1569,17 +1569,17 @@ bool client_handle_search_save_ambiguity(struct client_command_context *cmd)
        return TRUE;
 }
 
-void client_enable(struct client *client, unsigned int feature_idx)
+bool client_enable(struct client *client, unsigned int feature_idx)
 {
        if (client_has_enabled(client, feature_idx))
-               return;
+               return TRUE;
 
        const struct imap_feature *feat = imap_feature_idx(feature_idx);
 
        if ((feat->mailbox_features & MAILBOX_FEATURE_UTF8ACCEPT) != 0 &&
            !client->set->mail_utf8_extensions) {
                e_debug(client->event, "Client attempted to enable UTF8 when it's disabled");
-               return;
+               return FALSE;
        }
 
        feat->callback(client);
@@ -1587,6 +1587,7 @@ void client_enable(struct client *client, unsigned int feature_idx)
           previously set */
        bool value = TRUE;
        array_idx_set(&client->enabled_features, feature_idx, &value);
+       return TRUE;
 }
 
 bool client_has_enabled(struct client *client, unsigned int feature_idx)
index 65b30007d8061edc4d99bc027e70dec22eeaa27d..e1818b3f149509a72b1049458c9cb7bb338804e9 100644 (file)
@@ -335,7 +335,9 @@ void client_args_finished(struct client_command_context *cmd,
    have to wait for an existing SEARCH SAVE to finish. */
 bool client_handle_search_save_ambiguity(struct client_command_context *cmd);
 
-void client_enable(struct client *client, unsigned int feature_idx);
+/* Enable an IMAP feature. Returns TRUE if the feature was actually enabled
+   (or it was already enabled before). */
+bool client_enable(struct client *client, unsigned int feature_idx);
 /* Returns TRUE if the given feature is enabled */
 bool client_has_enabled(struct client *client, unsigned int feature_idx);
 /* Returns mailbox features that are currently enabled. */