examples/rename_file.rb in ruby_smb-2.0.2 vs examples/rename_file.rb in ruby_smb-2.0.3

- old
+ new

@@ -7,21 +7,23 @@ # and rename the file short.txt require 'bundler/setup' require 'ruby_smb' -address = ARGV[0] -username = ARGV[1] -password = ARGV[2] -share = ARGV[3] -file = ARGV[4] -new_name = ARGV[5] +address = ARGV[0] +username = ARGV[1] +password = ARGV[2] +share = ARGV[3] +file = ARGV[4] +new_name = ARGV[5] +smb_versions = ARGV[6]&.split(',') || ['1','2','3'] + path = "\\\\#{address}\\#{share}" sock = TCPSocket.new address, 445 dispatcher = RubySMB::Dispatcher::Socket.new(sock) -client = RubySMB::Client.new(dispatcher, smb1: true, smb2: true, username: username, password: password) +client = RubySMB::Client.new(dispatcher, smb1: smb_versions.include?('1'), smb2: smb_versions.include?('2'), smb3: smb_versions.include?('3'), username: username, password: password) protocol = client.negotiate status = client.authenticate puts "#{protocol} : #{status}"