]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH 3/3] doveadm compress: Delay failing if used COMPRESS algorithm is not support...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 7 Jul 2026 11:33:40 +0000 (14:33 +0300)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
This command is used in CI tests to verify the server rejects non-DEFLATE
algorithm.

Gbp-Pq: Name 0003-doveadm-compress-Delay-failing-if-used-COMPRESS-algo.patch

src/doveadm/doveadm-compress.c

index 1a2b556b07482396f443eb155b7d129808b06f09..9b93e68a1096314808a93d7fdd84d78e45056ba6 100644 (file)
@@ -123,9 +123,14 @@ client_input_get_compress_algorithm(struct client *client, const char *line)
        if (!str_begins_icase(line, " COMPRESS ", &algorithm))
                return FALSE;
 
+       /* Look up the local handler needed to (de)compress the stream once the
+          server accepts. Don't fail here if the mechanism is unknown or not
+          compiled in: the server may reject it, and this client must still send
+          the command to let the server do so. If the server unexpectedly
+          accepts a mechanism we can't handle, we fail then (see server_input()). */
        if (compression_lookup_handler(t_str_lcase(algorithm),
                                       &client->handler) <= 0)
-               i_fatal("Unsupported compression mechanism: %s", algorithm);
+               client->handler = NULL;
        /* Remember the tag so we can tell whether the server accepted or
           rejected this COMPRESS command. */
        i_free(client->compress_tag);
@@ -281,6 +286,8 @@ static void server_input(struct client *client)
                        struct istream *input;
                        struct ostream *output;
 
+                       if (client->handler == NULL)
+                               i_fatal("Server accepted unsupported compression mechanism");
                        e_info(client->event, "<Compression started>");
                        input = client->handler->create_istream(client->input);
                        output = client->handler->