Skip to content

Commit

Permalink
imap-login: Don't forward x-multiplex ID parameter when proxying
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed Sep 6, 2024
1 parent 26ad5b0 commit 1fd4fcc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/imap-login/imap-login-cmd-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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 }
};
Expand Down

0 comments on commit 1fd4fcc

Please sign in to comment.