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

[jira] [Resolved] (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 ]

Guillaume Nodet resolved SSHD-402.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 0.14.0
         Assignee: Guillaume Nodet

https://git-wip-us.apache.org/repos/asf?p=mina-sshd.git;a=commitdiff;h=93d3aea6d6c7959ed6c0dd70cc5c4270f6238144

> 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
>            Assignee: Guillaume Nodet
>            Priority: Critical
>              Labels: security
>             Fix For: 0.14.0
>
>
> 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 upload a file (scp -P 2023 filename.txt localhost: ) containing:
> {quote}
> 1234567890
> {quote}
> Hexdump (hexdump -C file.txt) of the file is
> {quote}
> 00000000  31 32 33 34 35 36 37 38  39 30 0a 0a              |1234567890..|
> 0000000c
> {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}
> Hexdump (hexdump -C file.txt) of the file is
> {quote}
> 00000000  31 0a 0a 34 35 36 37 38  39 30 0a 0a              |1..4567890..|
> 0000000c
> {quote}
> It seems that "23" is replaced by two newlines 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)