static bool cmd_xclient(struct pop3_client *client, const char *args)
{
const char *const *tmp, *value;
- in_port_t remote_port;
+ in_port_t remote_port, local_port;
bool args_ok = TRUE;
if (!client->common.connection_trusted) {
args_ok = FALSE;
else
client->common.remote_port = remote_port;
+ } else if (str_begins_icase(*tmp, "DESTADDR=", &value)) {
+ if (net_addr2ip(value, &client->common.local_ip) < 0)
+ args_ok = FALSE;
+ } else if (str_begins_icase(*tmp, "DESTPORT=", &value)) {
+ if (net_str2port(value, &local_port) < 0)
+ args_ok = FALSE;
+ else
+ client->common.local_port = local_port;
} else if (str_begins_icase(*tmp, "SESSION=", &value)) {
if (strlen(value) <= LOGIN_MAX_SESSION_ID_LEN) {
client->common.session_id =
}
}
- str_printfa(str, "XCLIENT ADDR=%s PORT=%u SESSION=%s TTL=%u "
+ str_printfa(str, "XCLIENT ADDR=%s PORT=%u "
+ "DESTADDR=%s DESTPORT=%u SESSION=%s TTL=%u "
"CLIENT-TRANSPORT=%s",
net_ip2addr(&client->common.ip),
client->common.remote_port,
+ net_ip2addr(&client->common.local_ip),
+ client->common.local_port,
client_get_session_id(&client->common),
client->common.proxy_ttl - 1,
client->common.end_client_tls_secured ?
str_append(str, " FORWARD=");
base64_encode(str_data(fwd), str_len(fwd), str);
}
+ e_info(client->common.event, "Send: %s", str_c(str));
str_append(str, "\r\n");
/* remote supports XCLIENT, send it */
o_stream_nsend(output, str_data(str), str_len(str));