Format of server version is invalid

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
ulfb
Posts: 2
Joined: Tue 16 Oct 2012 13:39

Format of server version is invalid

Post by ulfb » Tue 16 Oct 2012 13:48

Hi there,

I know, the question has been asked before (http://forums.devart.com/viewtopic.php?t=22848#p76406) the resolution was however not posted in the forum...

Im receiving a "Format of server version is invalid" exception when connecting to a customer's SFTP server using this code (please note, that the password is invalid):

procedure TmyForm.foo;
begin
ScFileStorage := TScFileStorage.Create(nil);
ScSSHClient := TScSSHClient.Create(nil);
ScSFTPClient := TScSFTPClient.Create(nil);

ScSSHClient.KeyStorage := ScFileStorage;
ScSFTPClient.SSHClient := ScSSHClient;
ScSSHClient.HostName := 'data.eon.leadflow.nl';
ScSSHClient.User := '[email protected]';
ScSSHClient.Password := 'blabla'; // password is invalid!
ScSSHClient.Port := 21;
ScSSHClient.OnServerKeyValidate := ScSSHClientServerKeyValidate;
ScSSHClient.Authentication := atPassword;
ScSSHClient.Connect;
end;

procedure TmyForm.ScSSHClientServerKeyValidate(Sender: TObject; NewServerKey: TScKey; var Accept: Boolean);
begin
Accept := True;
end;

Any suggestions?`

Thanks in advance

Ulf

AndreyZ

Re: Format of server version is invalid

Post by AndreyZ » Fri 19 Oct 2012 09:48

Hello,

You are using the incorrect port, 21 is FTP port. SSH server works on the 22 port. To solve the problem, you should change port 21 to port 22 in your code.

ulfb
Posts: 2
Joined: Tue 16 Oct 2012 13:39

Re: Format of server version is invalid

Post by ulfb » Fri 19 Oct 2012 12:06

Hello,

sure it's somewhat unusal, but reading my favourite's FTP client log I'm pretty sure it is port 21:

Code: Select all

Welcome to Core FTP, release ver 2.1, build 1593 (U) -- © 2003-2009
WinSock 2.0
Mem -- 4,194,303 KB, Virt -- 2,097,024 KB
Started on Friday October 19, 2012 at 13:17:PM
Resolving data.eon.leadflow.nl...  
Connect socket #936 to 79.99.134.80, port 21...
220 FTP Server ready.  
AUTH TLS  
234 AUTH TLS successful  
TLSv1, cipher TLSv1/SSLv3 (DHE-RSA-AES256-SHA) - 256 bit
USER [email protected]  
331 Password required for [email protected]  
PASS **********  
230 User [email protected] logged in  
SYST  
215 UNIX Type: L8  
Keep alive off...
PWD  
257 "/" is the current directory  
PBSZ 0  
200 PBSZ 0 successful  
PROT P  
200 Protection set to Private  
PASV  
227 Entering Passive Mode (79,99,134,80,137,29).  
LIST  
Connect socket #988 to 79.99.134.80, port 35101...
TLSv1, cipher TLSv1/SSLv3 (DHE-RSA-AES256-SHA) - 256

AndreyZ

Re: Format of server version is invalid

Post by AndreyZ » Fri 19 Oct 2012 13:07

The SFTP protocol is not derived from the FTP protocol, and it is an independent protocol. Therefore, to solve the problem, you should set port for SSH server, not for FTP server.

Post Reply