Mega Search
23.2 Million


Sign Up

Make a donation  
Implicit TLS FTP connection problem  
News Group: embarcadero.public.delphi.internet.winsock

Hello,

I try to connect to a secured FTP implicit TLS server. I can connect to 
the server but when I try to send a file with the method "put", it 
returns me the error: "Server can not accept argument".

What about you? Sincerely, Mr. Graveron

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 20-Jan-2015, at 1:53 AM EST
From: Graveron Marc-Philippe
 
Re: Implicit TLS FTP connection problem  
News Group: embarcadero.public.delphi.internet.winsock
Graveron wrote:

> Since yesterday, I have advanced a little on the issue. I tried to
> connect with FileZilla and when connecting I have a certificate
> request that I do not have in embarcadero.

On which connection?  The Command connection, or the Data connection?  Remember, 
FTP uses multiple TCP connections.
 
-- 
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 21-Jan-2015, at 12:36 PM EST
From: Remy Lebeau (TeamB)
 
Re: Implicit TLS FTP connection problem  
News Group: embarcadero.public.delphi.internet.winsock
Thank you for your answer,

I use the Indy component 10 TidFTP.

Here are two functions that I use in my program. One is used to 
configure the connection. The other allows to send a file with the PUT 
method.

Since yesterday, I have advanced a little on the issue. I tried to 
connect with FileZilla and when connecting I have a certificate request 
that I do not have in embarcadero.

If the problem is there, how do I do to get this certificate?

Otherwise you'd have to dig another track?

Sincerely Mr. Graveron


Function TThreadConnexion.ConnectionFtp(IdFTP: TIdFTP; lHandler: 
TIdSSLIOHandlerSocketOpenSSL; typeFtp: integer): Boolean;
var
   ok: Boolean;
   monRepCertif: string;
Begin
   ok := False;
   AjouteTrace(Traduc('Connexion au serveur FTP'), str_host, TBeginMess);
   try
     case typeFtp of
       0:
         begin
           AjouteTrace(Traduc('Type de connexion'), Traduc('Non 
sécurisée'), TControlValue);
           IdFTP.host := str_host;
           IdFTP.Username := str_user;
           IdFTP.password := str_password;
           IdFTP.Port := StrToInt(str_port);
           IdFTP.ReadTimeout := 6000;
           IdFTP.TransferTimeout := 30000;
         end;
       1:
         begin
           AjouteTrace(Traduc('Type de connexion'), Traduc('Implicite 
sur TLS'), TControlValue);
           lHandler.SSLOptions.Mode := sslmClient;
           monRepCertif := REP_APPLI_LOCAL + 'FTPCertif\';
           ForceDirectories(monRepCertif);
           lHandler.SSLOptions.CertFile :='';
           lHandler.SSLOptions.KeyFile := '';
           lHandler.SSLOptions.RootCertFile := '';
           lHandler.SSLOptions.Method := sslvSSLv3;
           lHandler.SSLOptions.VerifyDepth := 0;

           IdFTP.IOHandler := lHandler;
           IdFTP.host := str_host;
           IdFTP.Port := StrToInt(str_port);
           IdFTP.Username := str_user;
           IdFTP.password := str_password;

           IdFTP.UseTLS := utUseImplicitTLS;
           IdFTP.DataPortProtection := ftpdpsPrivate;
           IdFTP.ReadTimeout := 6000;
           IdFTP.AUTHCmd := tAuthTLSP;
         end;
     end;

     Try
       If Not IdFTP.Connected Then
         Begin
           IdFTP.Connect;
           AjouteTrace(Traduc('Connexion'), 'OK', TRes);
           if IdFTP.UsingSFTP then
             AjouteTrace(Traduc('Connexion sécurisée'), 'TRUE', TRes)
           else
             AjouteTrace(Traduc('Connexion sécurisée'), 'FALSE', TRes);
         End
       Else
         AjouteTrace(Traduc('Connexion'), Traduc('OK : Déjà Connecté'), 
TRes);
       ok := True;
     Except
       On E: Exception Do
         Begin
           AjouteTrace(Traduc('Connexion au serveur FTP'), E.message, 
TException);
           ok := False;
         End;
     End;
   finally
     Result := ok;
     AjouteTrace('', '', tEnd);
   end;
End;

Function TThreadConnexion.EnvoiFichierFtp(IdFTP: TIdFTP; nomSrc, 
nomDest: String): Boolean;
var
   ok: Boolean;
Begin
   ok := False;
   AjouteTrace(Traduc('Envoi fichier FTP'), nomSrc + ' ' + 
Traduc('vers') + ' ' + nomDest, TBeginMess);
   try
     Try
       If (str_destination <> '') Then
         begin
           AjouteTrace(Traduc('Répertoire courant'), 
IdFTP.RetrieveCurrentDir, TControlValue);
           IdFTP.ChangeDir(str_destination);
           AjouteTrace(Traduc('Répertoire courant après changement de 
répertoire'), IdFTP.RetrieveCurrentDir, TControlValue);
           IdFTP.Put(nomSrc, nomDest);
         end
       Else
         begin
           AjouteTrace(Traduc('Destination'), nomDest, TControlValue);
           IdFTP.Put(nomSrc, nomDest);
         end;
       AjouteTrace(Traduc('Envoi'), 'OK', TRes);
       ok := True;
     Except
       On E: Exception Do
         Begin
           AjouteTrace(Traduc('Impossible d''envoyer le fichier'), 
E.message, TException);
           ok := False;
         End;
     End;
   finally
     Result := ok;
     AjouteTrace('', '', tEnd);
   end;
End;

  * Français - détecté
  * Anglais
  * Français

  * Anglais
  * Français

  

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 21-Jan-2015, at 1:07 AM EST
From: Graveron Marc-Philippe
 
Re: Implicit TLS FTP connection problem  
News Group: embarcadero.public.delphi.internet.winsock
Graveron wrote:

> I try to connect to a secured FTP implicit TLS server.

Which FTP component are you using?

> I can connect to the server but when I try to send a file with
> the method "put", it returns me the error: "Server can not
> accept argument".

On which FTP command exactly?  There are several commands involved when setting 
up a file transfer.

If you are using Indy's TIdFTP component, for instance, are you setting the 
DataPortProtection property to ftpdpsPrivate?  It is set to ftpdpsClear by 
default.

-- 
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 20-Jan-2015, at 12:48 PM EST
From: Remy Lebeau (TeamB)