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: 48232
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It would be so helpful if it was possible to define per connection proxy settings.
Indeed this isn't currently supported, sorry.
SFTP Error
Error: Could not initialize SFTP session!
Unable to request SFTP subsystem
This means that the plugin managed to connect to the server via SSH protocol, but the server refused to open the SFTP channel. Sorry, I don't know why the server would refuse it. WinSCP uses a different protocol (pure SSH for the file lists, and SCP for the data transfers).
Author of Total Commander
https://www.ghisler.com
User avatar
Nigurrath
Senior Member
Senior Member
Posts: 225
Joined: 2003-02-05, 12:41 UTC

Post by *Nigurrath »

humm
this is strange also because I tell to winSCP to use SCP only. anyway is there some trick/special setting I could try?

Moreover if ssh is used for the file list shouldn't I get at least the file list from TC?

the other sftp plugin hanging around could track this problem?
always latest 32b TC on a WIN10 64b
larry99
Junior Member
Junior Member
Posts: 44
Joined: 2009-01-16, 16:03 UTC
Location: Germany

Post by *larry99 »

ghisler(Author) wrote:
It would be so helpful if it was possible to define per connection proxy settings.
Indeed this isn't currently supported, sorry.
Ah, well, I know, but will it be supported in the (near) future?
Or else are there any instructions how to compile a patched version?
larry99
Junior Member
Junior Member
Posts: 44
Joined: 2009-01-16, 16:03 UTC
Location: Germany

Post by *larry99 »

Nigurrath wrote:humm
this is strange also because I tell to winSCP to use SCP only. anyway is there some trick/special setting I could try?

Moreover if ssh is used for the file list shouldn't I get at least the file list from TC?

the other sftp plugin hanging around could track this problem?
I can only guess but this can happen if/when the sftp binary is not found on the server. In /etc/ssh/sshd_config (or a similar location) there should be a setting for the sftp subsystem with the full path to the binary. Is the path correct and does the binary the setting points to have the right permissions (executable)?

scp is a totally different beast and I think the TC plugin, though you can set it to use scp, does not work if only scp is available.
I tried it once to connect to a very simple ssh server on my Android smartphone that had no sftp support, only scp. I could connect with WinSCP but not with the TC plugin, even after I checked the "use scp" check box.
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Nigurrath wrote:this is strange also because I tell to winSCP to use SCP only
SCP only knows how to transfer files. It doesn't support directory listing. For command-line client used with known file names it's enough. But not for GUI client, it has to get the file info by some other means.
Moreover if ssh is used for the file list shouldn't I get at least the file list from TC?
No, this plugin uses SFTP for listing. For servers without SFTP support, it would have to execute regular ls command over SSH connection and parse its output and currently it doesn't do that. While possible to do, this output is not exactly meant to be easily parsed by machine and to get precise info from it (date and time for example). Original FTP suffered from the same problem for long years.
larry99
Junior Member
Junior Member
Posts: 44
Joined: 2009-01-16, 16:03 UTC
Location: Germany

Post by *larry99 »

larry99 wrote:
ghisler(Author) wrote:
It would be so helpful if it was possible to define per connection proxy settings.
Indeed this isn't currently supported, sorry.
Ah, well, I know, but will it be supported in the (near) future?
Or else are there any instructions how to compile a patched version?
Ok, a patched version compiled with a few warnings but seems to work as expected. The only change I made was to read and write the INI entries for the proxy settings to the connection paragraphs, not to/from the [proxy] paragraph.

I did not find any license information in the source package (only the copyright notice with "all rights reserved") so I can not offer to make this available unless the author (Mr. Ghisler) gives the permission -- or better still -- he releases an official version with these changes ;-)
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

It's not as simple as this. There are two very distinct use cases for proxy:

1) Moving between different networks and each of them forces user to use different proxy server. In this case one proxy settings for all connections is the right answer. Per connection proxy is simply wrong, because it would mean to change settings for every single connection one by one.

2) Connecting to specific servers through different proxies. E.g. paranoid customer's server is only accessible from IP address of your company's office, but you need to access it from home. So you connect using VPN to office and use the proxy server there. But of course, you don't want connections to other servers to be affected by this.

You can't say that 1) or 2) is right and the other one is wrong. Both make sense to different people.

The proper "fits all" solution would be to have separate settings for default proxy (to cover first case). And then every connection would allow to choose between no proxy / default proxy / custom proxy (second case).

Or just something like built-in FTP has, any number of proxy definitions and possibility to assign one to any connection.
larry99
Junior Member
Junior Member
Posts: 44
Joined: 2009-01-16, 16:03 UTC
Location: Germany

Post by *larry99 »

It wasn't my intention to declare some universal truth, just what I need for my work.

But still, I think if you need a proxy at all, you will almost always need at least two different settings: local connections without a proxy and connections with the proxy. I think it is a reasonable guess that most people who have the need to find their way through firewalls have at least one or the other local machine as well. And then the current behaviour of the official version is just nerve killing because according to Murphy's law the proxy settings are always so that they don't work with the connection you are going to establish.

For me it is even worse because I have local machines and others at two different sites with distinct gateways and corresponding proxies. In such a scenario my patched version is really a tremendous improvement.


By the way, did anyone manage to build the plugin with the Express Edition of Visual Studio 2005? As I said before, I could build it with VC6 but because I got a few warnings and the file size was bigger than the original I also tried it with the far more modern VS2005 (with the Platform SDK installed as well) but got even more warnings and a few errors.
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

And similarly it wasn't my intention to accuse you of anything. :) It was just sort of friendly warning. Imagine some unfortunate user who has hundereds of connections defined on his notebook and is moving between two networks twice a day and in each network he's required to use different proxy server. When your change gets accepted, he will demand your head. Just kidding of course. ;)

Newer VC versions are a little picky. I've been meaning to post a patch for some time, but never got to it. Try this: http://web.hisoftware.cz/sob/download/sftpplug_src100-vcfix.patch
larry99
Junior Member
Junior Member
Posts: 44
Joined: 2009-01-16, 16:03 UTC
Location: Germany

Post by *larry99 »

Sob wrote:And similarly it wasn't my intention to accuse you of anything. :) It was just sort of friendly warning. Imagine some unfortunate user who has hundereds of connections defined on his notebook and is moving between two networks twice a day and in each network he's required to use different proxy server. When your change gets accepted, he will demand your head. Just kidding of course. ;)
I got your point but I think this is far easier to solve with two putty entries for the two networks. Both open a socks 5 proxy to e.g. localhost:7777 but in location one it points to IP one and in location two it points to IP two. I do this all the time and it is really easy to setup.
So there are solutions for the scenario "multiple locations, one proxy per location" but with the current version there is no real solution for the "one or multiple locations and multiple proxies per location" scenario.
Sob wrote:Newer VC versions are a little picky. I've been meaning to post a patch for some time, but never got to it. Try this: http://web.hisoftware.cz/sob/download/sftpplug_src100-vcfix.patch
Thanks, but I think the reason it is failing for me is that the free express version doen't have MFC and perhaps other needed components. E.g. it complains about a missing afxres.h
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48232
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Feel free to publish all code changes, I have published all my other plugins under a BSD-type licence. I don't know why I forgot to include it here.

Indeed the best solution would be several named proxy settings like in the internal FTP client.
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 would go full way. Why not use the *same* proxy settings as internal FTP client does?

Plugin would simply read [firewall] section of wcx_ftp.ini, filter out unsupported proxy types (so in this case it would keep only SOCKS4/5 and HTTP CONNECT). Then it would present them to user in combobox. To store per-connection proxy settings, it would save only proxy id (number). And that's all folks! Well, almost, there is of course some room for small tweaks and improvements. But the only real problem, that I can think of so far, is if it's possible for plugin to determine wcx_ftp.ini location (or even name, because it can be changed too).
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

larry99 wrote:Thanks, but I think the reason it is failing for me is that the free express version doen't have MFC and perhaps other needed components. E.g. it complains about a missing afxres.h
I just tested it.

VC++ 2005 Express + Windows 7 SDK + my patch + following code in afxres.h = sftpplug - 0 error(s), 65 warning(s)

Code: Select all

#include <WinNT.h>
#include <WinUser.h>
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
The warnings are only about possibly insecure functions and deprecated names (strcpy vs. strcpy_s, strdup vs. _strdup, etc..).
larry99
Junior Member
Junior Member
Posts: 44
Joined: 2009-01-16, 16:03 UTC
Location: Germany

Post by *larry99 »

Sob wrote: I just tested it.

VC++ 2005 Express + Windows 7 SDK + my patch + following code in afxres.h = sftpplug - 0 error(s), 65 warning(s)

Code: Select all

#include <WinNT.h>
#include <WinUser.h>
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
The warnings are only about possibly insecure functions and deprecated names (strcpy vs. strcpy_s, strdup vs. _strdup, etc..).
Thanks, I have the Server 2003 SDK installed and it compiled with 129 warnings but also no errors, so I think it will be all right.

Even if we are getting a bit off topic here but since it is a quite massive download: is it enough to download the Windows 7 SDK SP1 or do I first need the SDK without SP and then update it with SP1?
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

larry99 wrote:Even if we are getting a bit off topic here but since it is a quite massive download: is it enough to download the Windows 7 SDK SP1 or do I first need the SDK without SP and then update it with SP1?
I'd say that just SP1 is ok. MS doesn't mention any requirement for previous SDK. And installer would surely tell you if it was needed.
If it's only for one machine, I'd use web installer to download only selected components instead of whole iso.
Post Reply