From 5bfd245d1357ca1cba510e0e40a1b1931a047357 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Thu, 31 Dec 2009 10:16:15 +0100 Subject: [PATCH] info message during socks connect showed bad port number on little endian systems --- CHANGES | 5 +++++ VERSION | 2 +- xio-socks.c | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 8ce1617..09c953b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,9 @@ +corrections: + 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) + ####################### V 1.7.1.1: corrections: diff --git a/VERSION b/VERSION index 4026ae1..d4dfade 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -"1.7.1.1" +"1.7.1.1+sockshtons" diff --git a/xio-socks.c b/xio-socks.c index 3c7a73a..9912a89 100644 --- a/xio-socks.c +++ b/xio-socks.c @@ -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],