You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Przemek Bruski (JIRA)" <ji...@apache.org> on 2014/07/01 12:00:37 UTC

[jira] [Created] (SSHD-333) Ephemeral port handling is faulty

Przemek Bruski created SSHD-333:
-----------------------------------

             Summary: Ephemeral port handling is faulty
                 Key: SSHD-333
                 URL: https://issues.apache.org/jira/browse/SSHD-333
             Project: MINA SSHD
          Issue Type: Bug
    Affects Versions: 0.9.0
            Reporter: Przemek Bruski


An excerpt from org.apache.sshd.SshServer:
{code}
      if (host != null) {
            String[] hosts = host.split(",");
            LinkedList<InetSocketAddress> addresses = new LinkedList<InetSocketAddress>();
            for (String host : hosts) {
                InetAddress[] inetAddresses = InetAddress.getAllByName(host);
                for (InetAddress inetAddress : inetAddresses) {
                    InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, port);
                    if (port == 0) {
                        port = inetSocketAddress.getPort();
                    }
                    addresses.add(inetSocketAddress);
                }
            }
            acceptor.bind(addresses);
        }
{code}

The line:
{code}
                    if (port == 0) {
                        port = inetSocketAddress.getPort();
                    }
{code}

Will still retrieve 0. The ephemeral port can be determined only after the socket address is bound.



--
This message was sent by Atlassian JIRA
(v6.2#6252)