Bug 2899

Summary: scp remote-to-remote does not work with IPv6 addresses anymore
Product: Portable OpenSSH Reporter: Jakub Jelen <jjelen>
Component: scpAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: enhancement    
Priority: P5    
Version: 7.7p1   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
proposed patch none

Description Jakub Jelen 2018-08-25 01:24:46 AEST
Created attachment 3172 [details]
proposed patch

Using IPv6 addresses for remote-to-remote transfers does not work anymore. This worked fine in OpenSSH 7.4 and before.

  # scp -r -vvv jjelen@\[::1\]:/home/jjelen/Documents/abeceda.txt jjelen@\[::1\]:/tmp/

fails with the error

  debug1: resolve_canonicalize: hostname  is an unrecognised address
  ssh: Could not resolve hostname : Name or service not known
  lost connection

This issue express itself earlier in the log as IPv6 address in the URI that is not enclosed in the square brackets:

  Executing: /usr/bin/ssh -x -oClearAllForwardings=yes -t -v -v -v -l jjelen -- ::1 scp -v -r /home/jjelen/Documents/abeceda.txt jjelen@::1:/tmp/

This leads in the end to empty hostname:

  Executing: program /usr/bin/ssh host , user jjelen, command scp -v -r -t :1:/tmp/

and to the error above.

This can be pretty simply addressed by the attached patch.