New SFTP plugin available now

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2sqa_wizard
Thanks for checking!

2Sob
It's unfortunate that openssh supports it on the client side only. Maybe we should report it as a bug? About your fix: What happens when you connect with my code? Doesn't your code cause a memory leak? Or is the block freed by the openssh dll?
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

It's not bug, just missing feature. RFC 4252 does not require it, it only says server SHOULD support it. What I find strange, is that I can't find any indication anywhere about someone missing it. I don't know, does everyone use only interactive SSH logins, where they can see the prompts?

Your code made TC crash after password change at "LIBSSH2_FREE(session, session->userauth_pswd_newpw)" in libssh2 (version 1.4.3, userauth.c, line 388). Variable userauth_pswd_newpw is second parameter for callback (as &session->userauth_pswd_newpw) and it does not get allocated anywhere, there's only definition "char *userauth_pswd_newpw".
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Actually your code *newpw = (char *)malloc(*newpw_len); allocates a new block of data every time this callback function is called. I guess that the block is freed by LIBSSH2_FREE, but it's not documented anywhere.
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

I meant not allocated anywhere else, that's why libssh2 had hard time freeing it. And what isn't in documentation, it's in the source. :) Although it's not really practical to search for it there.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

There is a new version 1.4.1 of my plugin available now. Download from:
http://www.ghisler.com/plugins.htm

2Sob
I have made the correction you suggested, could you please try it? I had to change it a bit, though, because your suggestion didn't consider the terminating zero:

Code: Select all

		int bufsize=(int)strlen(newpass)+1;
		*newpw=(char*)malloc(bufsize);
		strlcpy(*newpw,newpass,bufsize);
		*newpw_len=bufsize;
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Almost there. It does not crash, password is changed, but immediately after that, login fails. Complete reconnect then works.

This works better:

Code: Select all

*newpw_len=bufsize-1;
--
Edit: And looking at it again, to be technically correct, you also want bufsize-1 for strlcpy(). Not that it really matters here, because newpass is not going to magically grow in length between the lines, but if it did (by miracle :), strlcpy() would again write after allocated memory.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for your correction about newpw_len!
Author of Total Commander
https://www.ghisler.com
denishowe
Junior Member
Junior Member
Posts: 14
Joined: 2003-09-16, 09:54 UTC
Location: London
Contact:

Post by *denishowe »

ghisler(Author) wrote:Please put all the DLLs from the libcurl archive to the TC directory. You probably forgot the zlib1.dll. Newer ssh versions depend on it.
Please could mention zlib where you mention the other two - in the instructions on the plugins page and the missing DLLs error message - that would have saved me a lot of time this morning. :-)
panther7
Junior Member
Junior Member
Posts: 13
Joined: 2010-06-28, 17:24 UTC

Post by *panther7 »

denishowe wrote:Please could mention zlib where you mention the other two - in the instructions on the plugins page and the missing DLLs error message - that would have saved me a lot of time this morning. :-)
Agree!!
zbuzanic
Junior Member
Junior Member
Posts: 10
Joined: 2008-01-25, 08:39 UTC
Contact:

Post by *zbuzanic »

I've discovered I'm unable to transfer big files over this plugin, for example 3GB file fails after few MB's. While with WinSCP it works flawless.
And that's happening recently, i didn't had such problems before. Not sure if problem is in plugin or lib files.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3862
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

Which version of the plugin and curl are you using?

I recently copied a file of 4.5 GB without problems using curl-7.29.0 and sftp-plugin 1.4 ...
#5767 Personal license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2zbuzanic
Try using the option send the files via SCP instead of SFTP. This seems to be both faster and more reliable.
Author of Total Commander
https://www.ghisler.com
etruel
Junior Member
Junior Member
Posts: 4
Joined: 2007-05-09, 14:41 UTC

Post by *etruel »

Hi,
contacting just for tell that when copy a remote file to local dir, the remote file permissions are set to 000. (I think that this is wrong but I'm not sure...)

Recently I test checking "use SCP for data transfer" and works well.

thanks for the plugin. Is very useful-
cheers
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Downloading should not change the remote permissions - at least there is no code in my plugin which would be doing that...
Author of Total Commander
https://www.ghisler.com
ethidium
Junior Member
Junior Member
Posts: 19
Joined: 2007-08-08, 16:39 UTC

Post by *ethidium »

sorry for dumb question... but I can't get rid of error "Please put libssh2.dll and libeay32.dll <...>" - I already tried to put dll files to all of three proposed locations, but the error is still there. Where should I dig?
Thanks in advance!

Windows 7 64-bit, TC v. 8.01 32-bit, cURL library v. 7.30.0.
Post Reply