From alavaliant@ra09.com Sat Mar 7 03:29:04 2015 Received: (at submit) by bugs.x2go.org; 7 Mar 2015 02:29:06 +0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on ymir.das-netzwerkteam.de X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=ham version=3.3.2 Received: from thetower.ra09.com (ra09.com [202.124.104.240]) by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id 3ACB95E156 for ; Sat, 7 Mar 2015 03:29:04 +0100 (CET) Received: from localhost ([127.0.0.1] helo=private.ra09.com) by thetower.ra09.com with esmtp (Exim 4.80) (envelope-from ) id 1YU4U7-0002jj-TB for submit@bugs.x2go.org; Sat, 07 Mar 2015 15:29:00 +1300 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 07 Mar 2015 15:28:59 +1300 From: Jason Alavaliant To: submit@bugs.x2go.org Subject: connection fails with error binding localhost:XXX when creating new session Message-ID: X-Sender: alavaliant@ra09.com User-Agent: Roundcube Webmail/1.0.5 Package: x2goclient Version: 4.0.3.2 Severity: important All clients trying to create a new sessions on my x2go broker setup started failing with the error message Unable to create ssl tunnel: Error binding localhost:XXX and in each case the XXX was a port number lower than 1024 Digging through the client code and looking at the shared session database on the backend as far as I can tell the issue is; 1) the session database port numbers have reached values of 65000 and greater (for example on the last session I created the database gr_port was 65087) 2) the client gets given that data and adds 1000 to it (onmainwindows.cpp line "int iport=localGraphicPort.toInt() + 1000;") 3) the resulting port number is over the highest valid port number of 65535 and hence later on when it is used the value overflows around to be port 552 4) ports under 1024 are reserved on Unix and can't be used by normal user processes and hence the error and the connection failing. For now I've worked around the issue by patching the client onmainwindows.cpp section under the "int iport=localGraphicPort.toInt() + 1000;" line to add to the various checks an extra check that sees in the value is over 65535 and if so to subtract 63382 which causes the port value to end up above the 1024 range. I don't think this is a complete fix however since it only covers gr_port (which broke first since it gets 1000 added to it which doesn't seem to occur for sound_port and fs_port?) and I'm not sure if I what direction I should be looking at fixing this in order to make a patch that will be accepted upstream. I'm suspecting this might actually be considered an bug with the x2goserver database code (it shouldn't set port so high?) so I'm hoping you can advise on where I should be concentrating on fixing the code. I'm not sure if you'll think it should be patched both in the client and in the server code or if it should only be checked for in the server code? Thanks Jason