This was fixed in SSHD-269.
Verified with the 0.10.0 snapshot.

On Thu, Jan 30, 2014 at 5:48 PM, Chris Austin <[email protected]>wrote:

> Are there any known problems with establishing an ssh connection through a
> port forwarded by ClientSession.startLocalPortForwarding? Openssh is
> reporting the following after a few lines of output:
> Bad packet length 1141944966.
> Disconnecting: Packet corrupt
>
> This is using mina-core 2.0.7 and sshd-core 0.9.0
> Steps to reproduce:
> * build the attached maven project
> * java -jar target/sshforward-1.0-jar-with-dependencies.jar <ssh host>
> * ssh -p 10022 <user>@localhost
> * run 'w'
>
>
> package test;
>
> import java.io.Console;
> import org.apache.sshd.ClientSession;
> import org.apache.sshd.SshClient;
> import org.apache.sshd.common.SshdSocketAddress;
> import org.apache.sshd.common.forward.DefaultTcpipForwarderFactory;
>
> public class ForwardSsh {
>     public static void main( String[] args ) throws Exception {
>         String host        = args[0];
>         int    port        = 22;
>         String fwdHost     = "localhost";
>         int    fwdPort     = 10022;
>
>         Console console = System.console();
>         String  user    = console.readLine("User: ");
>         String  pass    = new String(console.readPassword("Password: "));
>
>         SshClient client = SshClient.setUpDefaultClient();
>         client.setTcpipForwarderFactory(new
> DefaultTcpipForwarderFactory());
>         client.start();
>
>         ClientSession session = client.connect(host,
> port).await().getSession();
>         session.authPassword(user, pass);
>
>         SshdSocketAddress localAddr  = new SshdSocketAddress(fwdHost,
> fwdPort);
>         SshdSocketAddress remoteAddr = new SshdSocketAddress(host, 22);
>         session.startLocalPortForwarding(localAddr, remoteAddr);
>
>         System.out.printf("Forwarding %s:%d to %s:%d\n", fwdHost, fwdPort,
> host, 22);
>         console.readLine();
>     }
> }
>
> Regards,
> Chris
>

Reply via email to