cURL / Mailing Lists / curl-users / Single Mail

curl-users

Doing a directory listing with sftp and MOVEit DMZ

From: Young,Jim <Jim.Young_at_cerner.com>
Date: Tue, 2 Jun 2009 17:03:22 -0500

I'm having trouble getting curl to play nice with a particular sftp server. I want it to do a long format directory listing to see if there are any files to download. If the directory has two or more files, the listing seems to work fine. If there's just one file in the directory, all I get is a new line character. The server is running the MOVEit DMZ software on it's side of things. I've tried the same thing with a standard Linux server and had no problems. Standard Windows (WinScp) and UNIX sftp clients and produce the long listing of the lone file fine and the curl "-l" option produces the short listing correctly.

Has anyone else run into this? Is there a fix for it?

My particulars:
    Curl is version 7.19.4 running on AIX 5.3
Other parts of the curl "package":
info-4.6-1.aix5.1.ppc.rpm
libidn-1.14-1.aix5.1.ppc.rpm
libssh2-1.1-1.aix5.1.ppc.rpm
bash-4.0-1.aix5.1.ppc.rpm
curl-7.19.4-1.aix5.1.ppc.rpm
openssl-0.9.8k-1.aix5.1.ppc.rpm
pkg-config-0.19-6.aix5.2.ppc.rpm
expat-2.0.1-2.aix5.1.ppc.rpm
zlib-1.2.3-5.aix5.1.ppc.rpm
gettext-0.17-1.aix5.1.ppc.rpm

The curl command is:

    /bin/curl -u mylogin: --trace /tmp/jay --key /z/jay/.ssh/id_rsa --pubkey /z/jay/.ssh/id_rsa.pub \
       --url sftp://sftphost/svcnmh/ \
       --url sftp://sftphost/svcnmh/835/

The first URL returns:
    drwxrwxrwx 0 0 0 0 Apr 30 15:31 835
    drwxrwxrwx 0 0 0 0 Apr 30 15:31 printer
    drwxrwxrwx 0 0 0 0 May 11 16:03 tmp835
    drwxrwxrwx 0 0 0 0 May 11 16:03 tmpprinter

The second URL returns just a new line character despite the fact that there's a directory named "junk" in it. If I put a second file or directory in with it, curl will return the proper listing.

The following is the trace file:
== Info: About to connect() to sftphost port 22 (#0)
== Info: Trying 123.456.789.163... == Info: connected
== Info: Connected to sftphost (123.456.789.163) port 22 (#0)
== Info: SSH authentication methods available: publickey,password
== Info: Using ssh public key file /z/jay/.ssh/id_rsa.pub
== Info: Using ssh private key file /z/jay/.ssh/id_rsa
== Info: SSH public key authentication failed: Invalid signature for supplied public key, or bad username/public key combination
== Info: Initialized password authentication
== Info: Authentication complete
=> Send data, 59 bytes (0x3b)
0000: 64 72 77 78 72 77 78 72 77 78 20 20 20 30 20 30 drwxrwxrwx 0 0
0010: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 0
0020: 20 20 20 20 20 20 20 20 30 20 41 70 72 20 33 30 0 Apr 30
0030: 20 31 35 3a 33 31 20 38 33 35 0a 15:31 835.
=> Send data, 63 bytes (0x3f)
0000: 64 72 77 78 72 77 78 72 77 78 20 20 20 30 20 30 drwxrwxrwx 0 0
0010: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 0
0020: 20 20 20 20 20 20 20 20 30 20 41 70 72 20 33 30 0 Apr 30
0030: 20 31 35 3a 33 31 20 70 72 69 6e 74 65 72 0a 15:31 printer.
=> Send data, 62 bytes (0x3e)
0000: 64 72 77 78 72 77 78 72 77 78 20 20 20 30 20 30 drwxrwxrwx 0 0
0010: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 0
0020: 20 20 20 20 20 20 20 20 30 20 4d 61 79 20 31 31 0 May 11
0030: 20 31 36 3a 30 33 20 74 6d 70 38 33 35 0a 16:03 tmp835.
=> Send data, 66 bytes (0x42)
0000: 64 72 77 78 72 77 78 72 77 78 20 20 20 30 20 30 drwxrwxrwx 0 0
0010: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 0
0020: 20 20 20 20 20 20 20 20 30 20 4d 61 79 20 31 31 0 May 11
0030: 20 31 36 3a 30 33 20 74 6d 70 70 72 69 6e 74 65 16:03 tmpprinte
0040: 72 0a r.
== Info: Connection #0 to host sftphost left intact
== Info: Re-using existing connection! (#0) with host ftp3.cerner.com
== Info: Connected to sftphost (123.456.789.163) port 22 (#0)
=> Send data, 1 bytes (0x1)
0000: 0a .
== Info: Connection #0 to host sftphost left intact
== Info: Closing connection #0

A request for a short listing:
    /bin/curl -u mylogin: --trace /tmp/jay --key /z/jay/.ssh/id_rsa --pubkey /z/jay/.ssh/id_rsa.pub \
       -l --url sftp://sftphost/svcnmh/835/

Returns "junk" and the trace file shows this:

== Info: About to connect() to sftphost port 22 (#0)
== Info: Trying 123.456.789.163... == Info: connected
== Info: Connected to sftphost (123.456.789.163) port 22 (#0)
== Info: SSH authentication methods available: publickey,password
== Info: Using ssh public key file /z/jay/.ssh/id_rsa.pub
== Info: Using ssh private key file /z/jay/.ssh/id_rsa
== Info: SSH public key authentication failed: Invalid signature for supplied public key, or bad username/public key combination
== Info: Initialized password authentication
== Info: Authentication complete
=> Send data, 4 bytes (0x4)
0000: 6a 75 6e 6b junk
== Info: Connection #0 to host sftphost left intact
== Info: Closing connection #0

Anything else I should include??

Thanks

Jim Young

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-06-03