plugins/synced_folders/rsync/helper.rb in vagrant-unbundled-1.8.4.2 vs plugins/synced_folders/rsync/helper.rb in vagrant-unbundled-1.8.5.1

- old
+ new

@@ -1,5 +1,7 @@ +require "shellwords" + require "vagrant/util/platform" require "vagrant/util/subprocess" module VagrantPlugins module SyncedFolderRSync @@ -41,10 +43,13 @@ # if the guest has a guest path scrubber capability, use it if machine.guest.capability?(:rsync_scrub_guestpath) guestpath = machine.guest.capability(:rsync_scrub_guestpath, opts) end + # Shellescape + guestpath = Shellwords.escape(guestpath) + if Vagrant::Util::Platform.windows? # rsync for Windows expects cygwin style paths, always. hostpath = Vagrant::Util::Platform.cygwin_path(hostpath) end @@ -67,17 +72,19 @@ end # Create the path for the control sockets. We used to do this # in the machine data dir but this can result in paths that are # too long for unix domain sockets. - controlpath = File.join(Dir.tmpdir, "ssh.#{rand(1000)}") + control_options = "" + unless Vagrant::Util::Platform.windows? + controlpath = File.join(Dir.tmpdir, "ssh.#{rand(1000)}") + control_options = "-o ControlMaster=auto -o ControlPath=#{controlpath} -o ControlPersist=10m " + end rsh = [ "ssh -p #{ssh_info[:port]} " + proxy_command + - "-o ControlMaster=auto " + - "-o ControlPath=#{controlpath} " + - "-o ControlPersist=10m " + + control_options + "-o StrictHostKeyChecking=no " + "-o IdentitiesOnly=true " + "-o UserKnownHostsFile=/dev/null", ssh_info[:private_key_path].map { |p| "-i '#{p}'" }, ].flatten.join(" ")