Subject: Re: Why isn't scp 8-bit clean?

Re: Why isn't scp 8-bit clean?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 31 Aug 2010 16:50:53 +0200 (CEST)

On Tue, 31 Aug 2010, Uli Zappe wrote:

> The reason for this is the if clause in lines 614-630 in src/scp.c
> (libssh2-1.2.7). It returns
>
> LIBSSH2_ERROR_SCP_PROTOCOL, "Invalid data in SCP response"
>
> as soon as a character > 126 surfaces in the sshd response, which it will do
> for every 8-bit or UTF-8 file name with a non-ASCII character.

Quite clearly. I don't understand that limitation - and I find it funny that
nobody else before noticed.

I guess a problem is that SCP is not a standard thing. It would be worthwhile
to check how OpenSSH actually provides file names with non-ascii letters. I
mean, if it truly is 8bit then surely the < 32 check is wrong as well?

> Indeed, as soon as I changed "126" to "256" in line 626, scp worked just
> fine with 8-bit and UTF-8 file names, and I could not find any problem
> whatsoever.

Uhm, UTF-8 file names can surely have bytes below 32, right? In fact, UTF-8
can even contain the bytes 0x0a and 0x0d so the checks for the end of line is
then not good enough.

> So why this seemingly unnecessary limitation?

An oversight I'd guess. It's been like this for ages.

Nice catch! Now we only need to figure out the right fix...

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-08-31