Marc Allaume
Marc Allaume

Reputation: 83

.Net FTPS Connection times out after sending 'CCC' command

I've been struggling a lot these last few days with a FTPS server that requires the 'CCC' command I'm trying to access via .Net

I'm using AlexFTPS Library. I'm able to connect and negociate AUTH TLS, I'm able to change directory but when I'm trying to list directory or download files, server asks for 'CCC' command. When I send 'CCC' command, I get a '200 CCC Context Enabled' reply but then I cannot send anything else, anytime I get a server timeout exception.

I've done further tests :

Any help would be so much appreciated... Sorry I am not FTP fluent...

Here's my code :

    Using Client As New AlexPilotti.FTPS.Client.FTPSClient

        AddHandler Client.LogCommand, Sub(sender As Object, args As AlexPilotti.FTPS.Common.LogCommandEventArgs)
                                          Console.WriteLine(args.CommandText)
                                      End Sub

        AddHandler Client.LogServerReply, Sub(sender As Object, args As AlexPilotti.FTPS.Common.LogServerReplyEventArgs)
                                              Console.WriteLine(args.ServerReply)
                                          End Sub

        Dim cred = New Net.NetworkCredential("login", "password")
        Client.Connect("ftps.server.com", cred, AlexPilotti.FTPS.Client.ESSLSupportMode.CredentialsRequired)

        Client.SendCustomCommand("SYST")
        Client.SendCustomCommand("PBSZ 0")
        Client.SendCustomCommand("PROT P")
        Client.SendCustomCommand("FEAT")
        Client.SendCustomCommand("PWD")
        Client.SendCustomCommand("TYPE A")
        Client.SendCustomCommand("PASV")
        Client.SendCustomCommand("CCC")
        Client.SendCustomCommand("LIST")

        Console.ReadKey()

    End Using

Thanks !

Upvotes: 2

Views: 738

Answers (1)

Steffen Ullrich
Steffen Ullrich

Reputation: 123375

CCC ("Clear Command Channel") is a special command which downgrades the connection from SSL (started with AUTH TLS) back to unencrypted again. So it's no enough to just declare it as a custom command which gets send on the established control connection, it has to be handled similar to AUTH TLS by the FTPS library so that after the command is done the TLS downgrade occurs.

Upvotes: 1

Related Questions