New SFTP plugin available now

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

Moderators: Hacker, petermad, Stefan2, white

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

Post by *ghisler(Author) »

2JOUBE
Is it possible, to disable generaly this horrible feature?
I don't really see your problem. If you transfer files in "Binary" mode with TC, which btw. is the default, then nothing will be changed. A conversion will occur only when you choose "Text" or "Automatic" mode from the ftp toolbar, so it's completely optional. In addition to that, you can set the host type to "Windows" in the connection settings, and no conversion will be made either.

2Sob
You are right, this is not correct. I had to change it to '4' because myrecv() now waits until it has the requested number of bytes, because in non-blocking mode I was sometimes getting just 2 bytes. I can't set it to '5' because in case of a proxy error reply, there would be just 4 bytes. Therefore I will change it to 4, 1, and then the rest. Unfortunately I cannot test it here because all my tested proxies return IP addresses. Do you have a proxy which returns a host name?
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Another mistake, I forgot about possible error, 4+1 is correct then. :)
I tried Socks Puppet, 3proxy and socks5d.pl and they all return IP addresses too. At least v6 can be tested with the last one.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK, what do you think about this fix?

Code: Select all

			nrbytes=myrecv(ConnectSettings->sock,buf,4,0,progressbuf,20,&loop,&lasttime);
			if(nrbytes!=4 || buf[0]!=5 || buf[1]!=0) {
				// Error-handling, unchanged
			}
			int needread=0;
			switch(buf[3]) {
			case 1: needread=6; break;           // IPv4+port
			case 3:
				nrbytes=myrecv(ConnectSettings->sock,buf,1,0,progressbuf,20,&loop,&lasttime);
				if (nrbytes==1)
					needread=buf[4]+2;
				break;    // Domain Name+port
			case 4: needread=18; break;          // IPv6+port
			}
			nrbytes=myrecv(ConnectSettings->sock,buf,needread,0,progressbuf,20,&loop,&lasttime);
I think that buf[4]+2 is correct, it would be the length of the string plus two bytes for the port...
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Almost perfect, except I'd say: needread=buf[0]+2;
nadoo
New Member
New Member
Posts: 1
Joined: 2006-11-01, 06:07 UTC

Post by *nadoo »

It's a great plugin! Thanks.
JOUBE
Power Member
Power Member
Posts: 1664
Joined: 2004-07-08, 08:58 UTC

Post by *JOUBE »

ghisler(Author) wrote:If you transfer files in "Binary" mode with TC, which btw. is the default, then nothing will be changed. A conversion will occur only when you choose "Text" or "Automatic" mode from the ftp toolbar, so it's completely optional.
How does this work? Is there an interaction between the FTP settings within the Tc and the settings for this plugin? Do you read within the Plugin the TC-FTP Settings? Where I can find the documentation of this?
nadoo wrote:It's a great plugin! Thanks.
Of course, it is.

JOUBE
User avatar
Mikefield
Power Member
Power Member
Posts: 628
Joined: 2006-02-26, 19:13 UTC
Location: Oberursel, Germany HE

Post by *Mikefield »

No, it's in the connection properties of the Server (Alt-Enter). On the right side from the SCP radio button
is a new field named "System:" There you can choose Automatic, Windows (CR/LF) or Unix (LF).
If you compare sftpplug091beta with sftpplug092beta then you will see it. :)

mf
Bankster - Word of the Year 2009
JOUBE
Power Member
Power Member
Posts: 1664
Joined: 2004-07-08, 08:58 UTC

Post by *JOUBE »

2Mikefield Do you answering to my post?
Mikefield wrote:... it's in the connection properties of the Server (Alt-Enter). On the right side from the SCP radio button
is a new field named "System:" There you can choose Automatic, Windows (CR/LF) or Unix (LF).
This is not a new info. Same info ghisler(autor) wrote here:
ghisler(autor) wrote:In addition to that, you can set the host type to "Windows" in the connection settings, and no conversion will be made either.
But what is with this?
ghisler(autor) wrote:if you transfer files in "Binary" mode with TC, which btw. is the default, then nothing will be changed. A conversion will occur only when you choose "Text" or "Automatic" mode from the ftp toolbar, so it's completely optional.
... especially with this: "... Binary" mode with TC ..." and "... when you choose "Text" or "Automatic" mode from the ftp toolbar ... "
Mikefield wrote:No,...
Don't talk back to ghisler(autor) ;-)

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

Post by *ghisler(Author) »

How does this work? Is there an interaction between the FTP settings within the Tc and the settings for this plugin? Do you read within the Plugin the TC-FTP Settings? Where I can find the documentation of this?
The information is sent to plugins via the FsExecuteFile command. The verb is "mode". TC sends "mode I" for binary, "mode A" for text and "mode X*.txt *.whatever" for text mode.
Author of Total Commander
https://www.ghisler.com
User avatar
ado
Senior Member
Senior Member
Posts: 445
Joined: 2003-02-18, 13:22 UTC
Location: Slovakia, Pezinok

Post by *ado »

Christian,
back in Sept 6 I asked you if you can implement "ls -al" if "stat" command is not available. I know - you responded that it would offer only limited functionality. But still - better that nothing I'd say. Are you considering to implement this or you just dropped it completely?
I just 2-3 days ago downloaded 0.92 and that SCP rocks - good job.

thank you

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

Post by *ghisler(Author) »

It's on my wish list, but unfortunately I don't currently have the time. You can try to send the command via the command line (Ctrl+Enter for the file name).
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

I have code that works with output of ls command on my older Slackware Linux. But I found out that field widths seem to be different than those from ado's ls:

Code: Select all

ado's:
-rwxr--r--   1 rwuser   rwgroup     1000 Sep 24  2007 setupEnv.ksh 
mine:
-rw-r--r--    1 root     root           71 Jan  1  2007 test
So what is the correct way to parse ls output?
Maybe to take it as fields (containing no space) separated by one or more spaces, with exception of sixth field (date) which has always 12 characters?

Edit: here it is:

http://web.hisoftware.cz/sob/download/sftpplug_src092beta-ls_stat.patch
CoolWater
Power Member
Power Member
Posts: 744
Joined: 2003-03-27, 16:33 UTC

Post by *CoolWater »

You should also check for strstr(reply2, "stat: ") != NULL, otherwise, if a filename with "not found" in it could lead to wrong result. And, sometimes, the date field only contains a time, at least on debian.
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

In fact, it needs something even better. What if user creates file "stat: not found"? :) Colon character is no problem for Unix filesystem..

And how exactly does the line with time-only date field look like?

Edit: instead of "not found", return value can be checked. My bash@linux return 127 when command is not found, but is it the same everywhere? For example aso's ksh@solaris? I've never seen such thing. :)
ThiefMaster
Junior Member
Junior Member
Posts: 79
Joined: 2003-10-27, 16:49 UTC
Contact:

Post by *ThiefMaster »

Please add support for putty .ppk files. Shouldn't be too hard to extract private/public key from them..
Post Reply