mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklas Rosenstein (Jira)" <j...@apache.org>
Subject [jira] [Commented] (SSHD-953) ProcessShellCommandFactory does not parse quoted arguments correctly
Date Sat, 02 Nov 2019 08:38:00 GMT

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

Niklas Rosenstein commented on SSHD-953:

Hey [~lgoldstein]

{quote}usually quotes are used in case the argument(s) contain spaces, which would cause them
to be split incorrectly...{quote}

Glad you see my point. Sorry if I haven't made it very clear in my description. The quotes
are optional if the argument contains no whitespace. The Java SCP client I am using however
seems to always quote the file argument.

{quote}Specifically for SCP why not use the MINA SSHD SCP client instead of a command and
avoid these issues?{quote}

Our client software already uses {code}https://github.com/hierynomus/sshj{code}. I was trying
to build an integration test with MINA SSHD as a temporary SSH server for the test and came
across this issue. I have worked around it by implementing my own {{ShellFactory}}.

> 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
>            Assignee: Lyor Goldstein
>            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

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

View raw message