]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission-login: proxy - Add support for XCLIENT DESTIP and DESTPORT
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 2 Feb 2026 11:25:10 +0000 (13:25 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 6 Feb 2026 07:58:43 +0000 (07:58 +0000)
src/submission-login/client.c
src/submission-login/submission-proxy.c

index 789dc5ded53c665fc8586564afadf2e0f3c1de26..1309deaed88d939c1f5f8b0a1695314c06adf8c2 100644 (file)
@@ -218,6 +218,10 @@ client_connection_cmd_xclient(void *context,
                client->common.ip = data->source_ip;
        if (data->source_port != 0)
                client->common.remote_port = data->source_port;
+       if (data->dest_ip.family != 0)
+               client->common.local_ip = data->dest_ip;
+       if (data->dest_port != 0)
+               client->common.local_port = data->dest_port;
        if (data->ttl_plus_1 > 0)
                client->common.proxy_ttl = data->ttl_plus_1 - 1;
        if (data->session != NULL) {
index 47e4994e1623c25f08c80fa96c3f0aae021e211b..d82c59b715f6828dbe8e4c030120ff3c2eccc648 100644 (file)
@@ -184,6 +184,17 @@ proxy_send_xclient(struct submission_client *client, struct ostream *output)
                        addr = t_strconcat("IPV6:", addr, NULL);
                proxy_send_xclient_more(client, output, str, "ADDR", addr);
        }
+       if (str_array_icase_find(client->proxy_xclient, "DESTPORT")) {
+               proxy_send_xclient_more(
+                       client, output, str, "DESTPORT",
+                       t_strdup_printf("%u", client->common.local_port));
+       }
+       if (str_array_icase_find(client->proxy_xclient, "DESTADDR")) {
+               const char *addr = net_ip2addr(&client->common.local_ip);
+               if (client->common.local_ip.family == AF_INET6)
+                       addr = t_strconcat("IPV6:", addr, NULL);
+               proxy_send_xclient_more(client, output, str, "DESTADDR", addr);
+       }
        if (str_array_icase_find(client->proxy_xclient, "SESSION")) {
                proxy_send_xclient_more(client, output, str, "SESSION",
                                        client_get_session_id(&client->common));