I have written a post of the WINSCP-Problem on
[email protected] and got the following answer from Alan Altmark
Senior Managing z/VM and Linux Consultant,IBM Systems Lab Services,IBM Z Delivery Practice:
First answer:
>> All of this because RFC 959 failed to define a format for the textual
>> responses present in most of the commands. Later functionality added
to
>> FTP typically defined the textual responses for the new functions, but
>> there's nothing to be done at this point unless a new RFC that adds a
>> "standardized textual output" feature to the protocol is brought
forward.
>>
>
> FSVO "failed". FTP was not designed as a programming interface. The
> design assumed that the (human) user would be conversant with tne format
> conventions of the remote system and able to deal with them.
Weak and solvable then. Still weak and still not solved today. Note that
EPSV/EPRT (20 years old) have clearly defined responses, both for humans
and programs.
> In effect, Filezilla and its kin are employing AI with some hints from
> the user. How does the NLST command deal with a filename containing a
> newline?
Path names are all defined as "char *", and as such are delimited by
newline, so you're going to have a problem creating a file with newline in
its name. But if such a thing were to exist, I would expect all sorts of
UIs to misbehave or simply fail under such a condition. Responses to NLST
and LIST are textual, with CRLF (or just LF) acting as the delimiter.
Second answer:
> On various systems I'm familiar with, "char *" is delimited by NUL, not
newline.
Of course you are right.
> No problem on Linux:
>
> 522 $ ls -ln
> total 0
> -rw-r--r-- 1 1000 1000 0 Feb 23 10:34 foo?bar
> 523 $ ls | od -tx1
> 0000000 66 6f 6f 0a 62 61 72 0a
> 0000010
Here's what ftpd does:
fprintf(dout, "%s%s\n", dirname, type == TYPE_A ? "\r" : "");
So one wonders if fprintf() will convert non-displayable chars to "?".