Archived Forum Post

Index of archived forum posts

Question:

Failed to ensure correct mode.

Jan 29 '13 at 15:18

What does Failed to ensure correct mode. mean? All of ftp to outbound servers work great except for this one.

01/25/2013 13:08:59:sendFile:Error d:ftpDLD20130125T130850P3068S01_BRDL025.SND.BRDL025.SND [] ChilkatLog:

PutFile:

DllDate: Dec 12 2012

UnlockPrefix: *****FTP

Username: 2K3-GSFTP01:dbloader

Architecture: Little Endian; 32-bit

Language: Windows Perl

VerboseLogging: 0

LocalFilename: d:\ftpDL\D20130125T130850P3068S01_BRDL025.SND.2170

RemoteFilename: BRDL025.SND

IdleTimeoutMs: 60000

ReceiveTimeoutMs: 60000

ConnectTimeoutSeconds: 60

initialGreeting: 220-Security Notice

220-You are about to access a secured resource. *** reserves the right to

220 monitor and/or limit access to this resource at any time.

SetModeBinary: Elapsed time: 16 millisec

Failed to ensure correct mode.

TotalTime: Elapsed time: 16 millisec

Failed.

Answer

This ftp ssl implicit port 990 passive mode. Connect and logon ok, the put is failing.


Answer

I would need to see more verbose information in the LastErrorText. Set the VerboseLogging property = 1 and then re-run. Post the verbose LastErrorText here.


Answer

ChilkatLog:

PutFile:

DllDate: Dec 12 2012

UnlockPrefix: FROSTBFTP

Username: 2K7MBS1:LE03964A

Architecture: Little Endian; 32-bit

Language: Windows Perl

VerboseLogging: 1

LocalFilename: c:\ftpDL\LOCKBOX\data\ENTKMAILBOX_D20130128T110025P3256S02_snd.lbx2170

RemoteFilename: snd

IdleTimeoutMs: 60000

ReceiveTimeoutMs: 60000

ConnectTimeoutSeconds: 60

initialGreeting: 220-Security Notice

220-You are about to access a secured resource. *** reserves the right to

220 monitor and/or limit access to this resource at any time.

readFtpControlChannelReply:

  receiveUntilMatchSb:

    tlsRecvAppData:

      readIncomingTls_appData:

        readTlsRecord:

          TLS 1.0, Application, sz=64

          paddingLen: 6

          macLen: 20

          decryptedMsg: [530 Please login with USER and PASS

]

        --readTlsRecord

      --readIncomingTls_appData

      rcvAppData: success, nReceived = 37

    --tlsRecvAppData

  --receiveUntilMatchSb

--readFtpControlChannelReply

SetModeBinary: Elapsed time: 31 millisec

Failed to ensure correct mode.

TotalTime: Elapsed time: 31 millisec

Failed.

--PutFile

--ChilkatLog


Answer

The response from the FTP server indicates that you haven't yet authenticated (i.e. logged in). Did you call Ftp2.ConnectOnly, but then neglected to call Ftp2.LoginAfterConnectOnly prior to attempting the file transfer?


Answer

You are right, it is not logged in. I do a Connect, and rc is true.

changed that to ConnectOnly rc = true. loginAfterConnectOnly rc = true.

The I did a IsConnected immediately, and the rc is false.

You have a defect in the code, as cannot return true on Connect scenario, and be not connected.


Answer

ChilkatLog: Connect_Ftp2: DllDate: Dec 12 2012 UnlockPrefix: FROSTBFTP Username: 2K7MBS1:LE03964A Architecture: Little Endian; 32-bit Language: Windows Perl VerboseLogging: 1 Using Implicit SSL ImplicitSsl: 1 AuthTls: 0 AuthSsl: 0 Hostname: files.udp.com Port: 990 Connecting via SSL Protocol: default IdleTimeoutMs: 60000 ConnectTimeout: 60 HeartbeatMs: 0 ConnectTimeoutMs_1: 60000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: files.udp.com resolveHostname1: dnsCacheLookup: files.udp.com Resolving domain name (IPV4) --resolveHostname1 GetHostByNameHB_ipv4: Elapsed time: 15 millisec myIP_1: 10.200.236.50 myPort_1: 50263 connect successful (1) 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=3309 decryptedMsg: [=02=00=00F=03=01Q=07=EE=F3=A7]7=F4=13=8E=98=18=CEAI=EF=D4;'=8D2=90=CA=AE=DE:xKX.=CE9 =D0=05=00=00=E3=E7=D4=C9=C5=8F=ED=01=C63=E3@{=DA=CF=81=F6X=83m=82=03=EDC=19+=D3=00/=00=0B=00=0C=9B=00=0C=98=00=03=D60=82=03=D20=82=02=BA=A0=03=02=01=02=02=10Q=B9=99=0A=90=EA=88[=C8X@=E5=FA-=FC=E80=0D=06 =86H=86=F7=0D=01=01=05=05=000<1=0B0 =06=03U=04=06=13=02US1=150=13=06=03U=04=0A=13=0CThawte, Inc.1=160=14=06=03U=04=03=13=0DThawte SSL CA0=1E=17=0D101213000000Z=17=0D160121235959Z0k1=0B0 =06=03U=04=06=13=02US1=0E0=0C=06=03U=04=08=13=05Texas1] --readTlsRecord processTlsRecord: processHandshake: handshakeMessageType: ServerHello handshakeMessageLen: 0x46 handshakeMessageLen: 70 nBytesLeft: 3305 processHandshakeMessage: MessageType: ServerHello Processing ServerHello... ServerHello: MajorVersion: 3 MinorVersion: 1 SessionIdLen: 32 CipherSuite: RSA_WITH_AES_128_CBC_SHA CipherSuite: 00,2f CompressionMethod: 0 Queueing ServerHello message. ServerHello is OK. --ServerHello --processHandshakeMessage handshakeMessageType: Certificate handshakeMessageLen: 0xc9b handshakeMessageLen: 3227 nBytesLeft: 3231 processHandshakeMessage: MessageType: Certificate ProcessCertificates: Certificate: derSize: 982 certSubjectCN: files.udp.com certSerial: 51B9990A90EA885BC85840E5FA2DFCE8 certIssuerCN: Thawte SSL CA --Certificate Certificate: derSize: 1136 certSubjectCN: Thawte SSL CA certSerial: 4D5F2C3408B24C20CD6D507E244DC9EC certIssuerCN: thawte Primary Root CA --Certificate Certificate: derSize: 1097 certSubjectCN: thawte Primary Root CA certSerial: 3365500879AD73E230B9E01D0D7FAC91 certIssuerCN: Thawte Premium Server CA --Certificate NumCertificates: 3 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: 128 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=E1=DF=98=00dR=D1w=CAh.=AF] --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. Secure Channel Established. Turning on TCP_NODELAY. socketOptions: SO_SNDBUF: 64512 SO_RCVBUF: 8192 TCP_NODELAY: 8193 --socketOptions readFtpControlChannelReply: receiveUntilMatchSb: tlsRecvAppData: readIncomingTls_appData: readTlsRecord: TLS 1.0, Application, sz=48 paddingLen: 6 macLen: 20 decryptedMsg: [220-Security Notice] --readTlsRecord --readIncomingTls_appData rcvAppData: success, nReceived = 21 --tlsRecvAppData --receiveUntilMatchSb ftpReceiveUntilMatch2: receiveUntilMatchSb: tlsRecvAppData: readIncomingTls_appData: readTlsRecord: TLS 1.0, Application, sz=96 paddingLen: 0 macLen: 20 decryptedMsg: [220-You are about to access a secured resource. UDP reserves the right to] --readTlsRecord --readIncomingTls_appData rcvAppData: success, nReceived = 75 --tlsRecvAppData --receiveUntilMatchSb --ftpReceiveUntilMatch2 ftpReceiveUntilMatch2: receiveUntilMatchSb: tlsRecvAppData: readIncomingTls_appData: readTlsRecord: TLS 1.0, Application, sz=96 paddingLen: 12 macLen: 20 decryptedMsg: [220 monitor and/or limit access to this resource at any time.] --readTlsRecord --readIncomingTls_appData rcvAppData: success, nReceived = 63 --tlsRecvAppData --receiveUntilMatchSb --ftpReceiveUntilMatch2 --readFtpControlChannelReply initialStatus: 220 initialResponse: 220-Security Notice 220-You are about to access a secured resource. UDP reserves the right to 220 monitor and/or limit access to this resource at any time. Skipping authentication, no username Login successful. readFtpControlChannelReply: receiveUntilMatchSb: tlsRecvAppData: readIncomingTls_appData: readTlsRecord: TLS 1.0, Application, sz=64 paddingLen: 6 macLen: 20 decryptedMsg: [530 Please login with USER and PASS] --readTlsRecord --readIncomingTls_appData rcvAppData: success, nReceived = 37 --tlsRecvAppData --receiveUntilMatchSb --readFtpControlChannelReply SYST command failed readFtpControlChannelReply: receiveUntilMatchSb: tlsRecvAppData: readIncomingTls_appData: readTlsRecord: TLS 1.0, Application, sz=64 paddingLen: 6 macLen: 20 decryptedMsg: [530 Please login with USER and PASS] --readTlsRecord --readIncomingTls_appData rcvAppData: success, nReceived = 37 --tlsRecvAppData --receiveUntilMatchSb --readFtpControlChannelReply FEAT command failed Success. --Connect_Ftp2

--ChilkatLog 01/29/2013 09:47:21:login:OK [] 01/29/2013 09:47:35:sendFile:Error c:ftpDLLOCKBOXdataENTKMAILBOX_D20130129T094618P4960S02_snd.lbx2170-snd [] ChilkatLog: PutFile: DllDate: Dec 12 2012 UnlockPrefix: FROSTBFTP Username: 2K7MBS1:LE03964A Architecture: Little Endian; 32-bit Language: Windows Perl VerboseLogging: 1 LocalFilename: c:ftpDLLOCKBOXdataENTKMAILBOX_D20130129T094618P4960S02_snd.lbx2170 RemoteFilename: snd IdleTimeoutMs: 60000 ReceiveTimeoutMs: 60000 ConnectTimeoutSeconds: 60 initialGreeting: 220-Security Notice 220-You are about to access a secured resource. UDP reserves the right to 220 monitor and/or limit access to this resource at any time. readFtpControlChannelReply: receiveUntilMatchSb: tlsRecvAppData: readIncomingTls_appData: readTlsRecord: TLS 1.0, Application, sz=64 paddingLen: 6 macLen: 20 decryptedMsg: [530 Please login with USER and PASS] --readTlsRecord --readIncomingTls_appData rcvAppData: success, nReceived = 37 --tlsRecvAppData --receiveUntilMatchSb --readFtpControlChannelReply SetModeBinary: Elapsed time: 15 millisec Failed to ensure correct mode. TotalTime: Elapsed time: 31 millisec Failed. --PutFile --ChilkatLog

01/29/2013 09:47:40:Failed to FTP c:ftpDLLOCKBOXdataENTKMAILBOX_D20130129T094618P4960S02_snd.lbx2170 to snd:


Answer

ChilkatLog:

Connect_Ftp2:

DllDate: Dec 12 2012

UnlockPrefix: FROSTBFTP

Username: 2K7MBS1:LE03964A

Architecture: Little Endian; 32-bit

Language: Windows Perl

VerboseLogging: 1

Using Implicit SSL

ImplicitSsl: 1

AuthTls: 0

AuthSsl: 0

Hostname: files.udp.com

Port: 990

Connecting via SSL

Protocol: default

IdleTimeoutMs: 60000

ConnectTimeout: 60

HeartbeatMs: 0

ConnectTimeoutMs_1: 60000

calling ConnectSocket2

IPV6 enabled connect with NO heartbeat.

connectingTo: files.udp.com

resolveHostname1:

  dnsCacheLookup: files.udp.com

  Resolving domain name (IPV4)

--resolveHostname1

GetHostByNameHB_ipv4: Elapsed time: 15 millisec

myIP_1: 10.200.236.50

myPort_1: 50263

connect successful (1)

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=3309

    decryptedMsg: [=02=00=00F=03=01Q=07=EE=F3=A7]7=F4=13=8E=98=18=CEAI=EF=D4;'=8D2=90=CA=AE=DE:xKX.=CE9 =D0=05=00=00=E3=E7=D4=C9=C5=8F=ED=01=C63=E3@{=DA=CF=81=F6X=83*m=82=03=EDC=19+=D3=00/=00=0B=00=0C=9B=00=0C=98=00=03=D60=82=03=D20=82=02=BA=A0=03=02=01=02=02=10Q=B9=99=0A=90=EA=88[=C8X@=E5=FA-=FC=E80=0D=06 *=86H=86=F7=0D=01=01=05=05=000<1=0B0    =06=03U=04=06=13=02US1=150=13=06=03U=04=0A=13=0CThawte, Inc.1=160=14=06=03U=04=03=13=0DThawte SSL CA0=1E=17=0D101213000000Z=17=0D160121235959Z0k1=0B0   =06=03U=04=06=13=02US1=0E0=0C=06=03U=04=08=13=05Texas1]

  --readTlsRecord

  processTlsRecord:

    processHandshake:

      handshakeMessageType: ServerHello

      handshakeMessageLen: 0x46

      handshakeMessageLen: 70

      nBytesLeft: 3305

      processHandshakeMessage:

        MessageType: ServerHello

        Processing ServerHello...

        ServerHello:

          MajorVersion: 3

          MinorVersion: 1

          SessionIdLen: 32

          CipherSuite: RSA_WITH_AES_128_CBC_SHA

          CipherSuite: 00,2f

          CompressionMethod: 0

          Queueing ServerHello message.

          ServerHello is OK.

        --ServerHello

      --processHandshakeMessage

      handshakeMessageType: Certificate

      handshakeMessageLen: 0xc9b

      handshakeMessageLen: 3227

      nBytesLeft: 3231

      processHandshakeMessage:

        MessageType: Certificate

        ProcessCertificates:

          Certificate:

            derSize: 982

            certSubjectCN: files.udp.com

            certSerial: 51B9990A90EA885BC85840E5FA2DFCE8

            certIssuerCN: Thawte SSL CA

          --Certificate

          Certificate:

            derSize: 1136

            certSubjectCN: Thawte SSL CA

            certSerial: 4D5F2C3408B24C20CD6D507E244DC9EC

            certIssuerCN: thawte Primary Root CA

          --Certificate

          Certificate:

            derSize: 1097

            certSubjectCN: thawte Primary Root CA

            certSerial: 3365500879AD73E230B9E01D0D7FAC91

            certIssuerCN: Thawte Premium Server CA

          --Certificate

          NumCertificates: 3

          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: 128

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=E1=DF=98=00dR=D1w=CAh.=AF]

  --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.

Secure Channel Established.

Turning on TCP_NODELAY.

socketOptions:

  SO_SNDBUF: 64512

  SO_RCVBUF: 8192

  TCP_NODELAY: 8193

--socketOptions

readFtpControlChannelReply:

  receiveUntilMatchSb:

    tlsRecvAppData:

      readIncomingTls_appData:

        readTlsRecord:

          TLS 1.0, Application, sz=48

          paddingLen: 6

          macLen: 20

          decryptedMsg: [220-Security Notice

]

        --readTlsRecord

      --readIncomingTls_appData

      rcvAppData: success, nReceived = 21

    --tlsRecvAppData

  --receiveUntilMatchSb

  ftpReceiveUntilMatch2:

    receiveUntilMatchSb:

      tlsRecvAppData:

        readIncomingTls_appData:

          readTlsRecord:

            TLS 1.0, Application, sz=96

            paddingLen: 0

            macLen: 20

            decryptedMsg: [220-You are about to access a secured resource. UDP reserves the right to

]

          --readTlsRecord

        --readIncomingTls_appData

        rcvAppData: success, nReceived = 75

      --tlsRecvAppData

    --receiveUntilMatchSb

  --ftpReceiveUntilMatch2

  ftpReceiveUntilMatch2:

    receiveUntilMatchSb:

      tlsRecvAppData:

        readIncomingTls_appData:

          readTlsRecord:

            TLS 1.0, Application, sz=96

            paddingLen: 12

            macLen: 20

            decryptedMsg: [220 monitor and/or limit access to this resource at any time.

]

          --readTlsRecord

        --readIncomingTls_appData

        rcvAppData: success, nReceived = 63

      --tlsRecvAppData

    --receiveUntilMatchSb

  --ftpReceiveUntilMatch2

--readFtpControlChannelReply

initialStatus: 220

initialResponse: 220-Security Notice

220-You are about to access a secured resource. UDP reserves the right to

220 monitor and/or limit access to this resource at any time.

Skipping authentication, no username

Login successful.

readFtpControlChannelReply:

  receiveUntilMatchSb:

    tlsRecvAppData:

      readIncomingTls_appData:

        readTlsRecord:

          TLS 1.0, Application, sz=64

          paddingLen: 6

          macLen: 20

          decryptedMsg: [530 Please login with USER and PASS

]

        --readTlsRecord

      --readIncomingTls_appData

      rcvAppData: success, nReceived = 37

    --tlsRecvAppData

  --receiveUntilMatchSb

--readFtpControlChannelReply

SYST command failed

readFtpControlChannelReply:

  receiveUntilMatchSb:

    tlsRecvAppData:

      readIncomingTls_appData:

        readTlsRecord:

          TLS 1.0, Application, sz=64

          paddingLen: 6

          macLen: 20

          decryptedMsg: [530 Please login with USER and PASS

]

        --readTlsRecord

      --readIncomingTls_appData

      rcvAppData: success, nReceived = 37

    --tlsRecvAppData

  --receiveUntilMatchSb

--readFtpControlChannelReply

FEAT command failed

Success.

--Connect_Ftp2

--ChilkatLog

01/29/2013 09:47:21:login:OK [] 01/29/2013 09:47:35:sendFile:Error c:ftpDLLOCKBOXdataENTKMAILBOX_D20130129T094618P4960S02_snd.lbx2170-snd [] ChilkatLog:

PutFile:

DllDate: Dec 12 2012

UnlockPrefix: FROSTBFTP

Username: 2K7MBS1:LE03964A

Architecture: Little Endian; 32-bit

Language: Windows Perl

VerboseLogging: 1

LocalFilename: c:\ftpDL\LOCKBOX\data\ENTKMAILBOX_D20130129T094618P4960S02_snd.lbx2170

RemoteFilename: snd

IdleTimeoutMs: 60000

ReceiveTimeoutMs: 60000

ConnectTimeoutSeconds: 60

initialGreeting: 220-Security Notice

220-You are about to access a secured resource. UDP reserves the right to

220 monitor and/or limit access to this resource at any time.

readFtpControlChannelReply:

  receiveUntilMatchSb:

    tlsRecvAppData:

      readIncomingTls_appData:

        readTlsRecord:

          TLS 1.0, Application, sz=64

          paddingLen: 6

          macLen: 20

          decryptedMsg: [530 Please login with USER and PASS

]

        --readTlsRecord

      --readIncomingTls_appData

      rcvAppData: success, nReceived = 37

    --tlsRecvAppData

  --receiveUntilMatchSb

--readFtpControlChannelReply

SetModeBinary: Elapsed time: 15 millisec

Failed to ensure correct mode.

TotalTime: Elapsed time: 31 millisec

Failed.

--PutFile

--ChilkatLog

01/29/2013 09:47:40:Failed to FTP c:ftpDLLOCKBOXdataENTKMAILBOX_D20130129T094618P4960S02_snd.lbx2170 to snd:


Answer

Look at the contents of the LastErrorText for the Connect method call closely. You'll find this:

"Skipping authentication, no username".


Answer

my bad, still shouldn't I have gotten a false on the connect???

Thanks so much.


Answer

I guess this also may be a catch-22, as a client cert does not require logon and password.