[ 
https://issues.apache.org/jira/browse/SSHD-953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16962241#comment-16962241
 ] 

Lyor Goldstein commented on SSHD-953:
-------------------------------------

I disagree - why should the command parser strip quotes ? After all they +mean+ 
something and are not there just as syntactic sugar - i.e., the shell 
interpreter handles them in a special manner. Please note that as a  quick 
workaround you can write +your own+ command factory that creates a 
{{ShellFactory}} instance from an +array+ of strings that is the result of 
parsing it your way...

Specifically for SCP why not use the [MINA SSHD SCP 
client|https://github.com/apache/mina-sshd/blob/master/docs/scp.md] instead of 
a command and avoid these issues?

> ProcessShellCommandFactory does not parse quoted arguments correctly
> --------------------------------------------------------------------
>
>                 Key: SSHD-953
>                 URL: https://issues.apache.org/jira/browse/SSHD-953
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 2.3.0
>            Reporter: Niklas Rosenstein
>            Priority: Minor
>
> {code:java}
> sshServer.setCommandFactory(new ProcessShellCommandFactory();
> {code}
> This command factory does not parse quoted arguments correctly. Example:
> {code}
> "scp -t -r -p '/Volumes/data/input.csv'"
> {code}
> The last argument is parsed as
> {code}
> "'/Volumes/git/data/input.csv'"
> {code}
> when it should be parsed as
> {code}
> "/Volumes/git/data/input.csv"
> {code}
> (note the missing single quotes)
> The implementation of the parsing uses {{GenericUtils.split()}} rather than a 
> function that handles quotes correctly.
> {code}
>         ShellFactory factory = new 
> ProcessShellFactory(GenericUtils.split(command, ' '));
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to