cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Handling FTP servers that indicate backslash as CWD

From: John Coffey <johnco3_at_gmail.com>
Date: Wed, 11 Feb 2015 09:55:14 -0500

Dan,

Thank you for the correction, my mistake, yes, I meant that libCurl issued
an automatic PWD under the covers.

Below is my wireshark stream capture from the initial login. As you can
see, given that the initial path separator is not "/", libCurl attempts to
determine if this is an "OS/400" per the code block from ftp.c line 2976
(libcurl 7.40) below by issuing a SYST command (which is not supported by
the FTP server, if so it issues the special "SITE NAMEFMT 1" command.

220 CMC FTP server ready.
USER anonymous
331 User allowed.
PASS ftp_at_example.com
230-Welcome to CMC
Central Maintenance Computer
EWF STATE: [EWF_RAM_REG] ENABLED '\Device\HarddiskVolume1' (C:) 4.86 MB
BIOS Date: 02/09/2007 (TT7036180-301)
hw-descriptor:p7034055-1901^:mA^:u00000053^
230
PWD
257 "\" is current directory
SYST
502 Command not implemented
PORT 192,168,200,2,141,93
250 PORT command successful
QUIT
221 Goodbye

John

        /* Check for special servers here. */

        if(strequal(os, "OS/400")) {
          /* Force OS400 name format 1. */
          result = Curl_pp_sendf(&ftpc->pp, "%s", "SITE NAMEFMT 1");
          if(result) {
            free(os);
            return result;
          }
          /* remember target server OS */
          Curl_safefree(ftpc->server_os);
          ftpc->server_os = os;
          state(conn, FTP_NAMEFMT);
          break;
        }
        else {
          /* Nothing special for the target server. */
          /* remember target server OS */
          Curl_safefree(ftpc->server_os);
          ftpc->server_os = os;
        }

On Wed, Feb 11, 2015 at 8:28 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Wed, 11 Feb 2015, John Coffey wrote:
>
> Dan, I already use this option, however it does not appear to prevent the
>> automatic CWD when I first login. That option appears to only be used for
>> traversing directories when already logged in.
>>
>
> The first? So where does that CWD take you? Aren't you talking about the
> PWD?
>
> Can you show us a verbose output to show what curl does (wrongly) in your
> case?
>
> --
>
> / daniel.haxx.se
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-02-11