guests/linux: SMB mounts with symbol passwords work [GH-3202]

This commit is contained in:
Mitchell Hashimoto 2014-04-09 10:46:56 -07:00
parent a6725710d3
commit b20ff91784
2 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,7 @@ BUG FIXES:
public/private networks. [GH-3207]
- guests/linux: If SMB folder mounting fails, the password will no
longer be shown in plaintext in the output. [GH-3203]
- guests/linux: SMB mount works with passwords with symbols. [GH-3202]
- providers/hyperv: Check for PowerShell features. [GH-3398]
- synced\_folders/smb: Only set the chmod properly by default on Windows
if it isn't already set. [GH-3394]

View File

@ -1,3 +1,5 @@
require "shellwords"
module VagrantPlugins
module GuestLinux
module Cap
@ -23,10 +25,12 @@ module VagrantPlugins
mount_gid_old = "`id -g #{options[:group]}`"
end
smb_password = Shellwords.shellescape(options[:smb_password])
options[:mount_options] ||= []
options[:mount_options] << "sec=ntlm"
options[:mount_options] << "username=#{options[:smb_username]}"
options[:mount_options] << "pass='#{options[:smb_password]}'"
options[:mount_options] << "pass='#{smb_password}'"
# First mount command uses getent to get the group
mount_options = "-o uid=#{mount_uid},gid=#{mount_gid}"
@ -62,7 +66,7 @@ module VagrantPlugins
attempts += 1
if attempts > 10
command = mount_commands.join("\n")
command.gsub!(options[:smb_password], "PASSWORDHIDDEN")
command.gsub!(smb_password, "PASSWORDHIDDEN")
raise Vagrant::Errors::LinuxMountFailed,
command: command