1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-06-08 19:06:50 +00:00

Fixed ignoring of explicit socksport in socks5 addresses (regression)

This commit is contained in:
Gerhard Rieger 2025-01-29 21:59:56 +01:00
parent 5e56f25285
commit e7df880af5
4 changed files with 10 additions and 1 deletions

View file

@ -14,6 +14,10 @@ Corrections:
corrected test IGNOREEOF.
Thanks to Rusty Bird for the precise problem report.
Fixed the regression introduced with version 1.8.0.1 that in socks5
addresses the explicit socksport (2nd address parameter) was ignored.
Thanks to Jakub Fišer for reporting this bug.
Building:
Disabling certain features during configure could break build process.

View file

@ -1103,6 +1103,7 @@ label(ADDRESS_SOCKS4A)dit(bf(tt(SOCKS4A:<socks-server>:<host>:<port>)))
Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP4)(GROUP_IP4),link(IP6)(GROUP_IP6),link(TCP)(GROUP_TCP),link(SOCKS4)(GROUP_SOCKS),link(RETRY)(GROUP_RETRY) nl()
label(ADDRESS_SOCKS5_CONNECT)dit(bf(tt(SOCKS5-CONNECT:<socks-server>:<socks-port>:<target-host>:<target-port>)))
dit(bf(tt(SOCKS5-CONNECT:<socks-server>:<target-host>:<target-port>)))
Connects via <socks-server> [link(IP address)(TYPE_IP_ADDRESS)]
to <target-host> [link(IPv4 address)(TYPE_IPV4_ADDRESS)]
on <target-port> [link(TCP service)(TYPE_TCP_SERVICE)],
@ -1122,6 +1123,7 @@ label(ADDRESS_SOCKS5_CONNECT)dit(bf(tt(SOCKS5-CONNECT:<socks-server>:<socks-port
link(TCP)(ADDRESS_TCP_CONNECT)
label(ADDRESS_SOCKS5_LISTEN)dit(bf(tt(SOCKS5-LISTEN:<socks-server>:<socks-port>:<listen-host>:<listen-port>)))
dit(bf(tt(SOCKS5-LISTEN:<socks-server>:<listen-host>:<listen-port>)))
Connects to <socks-server> [link(IP address)(TYPE_IP_ADDRESS)]
using socks version 5 protocol over TCP
and makes it listen for incoming connections on <listen-port> [link(TCP service)(TYPE_TCP_SERVICE)], binding to <-listen-host> [link(IPv4 address)(TYPE_IPV4_ADDRESS)]

View file

@ -239,7 +239,8 @@ int _xioopen_opt_socksport(
{
struct servent *se;
if (retropt_string(opts, OPT_SOCKSPORT, socksport) < 0) {
if (retropt_string(opts, OPT_SOCKSPORT, socksport) < 0 &&
*socksport == NULL) {
if ((se = getservbyname("socks", "tcp")) != NULL) {
Debug1("\"socks/tcp\" resolves to %u", ntohs(se->s_port));
if ((*socksport = Malloc(6)) == NULL) {

View file

@ -533,6 +533,7 @@ static int xioopen_socks5(
target_name = argv[3];
target_port = argv[4];
} else {
socks_port = NULL;
target_name = argv[2];
target_port = argv[3];
}
@ -548,6 +549,7 @@ static int xioopen_socks5(
if (_xioopen_opt_socksport(opts, (char **)&socks_port) < 0) {
return STAT_NORETRY;
}
/*! possible memory leak */
result = _xioopen_ipapp_prepare(opts, &opts0, socks_server, socks_port,
&pf, ipproto,