register_options() always overrides the datastore
resolves the problem reported by Nicolas P. git-svn-id: file:///home/svn/incoming/trunk@3642 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
c02749067f
commit
43387ea793
|
@ -40,11 +40,11 @@ class DataStore < Hash
|
|||
# This method is a helper method that imports the default value for
|
||||
# all of the supplied options
|
||||
#
|
||||
def import_options(options, imported_by = nil)
|
||||
def import_options(options, imported_by = nil, overwrite = false)
|
||||
options.each_option { |name, opt|
|
||||
# If the option has a default value, import it, but only if the
|
||||
# datastore doesn't already have a value set for it.
|
||||
if (opt.default and self[name] == nil)
|
||||
if (opt.default and (overwrite or self[name] == nil))
|
||||
self.store(name, opt.default.to_s)
|
||||
|
||||
@imported[name] = true
|
||||
|
|
|
@ -121,7 +121,7 @@ class Module
|
|||
|
||||
# Create and initialize the data store for this module
|
||||
self.datastore = ModuleDataStore.new(self)
|
||||
self.datastore.import_options(self.options, 'self')
|
||||
self.datastore.import_options(self.options, 'self', true)
|
||||
|
||||
# If there are default options, import their values into the datastore
|
||||
if (module_info['DefaultOptions'])
|
||||
|
@ -487,7 +487,7 @@ protected
|
|||
#
|
||||
def register_options(options, owner = self.class)
|
||||
self.options.add_options(options, owner)
|
||||
self.datastore.import_options(self.options, 'self')
|
||||
self.datastore.import_options(self.options, 'self', true)
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -495,7 +495,7 @@ protected
|
|||
#
|
||||
def register_advanced_options(options, owner = self.class)
|
||||
self.options.add_advanced_options(options, owner)
|
||||
self.datastore.import_options(self.options, 'self')
|
||||
self.datastore.import_options(self.options, 'self', true)
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -503,7 +503,7 @@ protected
|
|||
#
|
||||
def register_evasion_options(options, owner = self.class)
|
||||
self.options.add_evasion_options(options, owner)
|
||||
self.datastore.import_options(self.options, 'self')
|
||||
self.datastore.import_options(self.options, 'self', true)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue