cURL / Mailing Lists / curl-library / Single Mail

curl-library

OS400 ftp server related problem

From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Fri, 7 Aug 2009 18:41:15 +0200

Hi everyone,
    There is a problem using libcurl with the OS400 FTP server. I cannot
create an OS400-specific workaround in libcurl, since it affects clients
ACCESSING an OS400 server (even from a Win/Lin/... machine).
 
Here is the problem:
 
_ The OS400 server supports 2 name formats in commands: name format 0 is
the native OS400 name syntax, incompatible with the names we are used to
deal with in other contexts, and name format 1 that emulates the
well-known syntax, and is thus compatible with libcurl.
 
_ Upon initial connection, the server is in "name format 0" mode. As
soon as it receives a name in format 1, it switches automatically to
that mode. Some commands are supported by the server to force a
particular name format mode.
_ The first FTP command issued by libcurl after login is "PWD": it then
receives a name in format 0.
_ The next command (i.e.: CWD) gives a directory name in format 1,
making the server to auto-switch name format mode.
 
Until that point, everything works fine. But if the connection is
reused, the first command libcurl issues is a CWD to the directory name
received initially: this name is in format 0 and the connection is in
format 1 mode... failure is guaranteed !
 
As you can see in the attached log file, it is neither a libcurl
problem, nor a server problem. It is a problem related to the way
libcurl (hiddenly) deals with the server.
 
The (bad) solutions I've tested so far are:
 
_ Do not reuse the connection.
_ Force a "SITE NAMEFMT 0" in POSTQUOTE.
 
Both these solutions are not very good, 'cause they are ineficient and
the 2nd suppose you know your server is an OS400.
It is possible to configure the server to start in name format 1 mode
(for all users), but manual users are used to format 0 and won't accept
a command syntax change. Thus we rejected this solution.
 
I also thought about forcing name format 1 before the PWD command, but
there is no way to do it in libcurl.
 
My question is: does anybody think about a realistic better way to
workaround this, or better: to fix libcurl to avoid the problem, whether
the remote server is an OS400 or not ? As hints, names in format 0 never
starts with a '/', and you cannot expect IBM to change something in the
server !!!
 
Many thanks for your attention and a good week-end to all of you
Patrick

Received on 2009-08-07