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
myfreexp
Junior Member
Junior Member
Posts: 16
Joined: 2009-08-18, 18:46 UTC
Location: Düsseldorf, Germany

Post by *myfreexp »

myfreexp wrote:As I said in my initial bug post, there are clearly defined rules what is a valid UTF-8 byte sequence and what not. Based on these rules, I once wrote such a function myself years ago, and I'm happy to contribute it - please advise. You would just need to translate it from Turbo Pascal to Delphi.
Just found the code in my sources:

Code: Select all

  { my: Prüfung auf gültiges UTF-8 gemäß "The Unicode Standard, Version 4.0" }
  {     (siehe <http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf>, 3.9) }
  {     und RFC3629 (November 2003, supersedes RFC2279)                      }

  function valid_UTF8(const cvt:string):boolean;
  var ok : boolean;
      sp : byte;
  begin
    ok:=byte(cvt[1]) in [$c2..$f4];
    sp:=1;
    while ok and (sp<length(cvt)) do
    begin
      inc(sp);
      if sp=2 then                               { 2. Octet prüfen!         }
      begin
        case byte(cvt[1]) of
          $e0 : ok:=byte(cvt[sp]) in [$a0..$bf]; { 3-Octet-Sequenzen mit E0 }
          $ed : ok:=byte(cvt[sp]) in [$80..$9f]; { 3-Octet-Sequenzen mit ED }
          $f0 : ok:=byte(cvt[sp]) in [$90..$bf]; { 4-Octet-Sequenzen mit F0 }
          $f4 : ok:=byte(cvt[sp]) in [$80..$8f]; { 4-Octet-Sequenzen mit F4 }
        else
          ok:=byte(cvt[sp]) in [$80..$bf];       { alle übrigen Sequenzen   }
        end;
      end
      else ok:=byte(cvt[sp]) in [$80..$bf];      { 3.-4. Octet prüfen       }
    end;
    valid_UTF8:=ok;
  end;
Please feel free to use/translate it.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Christian,

Any word on the SCP mode fix yet?
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50839
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately I cannot find any problem with SCP. Can you explain what problem you have? I tested with SFTP 0.94 and these latest dlls:
Win32 2000/XP 7.19.6 libcurl SSL enabled Günter Knauf 2.77 MB

I could successfully upload a file with spaces in the name to a directory with spaces in the name, both in Ansi and UTF-8 mode with SCP enabled.
Author of Total Commander
https://www.ghisler.com
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

2ghisler(Author),

Try downloading/viewing a file in Lister or an editor (F4). I also couldn't copy a file to the other panel.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
myfreexp
Junior Member
Junior Member
Posts: 16
Joined: 2009-08-18, 18:46 UTC
Location: Düsseldorf, Germany

Post by *myfreexp »

And any word with regards to check for valid UTF-8 byte sequences (rather then decoding "blind")? See code above and my two previous posts...
zygzak
Junior Member
Junior Member
Posts: 4
Joined: 2008-03-30, 21:27 UTC

Post by *zygzak »

In scp mode i have problem with file "() .txt" (brackets, space, dot, extension.)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50839
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Try downloading/viewing a file in Lister or an editor (F4). I also couldn't copy a file to the other panel.
Works fine here! Can you give me a sample file name which works in SFTP transfer mode, but not SCP?
In scp mode i have problem with file "() .txt" (brackets, space, dot, extension.)
These probably need some kind of escaping(?). Strangley spaces make no problems with our server, so it may be server-related.
And any word with regards to check for valid UTF-8 byte sequences (rather then decoding "blind")? See code above and my two previous posts...
I'm considering it for downloads. But it would
1. give the user false security that the names are correct, and
2. cause troubles when a user edits and then re-uploads a file. Then he will have two files with same name, one with UTF-8 encoding, and one with Ansi.
Therefore I think that it's better to not support such a name mixup...
Author of Total Commander
https://www.ghisler.com
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

2ghisler(Author),

SCP mode seems to be working fine now with downloads and copying. It seems my server didn't have SSH mode enabled for my account. They just enabled it and now I can use SCP mode. The plugin allowed me to login before without SSH being enabled. Was it supposed to?
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
myfreexp
Junior Member
Junior Member
Posts: 16
Joined: 2009-08-18, 18:46 UTC
Location: Düsseldorf, Germany

Post by *myfreexp »

ghisler(Author) wrote:
myfreexp wrote:And any word with regards to check for valid UTF-8 byte sequences (rather then decoding "blind")? See code above and my two previous posts...
I'm considering it for downloads. But it would
1. give the user false security that the names are correct, [...]
Hmm. Do you really think that someone could believe that a file displayed as "sch?ler.txt" has a "correct" name...? I would bet anything that users playing with tools such as TC, PuTTY and the SFTP plugin for TC would think "What the heck is going wrong here?!".

In fact, "?" is a valid file name character on a Linux server (AFAIK), but even that would not lead to the wrong impression that "sch?ler.txt" might be the correct file name.
ghisler(Author) wrote: 2. cause troubles when a user edits and then re-uploads a file. Then he will have two files with same name, one with UTF-8 encoding, and one with Ansi.
Let's go through this in detail:

First of all, it would cause much less trouble, as wrong encoded files and directories would still be accessible (currently they are not with the SFTP plugin, but they are with PuTTY).

Ok, now we edit the ANSI encoded file. To do this, it must be temporarily stored on the local (Windows) machine, but it can't be stored there with the wildcard character "?". I would suggest that we store it with the 8bit-character "as is", which would lead to a file "schüler.txt" in the temp directory of the local machine. Right?

If so, it would get uploaded with this name and saved on the server with a correct UTF-8 encoding and read there as "schüler.txt". Well, great! Now you just need to delete the wrong encoded file (which is currently not even possible at all).

But in this scenario they won't have the "same name", as you say. And in another scenario:

Even if you would want to make sure that the edited file gets the same wrong encoding again, then simply set a flag 'invalid_UTF8' upon downloading, and upon uploading save it "as is" with all its original 8bit chars on the server again (if the flag is set). Then the file simply gets overwritten on the server - again no mixup.

Or am I thinking too simple?
ghisler(Author) wrote: Therefore I think that it's better to not support such a name mixup...
I don't see a "mixup". Either the file name is correct afterwards, or it is still the same wrong file name.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Can someone please tell me how I make the public and private keys for OpenSSH 5.2 on my FTP server? The host isn't being very helpful on this.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
Mikefield
Power Member
Power Member
Posts: 628
Joined: 2006-02-26, 19:13 UTC
Location: Oberursel, Germany HE

Post by *Mikefield »

[off topic]
What do you use as FTP Server?
Which key files are supported from your FTP Server (key, pem, p12)?
Did you just asked google "your FTP Server SSH key" or your FTP Server Forum ?
[/off topic]

mf
Bankster - Word of the Year 2009
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

2Mikefield

I googled what little I know so far. I'm totally new at this.

I just got this back from support:
You need to connect to the server using an ssh client such as putty then generate the SSH keys and then you should be able to use them.
I did the keys in putty but they didn't seem to work.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
Mikefield
Power Member
Power Member
Posts: 628
Joined: 2006-02-26, 19:13 UTC
Location: Oberursel, Germany HE

Post by *Mikefield »

Which FTP Server?
I use zFTPServer and it's working with pem key's. But it has nothing to do with SFTP!

mf
Bankster - Word of the Year 2009
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Well, I get as far as the "Authentication by client certificate failed". So either I'm close or way off. And by the sound of you (with the !), I am wayyy off.

The keys I'm talking about are for this plugin. The host turned on OpenSSH for my account. I followed the putty example on setting the keys up and then the readme for this plugin to set that up.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7010
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

Boofo wrote:Well, I get as far as the "Authentication by client certificate failed". So either I'm close or way off. And by the sound of you (with the !), I am wayyy off.

The keys I'm talking about are for this plugin. The host turned on OpenSSH for my account. I followed the putty example on setting the keys up and then the readme for this plugin to set that up.
Do you have added the file authorized_keys into the .ssh subdir of your host account. In this authorized keys you add the string which is show from Puttygen.
Post Reply