Problem with SFTP

We have encountered again problems with SFTP:
When I try to connect to a server, the ftp library crashes at "If objFTP.Connect = sfFTPLib.enumError.ftpErrorSuccess Then"

You can try it with your VB6 sample project and following server:

objFTP.Host = "ftpd.ils-consult.fr"
objFTP.Port = 22
objFTP.Username = "smartftp"
objFTP.Password = "smartftp"
objFTP.LogFile = "c:\sftp.log"

I really need some help, because at the moment it's not possible to use SFTP with SmartFTP-Library.

Regards,
Markus

I will take a look at it. In the meanwhile try to set the objFTP.UseMessageLoop property to true

Regards,
Mat

No change if I set objFTP.UseMessageLoop property to true ...

Are the VBScript examples (Scripts\Simple.wsf) working for you?

No. Almost the same error msg except it's WScript.exe instead of VB6.exe

Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\WINDOWS\System32\WScript.exe

This application has requestet the Runtime to terminate it in an unusual way. Please contact the application's support team for more information

What operating system are you using?

Can you to reproduce the problem on a fresh installation of Windows?

Regards,
Mat

Windows XP Professional SP3.

I have tried it with a new XP installation, same error with the script examples.

I couldn't not find any errors with the script nor the ftp library. They both work as expected. Do you have the latest version of the FTP Library: https://www.smartftp.com/ftplib
Did you register the sfFTPLib.dll (regsvr32.exe sfFTPLib.dll)?

Regards,
Mat

Yes, I have!

[20090402 07:22:39] SmartFTP FTP Library v1.5.17.28
[20090402 07:22:39] Resolving host name "ftpd.ils-consult.fr"
[20090402 07:22:39] Connecting to 92.103.148.120 Port: 22
[20090402 07:22:39] SSH-2.0-OpenSSH_4.7
[20090402 07:22:39] Starting SSH session. Remote Id: "SSH-2.0-OpenSSH_4.7"
[20090402 07:22:39] SSH protocol version reply. Client Id: "SSH-2.0-SmartFTP"
[20090402 07:22:41] Computing session key.
[20090402 07:22:41] Key Exchange Algorithm: diffie-hellman-group-exchange-sha256
[20090402 07:22:41] Key exchange completed.
[20090402 07:22:41] Host Key Algorithm: ssh-rsa
[20090402 07:22:41] Client to Server Encryption: aes128-ctr
[20090402 07:22:41] Server to Client Encryption: aes128-ctr
[20090402 07:22:41] Session MAC: hmac-sha1
[20090402 07:22:41] Client to Server Compression: zlib@openssh.com
[20090402 07:22:41] Server to Client Compression: zlib@openssh.com
[20090402 07:22:41] Authentication request. Method: "none"
[20090402 07:22:41] Server supported authentications: publickey,password,keyboard-interactive
[20090402 07:22:41] Authentication request. Method: "password"
[20090402 07:22:42] User authentication successful.

That's the last message which can be found in the log file.

Did you try the VB6-Sample with the parameters I have posted?

objFTP.Host = "ftpd.ils-consult.fr"
objFTP.Port = 22
objFTP.Username = "smartftp"
objFTP.Password = "smartftp"
objFTP.LogFile = "c:\sftp.log"

I have tried it on different PCs, always the same problem with "If objFTP.Connect = sfFTPLib.enumError.ftpErrorSuccess Then"

The problem doesn't occur if I use a nonexistent username, then I'll get an error ftpErrorConnect = 25L

objFTP.Host = "ftpd.ils-consult.fr"
objFTP.Port = 22
objFTP.Username = "abcdefg"
objFTP.Password = "......."
objFTP.LogFile = "c:\sftp.log"

Regards,
Markus

I have installed the latest SmartFTP-Client on 5 PCs and it's impossible to connect to ftpd.ils-consult.fr!
Always error message and crash.

I have uploaded some crash dumps, maybe they can help:
Dumps

Ah the problems is only with thsi particular server. Can you provide a test account on the server?

Did you also try it with the WScript example? Does it crash exactly at the same point?

Regards,
Mat

It seems that this only happens with that server.

This is already a test account:
objFTP.Host = "ftpd.ils-consult.fr"
objFTP.Port = 22
objFTP.Username = "smartftp"
objFTP.Password = "smartftp"

Or you can try this one:
objFTP.Host = "ftpd.ils-consult.fr"
objFTP.Port = 22
objFTP.Username = "ep_ssh"
objFTP.Password = "ep1424-Sh-+"

Regards,
Markus

I was able to reproduce it. Thank you. Working on a fix now.

Hello ..

I noticed that I'm not able to connect to the server with other clients (FileZilla) either. They do not crash as SmartFTP does but they seem to have the same error. The server is sending a wrong packet.

Regards,
Mat

Please run a test with the user "ep_ssh".
With this one it's possible to connect with FileZilla.

objFTP.Host = "ftpd.ils-consult.fr"
objFTP.Port = 22
objFTP.Username = "ep_ssh"
objFTP.Password = "ep1424-Sh-+"

Regards,
Markus

I was debugging the problem and it's caused by the delayed compression algorithm zlib@openssh.com that is being used. From my perspective it looks like that the server does not handle it correctly. It always sends the following 3 bytes back for our channel open request: 0x78 0x9c 0x92.
When the zlib@openssh.com compression algorithm is disabled everything works as expected. FileZilla, WinSCP and many other clients do not implement the zlib@openssh.com compression algorithm. That is the reason you don't see any problems with these clients.
I do not believe the zlib@openssh.com implementation broken with OpenSSH version (4.7) is broken per se. But for a final conclusion further investigations needs to be done.

To workaround your problem disable the delayed compression algorithm:
Dim arCompressions(1)
arCompressions(0) = ftpSSHCompressionzlib
arCompressions(1) = ftpSSHCompressionNone
obj.Compressions = arCompressions

Regards,
Mat

It's impossible to set the property "Compressions" with VB6.

Dim arCompressions(1)
arCompressions(0) = ftpSSHCompressionzlib
arCompressions(1) = ftpSSHCompressionNone
obj.Compressions = arCompressions

I always get an error with obj.Compressions = arCompressions:
"Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic"

Regards,
Markus

VB6 does not support SAFEARRAY(VARIANT). So I have changed it now to VARIANT* which can contain a SAFEARRAY(VARIANT) or SAFEARRAY(LONG). This should work with VB6.
Please try it with the latest version from here: https://www.smartftp.com/ftplib/download

Regards,
Mat

Yes. Now I'm able to set the property "Compressions".
And it's possible to connect to that FTP server.

Thanks a lot!

BR
Markus