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 2011/07/01 14:38:30 UTC
[jira] [Resolved] (SSHD-133) E command not handled for single file
upload
[ https://issues.apache.org/jira/browse/SSHD-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved SSHD-133.
----------------------------------
Resolution: Fixed
Fix Version/s: 0.6.0
Assignee: Guillaume Nodet
> E command not handled for single file upload
> --------------------------------------------
>
> Key: SSHD-133
> URL: https://issues.apache.org/jira/browse/SSHD-133
> Project: MINA SSHD
> Issue Type: Bug
> Reporter: Chris Lowe
> Assignee: Guillaume Nodet
> Fix For: 0.6.0
>
>
> Using the Ganymed SSH2 client (build 210 from here http://www.ganymed.ethz.ch/ssh2/) uploading a file to an instance of Mina SSHD causes the following exception:
> java.io.IOException: Expected a C message but got 'E'
> at org.apache.sshd.server.command.ScpCommand.writeFile(ScpCommand.java:299)
> at org.apache.sshd.server.command.ScpCommand.run(ScpCommand.java:174)
> at java.lang.Thread.run(Thread.java:662)
> Further investigation into the issue reveals that the Ganymed client ends the C command sequence with an E command. Looking at the code for ScpCommand run() method I notice the following switch statement:
> switch (c)
> {
> case -1:
> return;
> case 'D':
> isDir = true;
> case 'C':
> case 'E':
> line = ((char) c) + readLine();
> break;
> default:
> //a real ack that has been acted upon already
> continue;
> }
> The E command is part of the fall through for C and D command where the respective handlers for these commands assert that a command is either a C or D. If either of these handlers receive an E then an exception is raised.
> Changing the switch statement to prevent the E from reaching the writeFile or writeDir as follows remedies the issue for me:
> switch (c)
> {
> case -1:
> return;
> case 'D':
> isDir = true;
> case 'C':
> line = ((char) c) + readLine();
> break;
> case 'E':
> readLine(); // consume remainder of line
> return;
> default:
> //a real ack that has been acted upon already
> continue;
> }
> I'm using a version compiled from the current SVN head revision 1132372
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira