Your recent changes [1] to scp are complete garbage

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Your recent changes [1] to scp are complete garbage

macfanboi17
They break copying files with spaces:

$ touch '/tmp/file with spaces'; mkdir '/tmp/dir with spaces'

$ scp localhost:"'/tmp/file with spaces'" /tmp
protocol error: filename does not match request

$ scp -r localhost:"'/tmp/file with spaces'" /tmp
file with spaces                              100%    0     0.0KB/s   00:00
$ scp -r localhost:"'/tmp/dir with spaces'" /tmp

If anything, they create the dangerous false expectation that scp is
checking the filenames sent by the server, which is only doing in some
very narrow circumstances.

The brace expansion workaround [2] only made things worse, as braces in
fnmatch() work differently than in most popular shells.

All this is useless bloat and simple security theater and shouldn't have
passed review. You should've left that old scp turd alone instead of
trying to give it a polish.

Don't bother to answer just to give yourself airs and/or sicc your
fanbois on me. Thank you in advance.

[1] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/scp.c.diff?r1=1.201&r2=1.202

[2] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/scp.c.diff?r1=1.203&r2=1.204

Reply | Threaded
Open this post in threaded view
|

Re: Your recent changes [1] to scp are complete garbage

Stefan Sperling-5
On Sun, Sep 08, 2019 at 02:06:28PM +0300, [hidden email] wrote:

> They break copying files with spaces:
>
> $ touch '/tmp/file with spaces'; mkdir '/tmp/dir with spaces'
>
> $ scp localhost:"'/tmp/file with spaces'" /tmp
> protocol error: filename does not match request
>
> $ scp -r localhost:"'/tmp/file with spaces'" /tmp
> file with spaces                              100%    0     0.0KB/s   00:00
> $ scp -r localhost:"'/tmp/dir with spaces'" /tmp

Works for me:

$ scp localhost:'/tmp/f\ n' /tmp/f2
f n                                        100%    0     0.0KB/s   00:00
$ scp localhost:"/tmp/f\ n" /tmp/f2
f n                                        100%    0     0.0KB/s   00:00
$