diff --git a/plugins/hosts/windows/cap/smb.rb b/plugins/hosts/windows/cap/smb.rb index 17fae3d69..639cd2b53 100644 --- a/plugins/hosts/windows/cap/smb.rb +++ b/plugins/hosts/windows/cap/smb.rb @@ -17,6 +17,12 @@ module VagrantPlugins true end + # Required options for mounting a share hosted on Windows + # NOTE: Windows deprecated smb 1.0 so a minimum of 2.0 must be enabled + def self.smb_mount_options(env) + ["vers=2.0"] + end + def self.smb_validate_password(env, machine, username, password) script_path = File.expand_path("../../scripts/check_credentials.ps1", __FILE__) args = [] diff --git a/plugins/hosts/windows/plugin.rb b/plugins/hosts/windows/plugin.rb index ffe1e3a17..78d9239e1 100644 --- a/plugins/hosts/windows/plugin.rb +++ b/plugins/hosts/windows/plugin.rb @@ -46,7 +46,7 @@ module VagrantPlugins Cap::SMB end - host_capability("windows", "smb_cleanup") do + host_capability("windows", "smb_mount_options") do require_relative "cap/smb" Cap::SMB end diff --git a/test/unit/plugins/hosts/windows/cap/smb_test.rb b/test/unit/plugins/hosts/windows/cap/smb_test.rb index c904bc205..a1822e643 100644 --- a/test/unit/plugins/hosts/windows/cap/smb_test.rb +++ b/test/unit/plugins/hosts/windows/cap/smb_test.rb @@ -34,6 +34,14 @@ Description : Not Vagrant Owned allow(subject).to receive(:sleep) end + describe ".smb_mount_options" do + it "should provide smb version of at least 2" do + result = subject.smb_mount_options(nil) + ver = result.detect{|i| i.start_with?("vers") }.to_s.split("=", 2).last.to_s.to_i + expect(ver).to be >= 2 + end + end + describe ".smb_installed" do context "when powershell version is greater than 2" do it "is valid installation" do