I ran into an issue with trying to use remote port forwarding.  I'm
using mina sshd as the client and connecting to an OpenSSH server.
When I debugged the code it seems that the server was not sending any
bytes in the response to the "tcpip-forward" request.  I searched and
found rfc4254 (which I have no clue if that is current) and it said

   If a client passes 0 as port number to bind and has 'want reply' as
   TRUE, then the server allocates the next available unprivileged port
   number and replies with the following message; otherwise, there is no
   response-specific data.

Based on that description it seems that mina sshd client is not
following the spec.  If you put a remote port != 0 then the server
won't send any reply contents.  I changed
DefaultTcpipForwarder.startRemotePortForwarding() from "int port =
result.getInt()" to

int port = remote.getPort() == 0 ? result.getInt() : remote.getPort();

And now things are working fine.

I'm starting a new project and want to heavily rely on this feature.
Should I expect this feature to be stable?  In fact, is Mina SSHD as a
whole considered stable?  In general its seems like sshd is a bit
light on documentation.  That hasn't proven to be any problem though
because I've found the code base very easy to read and understand,
which is great.

Darren

Reply via email to