filtering on command line strings should be a bit heavier
git-svn-id: file:///home/svn/framework3/trunk@13210 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
8f82a29638
commit
9b72b12050
|
@ -17,8 +17,9 @@ module Drivers
|
|||
attr_accessor :location
|
||||
|
||||
def initialize(vmid,location,platform)
|
||||
@vmid = filter_input(vmid)
|
||||
@location = filter_input(location)
|
||||
|
||||
@vmid = filter_command(vmid)
|
||||
@location = filter_command(location)
|
||||
|
||||
if !File.exist?(location)
|
||||
raise ArgumentError,"Couldn't find: " + location
|
||||
|
@ -26,7 +27,7 @@ module Drivers
|
|||
|
||||
@type = "dynagen"
|
||||
@running = false
|
||||
@platform = filter_input(platform)
|
||||
@platform = filter_command(platform)
|
||||
@credentials = []
|
||||
end
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ class RemoteEsxDriver < VmDriver
|
|||
unless user then raise ArgumentError, "Must provide a username" end
|
||||
unless host then raise ArgumentError, "Must provide a hostname" end
|
||||
|
||||
@vmid = filter_input(vmid)
|
||||
@location = filter_input(location)
|
||||
@user = filter_input(user)
|
||||
@host = filter_input(host)
|
||||
@vmid = filter_command(vmid)
|
||||
@location = filter_command(location)
|
||||
@user = filter_command(user)
|
||||
@host = filter_command(host)
|
||||
@credentials = credentials # individually filtered
|
||||
@tools = tools # not used in command lines, no filter
|
||||
@os = os # not used in command lines, no filter
|
||||
|
|
|
@ -17,10 +17,10 @@ class RemoteWorkstationDriver < VmDriver
|
|||
unless user then raise ArgumentError, "Must provide a username" end
|
||||
unless host then raise ArgumentError, "Must provide a hostname" end
|
||||
|
||||
@vmid = filter_input(vmid)
|
||||
@location = filter_input(location)
|
||||
@user = filter_input(user)
|
||||
@host = filter_input(host)
|
||||
@vmid = filter_command(vmid)
|
||||
@location = filter_command(location)
|
||||
@user = filter_command(user)
|
||||
@host = filter_command(host)
|
||||
@credentials = credentials # individually filtered
|
||||
@tools = tools # not used in command lines, no filter
|
||||
@os = os # not used in command lines, no filter
|
||||
|
|
|
@ -12,8 +12,9 @@ module Drivers
|
|||
|
||||
def initialize(vmid, location=nil, credentials=nil)
|
||||
|
||||
@vmid = filter_input(vmid)
|
||||
@location = filter_input(location)
|
||||
@vmid = filter_command(vmid)
|
||||
@location = filter_command(location)
|
||||
|
||||
|
||||
## Check to see if we already know this vm, if not, go on location
|
||||
vmid_list = ::Lab::Controllers::VirtualBoxController::config_list
|
||||
|
|
|
@ -146,6 +146,16 @@ private
|
|||
|
||||
string
|
||||
end
|
||||
|
||||
def filter_command(string)
|
||||
return "" unless string
|
||||
|
||||
if !(string =~ /^[\w\s\[\]\{\}\/\\\.\-\"\(\)]*$/)
|
||||
raise "WARNING! Invalid character in: #{string}"
|
||||
end
|
||||
|
||||
string
|
||||
end
|
||||
|
||||
def system_command(command)
|
||||
begin
|
||||
|
|
|
@ -13,8 +13,9 @@ class WorkstationDriver < VmDriver
|
|||
attr_accessor :location
|
||||
|
||||
def initialize(vmid, location, os=nil, tools=false, credentials=nil)
|
||||
@vmid = filter_input(vmid)
|
||||
@location = filter_input(location)
|
||||
@vmid = filter_command(vmid)
|
||||
@location = filter_command(location)
|
||||
|
||||
if !File.exist?(@location)
|
||||
raise ArgumentError,"Couldn't find: " + @location
|
||||
end
|
||||
|
|
|
@ -22,8 +22,9 @@ class WorkstationVixrDriver < VmDriver
|
|||
raise "Oops, no vixr installed. Consider using the regular workstation driver."
|
||||
end
|
||||
|
||||
@vmid = filter_input(vmid)
|
||||
@location = filter_input(location)
|
||||
@vmid = filter_command(vmid)
|
||||
@location = filter_command(location)
|
||||
|
||||
if !File.exist?(@location)
|
||||
raise ArgumentError,"Couldn't find: " + location
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue