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)

Reply via email to