merged: info message during socks connect showed bad port number on little endian systems

This commit is contained in:
Gerhard Rieger 2010-01-09 16:00:41 +01:00
commit 8658c7f953
3 changed files with 9 additions and 4 deletions

View file

@ -8,6 +8,10 @@ corrections:
complete" when the peer performed a renegotiation. Thanks to Benjamin
Delpy for reporting this bug.
info message during socks connect showed bad port number on little
endian systems due to wrong byte order (thanks to Peter M. Galbavy for
bug report and patch)
porting:
building socat on systems that predefined the CFLAGS environment to
contain -Wall failed (esp.RedHat). Thanks to Paul Wouters for reporting

View file

@ -1 +1 @@
"1.7.1.1+64bit+userlate+reneg"
"1.7.1.1+64bit+userlate+reneg+sockshtons"

View file

@ -1,5 +1,5 @@
/* source: xio-socks.c */
/* Copyright Gerhard Rieger 2001-2008 */
/* Copyright Gerhard Rieger 2001-2009 */
/* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for opening addresses of socks4 type */
@ -211,7 +211,8 @@ int _xioopen_socks4_prepare(const char *targetport, struct opt *opts, char **soc
/* generate socks header - points to final target */
sockhead->version = 4;
sockhead->action = 1;
sockhead->port = parseport(targetport, IPPROTO_TCP);
sockhead->port = parseport(targetport, IPPROTO_TCP); /* network byte
order */
if (retropt_string(opts, OPT_SOCKSPORT, socksport) < 0) {
if ((se = getservbyname("socks", "tcp")) != NULL) {
@ -309,7 +310,7 @@ int _xioopen_socks4_connect(struct single *xfd,
}
Info11("sending socks4%s request VN=%d DC=%d DSTPORT=%d DSTIP=%d.%d.%d.%d USERID=%s%s%s",
destdomname?"a":"",
sockhead->version, sockhead->action, sockhead->port,
sockhead->version, sockhead->action, ntohs(sockhead->port),
((unsigned char *)&sockhead->dest)[0],
((unsigned char *)&sockhead->dest)[1],
((unsigned char *)&sockhead->dest)[2],