login about faq

Using the latest release (the SP1 build, but the 9.4.1 build shows the same issue) get_NumFilesAndDirs() returns 0 when there is a file or subdirectory present.

I have made a little sample program that dumps the lastErrorText and sessionlog after the get_NumFilesAndDirs() call, it clearly shows that a sub-directory called INTRUM is present, so I expect get_NumFilesAndDirs() to return 1 instead of 0.

When I changedirectory to INTRUM and call get_NumFilesAndDirs it also returns 0 (but there really is a file present).

I will email you a link to the sample program with the user/password/servername included.

void dump(wchar_t* what, CkFtp2& ftp, bool clearsessionlog)
{
    _tprintf(L"=====%s=====\nlasterrortext:\n", what);
    CkString s; s.put_Utf8(true);
    s.appendUtf8(ftp.lastErrorText());
    _tprintf(L"%s\n\n", s.getUnicode());
    _tprintf(L"sessionlog:\n");
    s.clear();
    s.appendUtf8(ftp.sessionLog());
    _tprintf(L"%s\n", s.getUnicode());
    _tprintf(L"END==%s=====\n", what);

if (clearsessionlog)
        ftp.ClearSessionLog();
}

.....

CkFtp2 ftp;
        ftp.UnlockComponent("secret");
        ftp.put_Utf8(true);
        ftp.put_Hostname("???");
        ftp.put_Username("???");
        ftp.put_Password("???");
        ftp.put_Passive(true);
        ftp.put_AutoFeat(true);
        ftp.put_AutoSyst(true);

ftp.put_Ssl(true);
        ftp.put_AuthTls(false);

ftp.put_Port(990);

ftp.put_KeepSessionLog(true);
        ftp.put_VerboseLogging(true);

if (ftp.Connect()==true)
        {
            dump(L"connect ok", ftp, true);
            _tprintf(L"changeremote to /\n");
            if (ftp.ChangeRemoteDir("/")==false)
            {
                dump(L"changeremote to / fails", ftp, true);
                return 1;
            }
            int nfd = ftp.get_NumFilesAndDirs();
            _tprintf(L"numfilesanddirs: %i\n", nfd);
            dump(L"numfilesanddirs", ftp, true);

and here is the output (the "dump" call) after numfilesaanddirs:

changeremote to /
numfilesanddirs: 0
=====numfilesanddirs=====
lasterrortext:
ChilkatLog:
  NumFilesAndDirs:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: WATCHDFTP
    Username: DELL7:Gert
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 9.0
    VerboseLogging: 1
    FTP directory cache not fresh.  Fetching dir listing...
    checkDirCache_listPattern:
      supportsMLSD: 0
      initialGreeting: 220 Service ready for new user.
      ListDir:
        readFtpControlChannelReply:
          rcvUntilMatchStringQP: =0A
          dbReceived0: 
          tlsRecvAppData:
            readIncomingTls_appData:
              readTlsRecord:
                TLS 1.0, Application, sz=48
                paddingLen: 3
                macLen: 20
                decryptedMsg: [200 Command PBSZ okay.
]
              --readTlsRecord
            --readIncomingTls_appData
            rcvAppData: success, nReceived = 24
          --tlsRecvAppData
          startIdx: 0
          dbReceived: 200 Command PBSZ okay.

Found match string.
        --readFtpControlChannelReply
        Sent PROT P command.
        readFtpControlChannelReply:
          rcvUntilMatchStringQP: =0A
          dbReceived0: 
          tlsRecvAppData:
            readIncomingTls_appData:
              readTlsRecord:
                TLS 1.0, Application, sz=48
                paddingLen: 3
                macLen: 20
                decryptedMsg: [200 Command PROT okay.
]
              --readTlsRecord
            --readIncomingTls_appData
            rcvAppData: success, nReceived = 24
          --tlsRecvAppData
          startIdx: 0
          dbReceived: 200 Command PROT okay.

Found match string.
        --readFtpControlChannelReply
        ProtPResponse: 200 Command PROT okay.
        Passive transfer mode
        setupPassiveDataSocket1:
          readFtpControlChannelReply:
            rcvUntilMatchStringQP: =0A
            dbReceived0: 
            tlsRecvAppData:
              readIncomingTls_appData:
                readTlsRecord:
                  TLS 1.0, Application, sz=80
                  paddingLen: 9
                  macLen: 20
                  decryptedMsg: [227 Entering Passive Mode (195,68,89,204,121,73)
]
                --readTlsRecord
              --readIncomingTls_appData
              rcvAppData: success, nReceived = 50
            --tlsRecvAppData
            startIdx: 0
            dbReceived: 227 Entering Passive Mode (195,68,89,204,121,73)

Found match string.
          --readFtpControlChannelReply
          hostAddr: 195.68.89.204
          DataConnect:
            hostname: 195.68.89.204
            port: 31049
            ConnectTimeoutMs_1: 60000
            calling ConnectSocket2
            IPV6 enabled connect with NO heartbeat.
            This is an IPV4 numeric address...
            AddrInfoList:
              AddrInfo:
                ai_flags: 4
                ai_family: 2
                ai_socktype: 1
                ai_protocol: 0
                ai_addrlen: 16
                ai_canonname: (NULL)
              --AddrInfo
            --AddrInfoList
            Connect using IPV4.
            ipAddress1: 195.68.89.204
            myIP_3: 192.168.0.102
            myPort_3: 50261
            connect successful (2)
            socketOptions:
              SO_SNDBUF: 8192
              SO_RCVBUF: 8192
              TCP_NODELAY: 0
            --socketOptions
          --DataConnect
        --setupPassiveDataSocket1
        SendingFtpCommand:
          sendingCommand: LIST
        --SendingFtpCommand
        ssl_protocol_2: 0
        ConvertToTls_2:
          clientHandshake:
            clientHelloMajorMinorVersion: 3.1
            buildClientHello:
              majorVersion: 3
              minorVersion: 1
              numRandomBytes: 32
              sessionIdSize: 0
              numCipherSuites: 10
              numCompressionMethods: 1
            --buildClientHello
            readIncomingTls_serverHello:
              readTlsRecord:
                TLS 1.0, Handshake, sz=2404
                decryptedMsg: [=02=00=00F=03=01R-=8B_=A6=9B=10=CB4  =D0=F5y=CF=D2";=A4=DB=96=F8n=AD=C4=C9=C3=95=FA=AA=8Bk=9E R-=8B_=F9,=9B=0D=06/=877=87=90=ACC=99=96=89=F4=9C:Q"=DDi;=8C=EF)=0C=CD=005=00=0B=00    =12=00  =0F=00=0500=82=05,0=82=04=14=A0=03=02=01=02=02=03=07=E0=0C0=0D=06   *=86H=86=F7=0D=01=01=05=05=000<1=0B0    =06=03U=04=06=13=02US1=170=15=06=03U=04=0A=13=0EGeoTrust, Inc.1=140=12=06=03U=04=03=13=0BRapidSSL CA0=1E=17=0D120820101450Z=17=0D140823091126Z0=81=C21)0'=06=03U=04=05=13 tr2ovUgFIliW3ALfcKBvZbUalXrEDtC]
              --readTlsRecord
              processTlsRecord:
                processHandshake:
                  handshakeMessageType: ServerHello
                  handshakeMessageLen: 0x46
                  handshakeMessageLen: 70
                  nBytesLeft: 2400
                  processHandshakeMessage:
                    MessageType: ServerHello
                    Processing ServerHello...
                    ServerHello:
                      MajorVersion: 3
                      MinorVersion: 1
                      SessionIdLen: 32
                      CipherSuite: RSA_WITH_AES_256_CBC_SHA
                      CipherSuite: 00,35
                      CompressionMethod: 0
                      Queueing ServerHello message.
                      ServerHello is OK.
                    --ServerHello
                  --processHandshakeMessage
                  handshakeMessageType: Certificate
                  handshakeMessageLen: 0x912
                  handshakeMessageLen: 2322
                  nBytesLeft: 2326
                  processHandshakeMessage:
                    MessageType: Certificate
                    ProcessCertificates:
                      Certificate:
                        derSize: 1328
                        certSubjectCN: easyftp.????????
                        certSerial: 07E00C
                        certIssuerCN: RapidSSL CA
                      --Certificate
                      Certificate:
                        derSize: 985
                        certSubjectCN: RapidSSL CA
                        certSerial: 0236D1
                        certIssuerCN: GeoTrust Global CA
                      --Certificate
                      NumCertificates: 2
                      Queueing Certificates message...
                    --ProcessCertificates
                  --processHandshakeMessage
                  handshakeMessageType: ServerHelloDone
                  handshakeMessageLen: 0x0
                  handshakeMessageLen: 0
                  nBytesLeft: 0
                  processHandshakeMessage:
                    MessageType: ServerHelloDone
                    Queueing HelloDone message.
                  --processHandshakeMessage
                --processHandshake
              --processTlsRecord
            --readIncomingTls_serverHello
            HandshakeQueue:
              MessageType: ServerHello
              MessageType: Certificate
              MessageType: ServerHelloDone
            --HandshakeQueue
            Dequeued ServerHello message.
            Dequeued Certificate message.
            DequeuedMessageType: ServerHelloDone
            OK to ServerHelloDone!
            No client certificate required by the server.
            Encrypted pre-master secret with server certificate RSA public key is OK.
            Sending ClientKeyExchange...
            Sent ClientKeyExchange message.
            Sending ChangeCipherSpec...
            Sent ChangeCipherSpec message.
            Derived keys.
            Installed new outgoing security params.
            Sending FINISHED message..
            algorithm: aes
            keyLength: 256
            Sent FINISHED message..
            readIncomingTls_changeCipherSpec2:
              readTlsRecord:
                TLS 1.0, ChangeCipherSpec, sz=1
                decryptedMsg: [=01]
              --readTlsRecord
              processTlsRecord:
                processChangeCipherSpec:
                  ccsProtocolType: 1
                --processChangeCipherSpec
              --processTlsRecord
            --readIncomingTls_changeCipherSpec2
            readIncomingTls_handshakeFinished2:
              readTlsRecord:
                TLS 1.0, Handshake, sz=48
                paddingLen: 11
                macLen: 20
                decryptedMsg: [=14=00=00=0C/gh=1DW=C5a=A7=DF=7F=F9=86]
              --readTlsRecord
              processTlsRecord:
                processHandshake:
                  handshakeMessageType: HandshakeFinished
                  handshakeMessageLen: 0xc
                  handshakeMessageLen: 12
                  nBytesLeft: 12
                  processHandshakeMessage:
                    MessageType: HandshakeFinished
                    FinishedMsgLen: 12
                    Queueing Finished message.
                  --processHandshakeMessage
                --processHandshake
              --processTlsRecord
            --readIncomingTls_handshakeFinished2
            Dequeue the FINISHED message...
            Dequeued Finished message.
            Handshake completed successfully.
          --clientHandshake
          Secure Channel Established.
        --ConvertToTls_2
        ReadInitialReply2:
          readFtpControlChannelReply:
            rcvUntilMatchStringQP: =0A
            dbReceived0: 
            tlsRecvAppData:
              readIncomingTls_appData:
                readTlsRecord:
                  TLS 1.0, Application, sz=80
                  paddingLen: 5
                  macLen: 20
                  decryptedMsg: [150 File status okay; about to open data connection.
]
                --readTlsRecord
              --readIncomingTls_appData
              rcvAppData: success, nReceived = 54
            --tlsRecvAppData
            startIdx: 0
            dbReceived: 150 File status okay; about to open data connection.

Found match string.
          --readFtpControlChannelReply
        --ReadInitialReply2
        listDirStatusCode: 150
        listDirIntermediateReply: 150 File status okay; about to open data connection.
        ReadFtpDataChannel:
          s2_ReadMax2Output...
          readIncomingTls_appData:
            readTlsRecord:
              TLS 1.0, Application, sz=80
              paddingLen: 8
              macLen: 20
              decryptedMsg: [drwx------   0              0 Sep  6 11:42 INTRUM
]
            --readTlsRecord
          --readIncomingTls_appData
          readIncomingTls_appData:
            readTlsRecord:
              TLS 1.0, Alert, sz=32
              paddingLen: 9
              macLen: 20
              decryptedMsg: [=01=00]
            --readTlsRecord
            processTlsRecord:
              processAlert:
                TlsAlert:
                  level: warning
                  descrip: close notify
                --TlsAlert
              --processAlert
            --processTlsRecord
          --readIncomingTls_appData
          Received close-notify.
          dirListSize: 51
        --ReadFtpDataChannel
        Type 0 directory listing
        readFtpControlChannelReply:
          rcvUntilMatchStringQP: =0A
          dbReceived0: 
          tlsRecvAppData:
            readIncomingTls_appData:
              readTlsRecord:
                TLS 1.0, Application, sz=64
                paddingLen: 13
                macLen: 20
                decryptedMsg: [226 Closing data connection.
]
              --readTlsRecord
            --readIncomingTls_appData
            rcvAppData: success, nReceived = 30
          --tlsRecvAppData
          startIdx: 0
          dbReceived: 226 Closing data connection.

Found match string.
        --readFtpControlChannelReply
        ListTimeMS: 296
      --ListDir
      rawDirListingQP: drwx------   0              0 Sep  6 11:42 INTRUM

--checkDirCache_listPattern
    N: 0
    Success.
  --NumFilesAndDirs
--ChilkatLog

sessionlog:
.
CWD /
250 Directory changed to /
.
PBSZ 0
200 Command PBSZ okay.
.
PROT P
200 Command PROT okay.
.
PASV
227 Entering Passive Mode (195,68,89,204,121,73)
.
LIST
150 File status okay; about to open data connection.

(DirListingCharset: utf-8)
listing size = 51
drwx------   0              0 Sep  6 11:42 INTRUM
226 Closing data connection.

END==numfilesanddirs=====

asked Sep 09 '13 at 05:12

Gert's gravatar image

Gert ♦
629141824


Thanks Gert! I'll have a look...

link

answered Sep 09 '13 at 08:43

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

The problem is that the user/group fields are missing in the directory listing line. For example, this is what one would typically see:

drwxrwxr-x    2 1000     1000         4096 Sep 09 07:59 test2
This is the directory listing line with the user/group fields missing:
drwx------   0              0 Sep  9 11:23 INTRUM
I'll see what I can do to handle this odd situation..

link

answered Sep 09 '13 at 09:16

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Great. In case you provide a test-build, I need VC2008, both x64 as x32 builds.

link

answered Sep 09 '13 at 09:20

Gert's gravatar image

Gert ♦
629141824

I fixed the problem and will provide a build near the end of my day today. :)

(Sep 09 '13 at 09:59) chilkat ♦♦
link

answered Sep 09 '13 at 17:49

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Great, I will test later today. Do you consider those new builds safe for release?

(Sep 10 '13 at 03:21) Gert ♦

Yes, it should be OK.

(Sep 10 '13 at 08:00) chilkat ♦♦

It looks like it is working fine now, thanks.

(Sep 12 '13 at 03:06) Gert ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×21
×7

Asked: Sep 09 '13 at 05:12

Seen: 1,422 times

Last updated: Sep 12 '13 at 03:06

powered by OSQA