Bug 3541 - remote-to-remote case doesn't look at sshport
Summary: remote-to-remote case doesn't look at sshport
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: scp (show other bugs)
Version: 9.1p1
Hardware: Other Linux
: P5 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-17 04:55 AEDT by Edward Jones
Modified: 2023-02-17 04:55 AEDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edward Jones 2023-02-17 04:55:37 AEDT
I tried to create a PR on Github but couldn't push. Is it restricted to certain collaborators? Would have been nice for me to raise a PR for this with a fix :).

Anyway, for OpenSSH8.0 (7.4 worked fine), the -P argument gets dropped. "-o Port=" works fine as a workaround. As does specifying the port number in a URI

Here's my command with the first line of debug output (don't think the "-4" is valid that's just what I happened to be using)

> scp -v -4 -i /users/<me>/.ssh/<private key> -P 28001 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o LogLevel=DEBUG root@localhost:/<path to file> <me>@<remote ip>:<dest dir>
Executing: /usr/bin/ssh -x -oClearAllForwardings=yes -t -v -4 -i /users/<me>/.ssh/<private key> -p 28001 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o LogLevel=DEBUG -l root -- localhost scp -v <path to file> <me>@<remote ip>:<dest dir>


It looks like at https://github.com/openssh/openssh-portable/blob/master/scp.c#L1160 you need to set sport to sshport if sshport is valid (and sport is invalid? Not completely on top of that)
I'm not sure why that case is not calling do_cmd/do_cmd2 (which do correctly consider sshport)