Skip to content

Commit

Permalink
Issue #158: When ignoring RFC1918 addresses, make sure we properly se…
Browse files Browse the repository at this point in the history
…t the

remote port in the replacement address.
  • Loading branch information
Castaglia committed Jul 18, 2020
1 parent 1fe72ba commit ebcf82c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mod_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,12 @@ MODRET proxy_eprt(cmd_rec *cmd, struct proxy_session *proxy_sess) {

rfc1918_ipstr = pr_netaddr_get_ipstr(remote_addr);
remote_addr = pr_netaddr_dup(session.pool, session.c->remote_addr);

/* Make sure the remote port is set on our duplicated netaddr, too
* (Issue #158).
*/
pr_netaddr_set_port2(remote_addr, remote_port);

(void) pr_log_writefile(proxy_logfd, MOD_PROXY_VERSION,
"client sent RFC1918 address '%s' in EPRT command, ignoring it and "
"using '%s'", rfc1918_ipstr, pr_netaddr_get_ipstr(remote_addr));
Expand Down Expand Up @@ -3113,6 +3119,12 @@ MODRET proxy_port(cmd_rec *cmd, struct proxy_session *proxy_sess) {

rfc1918_ipstr = pr_netaddr_get_ipstr(remote_addr);
remote_addr = pr_netaddr_dup(session.pool, session.c->remote_addr);

/* Make sure the remote port is set on our duplicated netaddr, too
* (Issue #158).
*/
pr_netaddr_set_port2(remote_addr, remote_port);

(void) pr_log_writefile(proxy_logfd, MOD_PROXY_VERSION,
"client sent RFC1918 address '%s' in PORT command, ignoring it and "
"using '%s'", rfc1918_ipstr, pr_netaddr_get_ipstr(remote_addr));
Expand Down

0 comments on commit ebcf82c

Please sign in to comment.