You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2016/03/10 14:00:51 UTC

[Bug 59160] New: scp task does not support ipv6

https://bz.apache.org/bugzilla/show_bug.cgi?id=59160

            Bug ID: 59160
           Summary: scp task does not support ipv6
           Product: Ant
           Version: 1.9.6
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: sauravezee@gmail.com

The scp task doesnot handle ipv6 ip as hostname. The problem is in Scp class.
The method parseUri is wrongly extracting the ip address based on first
appearance of ":" after @ . But in IPv6 it is having more than one ":" in the
ip address.

Example 

For ip fd01:0:101:2608:0:11ff:fe42:e13c the scp task gets the hostname as fd01
as the host name is parsed based on the index of ":" after "@". It should use
lastIndexOf the ":" uri to get the proper hostname to support ipv6

The current implementation is :

 int indexOfPath = uri.indexOf(':', indexOfAt + 1);
        if(indexOfPath == -1)
        {
            throw new BuildException((new StringBuilder()).append("no remote
path in ").append(uri).toString());
        }
        setHost(uri.substring(indexOfAt + 1, indexOfPath));


The fix for bug :

int indexOfPath = uri.lastIndexOf(':');
     if (indexOfPath == -1) {
       throw new BuildException("no remote path in " + uri);
   }

   setHost(uri.substring(indexOfAt + 1, indexOfPath));

-- 
You are receiving this mail because:
You are the assignee for the bug.