[pve-devel] applied: [PATCH manager] fix #1539: add missing shellquote for proxied commands of pvesh

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Oct 31 09:02:58 CET 2017


applied to master & stable-4

On Fri, Oct 27, 2017 at 02:13:48PM +0200, Dominik Csapak wrote:
> if we do not do this, passing arguments with spaces
> (e.g., pvesh set YYY --param "one word")
> leads to ssh calls like this:
> ssh REMOTE pvesh set YYY --param one word
> 
> which cannot be parsed correctly
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  bin/pvesh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/bin/pvesh b/bin/pvesh
> index 936a849b..36ce7636 100755
> --- a/bin/pvesh
> +++ b/bin/pvesh
> @@ -10,6 +10,7 @@ use File::Basename;
>  use Getopt::Long;
>  use HTTP::Status qw(:constants :is status_message);
>  use Text::ParseWords;
> +use String::ShellQuote;
>  use PVE::JSONSchema;
>  use PVE::SafeSyslog;
>  use PVE::Cluster;
> @@ -257,8 +258,9 @@ sub check_proxyto {
>  sub proxy_handler {
>      my ($node, $remip, $dir, $cmd, $args) = @_;
>  
> +    my $cmdargs = [String::ShellQuote::shell_quote(@$args)];
>      my $remcmd = ['ssh', '-o', 'BatchMode=yes', "root\@$remip", 
> -	       'pvesh', '--noproxy', $cmd, $dir, @$args];
> +	       'pvesh', '--noproxy', $cmd, $dir, @$cmdargs];
>  
>      system(@$remcmd) == 0 || die "proxy handler failed\n";
>  }
> -- 
> 2.11.0




More information about the pve-devel mailing list