You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Mime Util (JIRA)" <ji...@apache.org> on 2015/01/08 17:16:34 UTC

[jira] [Updated] (SSHD-402) Strange behaviour when overwriting files using SCP (ScpCommandFactory)

     [ https://issues.apache.org/jira/browse/SSHD-402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mime Util updated SSHD-402:
---------------------------
    Description: 
I set up a sshd-server als follows:

{code:Java}
this.sshd = SshServer.setUpDefaultServer();
this.sshd.setPort(2023);
this.sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("keys"));

List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
userAuthFactories.add(new UserAuthNone.Factory());
this.sshd.setUserAuthFactories(userAuthFactories);

this.sshd.setCommandFactory(new ScpCommandFactory());

List<NamedFactory<Command>> namedFactoryList = new ArrayList<NamedFactory<Command>>();
namedFactoryList.add(new SftpSubsystem.Factory());
this.sshd.setSubsystemFactories(namedFactoryList);
{/code}

After starting the server, I uploasd a file (scp -P 2023 filename.txt localhost:) containing:

{quote}
1234567890

{/quote}

Afterwards I remove "234567890" from the local file an upload it again. Instead of containing on "1\n" the file contains:

{quote}
1

4567890

{/quote}

It seems that "23" is replaced by two spaces, and the rest of the original (on the server) remains in the file and is not overwritten.

  was:
I set up a sshd-server als follows:

{code:java}
this.sshd = SshServer.setUpDefaultServer();
this.sshd.setPort(2023);
this.sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("keys"));

List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
userAuthFactories.add(new UserAuthNone.Factory());
this.sshd.setUserAuthFactories(userAuthFactories);

this.sshd.setCommandFactory(new ScpCommandFactory());

List<NamedFactory<Command>> namedFactoryList = new ArrayList<NamedFactory<Command>>();
namedFactoryList.add(new SftpSubsystem.Factory());
this.sshd.setSubsystemFactories(namedFactoryList);
{/code}

After starting the server, I uploasd a file (scp -P 2023 filename.txt localhost:) containing:

{quote}
1234567890

{/quote}

Afterwards I remove "234567890" from the local file an upload it again. Instead of containing on "1\n" the file contains:

{quote}
1

4567890

{/quote}

It seems that "23" is replaced by two spaces, and the rest of the original (on the server) remains in the file and is not overwritten.


> Strange behaviour when overwriting files using SCP (ScpCommandFactory)
> ----------------------------------------------------------------------
>
>                 Key: SSHD-402
>                 URL: https://issues.apache.org/jira/browse/SSHD-402
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 0.13.0
>         Environment: Ubuntu 14.10
> OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu1)
> OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
>            Reporter: Mime Util
>            Priority: Critical
>              Labels: security
>
> I set up a sshd-server als follows:
> {code:Java}
> this.sshd = SshServer.setUpDefaultServer();
> this.sshd.setPort(2023);
> this.sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("keys"));
> List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
> userAuthFactories.add(new UserAuthNone.Factory());
> this.sshd.setUserAuthFactories(userAuthFactories);
> this.sshd.setCommandFactory(new ScpCommandFactory());
> List<NamedFactory<Command>> namedFactoryList = new ArrayList<NamedFactory<Command>>();
> namedFactoryList.add(new SftpSubsystem.Factory());
> this.sshd.setSubsystemFactories(namedFactoryList);
> {/code}
> After starting the server, I uploasd a file (scp -P 2023 filename.txt localhost:) containing:
> {quote}
> 1234567890
> {/quote}
> Afterwards I remove "234567890" from the local file an upload it again. Instead of containing on "1\n" the file contains:
> {quote}
> 1
> 4567890
> {/quote}
> It seems that "23" is replaced by two spaces, and the rest of the original (on the server) remains in the file and is not overwritten.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)