cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re[2]: libcurl MLST

From: Алексей Тумакаев <alexeytk_at_bk.ru>
Date: Sun, 07 Feb 2016 15:23:32 +0300

 If I comment MLST command (for sftp), it doesn't work either:
I always get  only  one (first line):

drwxr-xr-x 11 root root 0 Mar 27 2014 sys
if i execute it with cmd: curl -k -u xxx:xxx sftp://xxxx:5000/
I get full list:
drwxr-xr-x 11 root root 0 Mar 27 2014 sys
drwx------ 2 root root 16384 Jul 30 2009 lost+found
drwxr-xr-x 22 root root 4096 Dec 31 2013 work
drwxr-xr-x 2 root root 4096 Jul 30 2009 plugin full log:

* About to connect() to xxxxxxxxxxx port 5000 (#0)
* Trying xxx.xxx.xxx.xxx...
* connected
* SSH authentication methods available: publickey,gssapi-keyex,gssapi-with-mic,password
* Using ssh public key file id_dsa.pub
* Using ssh private key file id_dsa
* SSH public key authentication failed: Unable to open public key file
* Initialized password authentication
* Authentication complete
L 02/07/2016 - 13:57:36: [pl.smx] STR - drwxr-xr-x 11 root root 0 Mar 27 2014 sys
 1 60
* Connection #0 to host xxxxxxxxxxxxxxxx left intact
* Closing connection #0 code:

public RequestFileList()
{
    new Handle:curl = curl_easy_init();
    if(curl != INVALID_HANDLE)
    {
        LogMessage("RequestFileList");

        CURL_DEFAULT_OPT(curl);

        curl_easy_setopt_function(curl, CURLOPT_WRITEFUNCTION, GetFileList);
        curl_easy_setopt_string(curl, CURLOPT_URL, "sftp://xxxxx:5000/");
        curl_easy_setopt_string(curl, CURLOPT_USERPWD, "xxx:xxx");
        curl_easy_setopt_int(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
        curl_easy_setopt_int(curl, CURLOPT_VERBOSE, 1);
        curl_easy_perform_thread(curl, onCompleteFilelist, 1);
    }
}
public GetFileList(Handle:hndl, const String:buffer[], const bytes, const nmemb)
{

    LogMessage("%s %i %i", buffer, bytes, nmemb);
}
if I replace MLST with MLSD (for ftp), i get nothing:

* About to connect() to xxxxxxxxxxxxxxx port 21 (#0)
* Trying xxx.xxx.xxx.xxx... * connected
< 220 ProFTPD 1.3.3g Server (MyArena.ru) [::ffff:xxx.xxx.xxx.xxx]
> AUTH SSL
< 500 AUTH not understood
> AUTH TLS
< 500 AUTH not understood
> USER user
< 331 Password required for user
> PASS password
< 230 User user logged in
> PWD
< 257 "/" is the current directory
* Entry path is '/'
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||65352|)
* Trying xxx.xxx.xxx.xxx... * connected
* Connecting to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 65352
> TYPE A
< 200 Type set to A
> MLSD
< 150 Opening ASCII mode data connection for MLSD
* Maxdownload = -1
DATA: www
.
logs
tmp
.codepage
email
..
mod-tmp
etc
1 64
* Remembering we are in dir ""
< 226 Transfer complete
> QUIT
< 221 Goodbye.
* Closing connection #0

>Воскресенье, 7 февраля 2016, 12:53 +01:00 от Dan Fandrich <dan_at_coneharvesters.com>:
>
>On Sun, Feb 07, 2016 at 01:15:54PM +0300, Алексей Тумакаев wrote:
>> Hello, i'm trying to get filelists from 2 ftp servers using MLST request, but
>> it doesn't work
>>
>> Version: libcurl/7.23.1 OpenSSL/0.9.8r zlib/1.2.5 libssh2/1.3.0
>> Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp
>> sftp smtp smtps telnet tftp
>>
>> 1)
>>
>> - FTP (MLST is not commented)
>[...]
>> > MLST
>> < 250-Start of list for /
>> < /
>> < 250 End of list
>> * RETR response: 250
>> * Remembering we are in dir ""
>> * Connection #0 to host spr1an.myarena.ru left intact
>> > QUIT
>> < 221 Goodbye.
>> * Closing connection #0
>>
>> Why MLST is empty?
>
>It's not empty—it's returning a single entry, which is what it's documented to
>do. Maybe you're looking for the MLSD command?
>
>> 1)
>> - SFTP (MLST is not commented)
>>
>>
>> curl_easy_setopt(curl, CURLOPT_URL, "sftp://xxxxxxxx:5000/");
>> curl_easy_setopt(curl, CURLOPT_USERPWD, "xxx:xxx");
>> curl_easy_setopt_function(curl, CURLOPT_WRITEFUNCTION, GetFileList);
>> curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
>> curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST , "MLST");
>> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
>> curl_easy_perform_thread(curl, onCompleteFilelist, 1);
>>
>> result:
>>
>>
>> * About to connect() to xxx.xxx.xxx.xxx port 5000 (#0)
>> * Trying xxx.xxx.xxx.xxx...
>> * connected
>> * SSH authentication methods available:
>> publickey,gssapi-keyex,gssapi-with-mic,password
>> * Using ssh public key file id_dsa.pub
>> * Using ssh private key file id_dsa
>> * SSH public key authentication failed: Unable to open public key file
>> * Initialized password authentication
>> * Authentication complete
>> DATA:
>> drwxr-xr-x 11 root root 0 Mar 27 2014 sys
>>
>> * Connection #0 to host xxx.xxx.xxx.xxx left intact
>> * Closing connection #0
>>
>> In this case curl doesn't try to execute MLST command.
>
>That's because MLST isn't an sftp command; sftp != ftps. Custom requests aren't
>supported for sftp.
>
>>>> Dan
>
>-------------------------------------------------------------------
>List admin: https://cool.haxx.se/list/listinfo/curl-library
>Etiquette: https://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-02-07