]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-login: Don't forward x-multiplex ID parameter when proxying
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 6 Sep 2024 11:42:55 +0000 (14:42 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 6 Sep 2024 11:42:55 +0000 (14:42 +0300)
If a connecting v2.4 proxy sends this parameter, it should be ignored rather
than forwarded to the next hop, which again might be v2.4. This would end
up enabling multiplex iostreams, even though this v2.3 proxy doesn't
understand it.

src/imap-login/imap-login-cmd-id.c

index a1c629465150b88428af5547982e05f30304d533..7db4c9d7d3dbf136c744b792b87db8865fbc9f57 100644 (file)
@@ -70,6 +70,14 @@ cmd_id_x_forward_(struct imap_client *client,
        client_add_forward_field(&client->common, key+10, value);
 }
 
+static void
+cmd_id_x_multiplex(struct imap_client *client ATTR_UNUSED,
+                  const char *key ATTR_UNUSED, const char *value ATTR_UNUSED)
+{
+       /* ignore - registered here only so that it's not automatically
+          forwarded by imap_id_retain=yes handling */
+}
+
 static const struct imap_id_param_handler imap_login_id_params[] = {
        { "x-originating-ip", FALSE, cmd_id_x_originating_ip },
        { "x-originating-port", FALSE, cmd_id_x_originating_port },
@@ -79,6 +87,7 @@ static const struct imap_id_param_handler imap_login_id_params[] = {
        { "x-session-id", FALSE, cmd_id_x_session_id },
        { "x-session-ext-id", FALSE, cmd_id_x_session_id },
        { "x-forward-", TRUE, cmd_id_x_forward_ },
+       { "x-multiplex", FALSE, cmd_id_x_multiplex },
 
        { NULL, FALSE, NULL }
 };