Merge pull request #10219 from briancain/SMB-PASSWORD-CHARS

Allow special characters in SMB password field
This commit is contained in:
Brian Cain 2018-09-19 09:02:08 -07:00 committed by GitHub
commit 5834b1ca70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -22,7 +22,7 @@ module VagrantPlugins
# Ensure password is scrubbed # Ensure password is scrubbed
Vagrant::Util::CredentialScrubber.sensitive(options[:smb_password]) Vagrant::Util::CredentialScrubber.sensitive(options[:smb_password])
end end
machine.communicate.execute("cmdkey /add:#{options[:smb_host]} /user:#{options[:smb_username]} /pass:#{options[:smb_password]}", {shell: :powershell, elevated: true}) machine.communicate.execute("cmdkey /add:#{options[:smb_host]} /user:#{options[:smb_username]} /pass:\"#{options[:smb_password]}\"", {shell: :powershell, elevated: true})
mount_shared_folder(machine, name, guestpath, "\\\\#{options[:smb_host]}\\") mount_shared_folder(machine, name, guestpath, "\\\\#{options[:smb_host]}\\")
end end

View File

@ -98,6 +98,7 @@ describe "VagrantPlugins::GuestWindows::Cap::MountSharedFolder" do
share_name: "name", share_name: "name",
vm_provider_unc_path: "\\\\host\\name", vm_provider_unc_path: "\\\\host\\name",
}) })
expect(machine.communicate).to receive(:execute).with("cmdkey /add:host /user:user /pass:\"pass\"", {:shell=>:powershell, :elevated=>true})
described_class.mount_smb_shared_folder(machine, 'name', 'guestpath', {:smb_username => "user", :smb_password => "pass", :smb_host => "host"}) described_class.mount_smb_shared_folder(machine, 'name', 'guestpath', {:smb_username => "user", :smb_password => "pass", :smb_host => "host"})
end end
end end