fixes #20, re-import default options when flushing all options
git-svn-id: file:///home/svn/framework3/trunk@4448 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
a94179aac4
commit
fbd91e48d4
|
@ -125,12 +125,9 @@ class Module
|
||||||
|
|
||||||
# Create and initialize the data store for this module
|
# Create and initialize the data store for this module
|
||||||
self.datastore = ModuleDataStore.new(self)
|
self.datastore = ModuleDataStore.new(self)
|
||||||
self.datastore.import_options(self.options, 'self', true)
|
|
||||||
|
|
||||||
# If there are default options, import their values into the datastore
|
# Import default options into the datastore
|
||||||
if (module_info['DefaultOptions'])
|
import_defaults
|
||||||
self.datastore.import_options_from_hash(module_info['DefaultOptions'], true, 'self')
|
|
||||||
end
|
|
||||||
|
|
||||||
self.privileged = module_info['Privileged'] || false
|
self.privileged = module_info['Privileged'] || false
|
||||||
self.license = module_info['License'] || MSF_LICENSE
|
self.license = module_info['License'] || MSF_LICENSE
|
||||||
|
@ -365,6 +362,22 @@ class Module
|
||||||
self.datastore = ds
|
self.datastore = ds
|
||||||
self.datastore.import_options(self.options)
|
self.datastore.import_options(self.options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Imports default options into the module's datastore, optionally clearing
|
||||||
|
# all of the values currently set in the datastore.
|
||||||
|
#
|
||||||
|
def import_defaults(clear_datastore = true)
|
||||||
|
# Clear the datastore if the caller asked us to
|
||||||
|
self.datastore.clear if clear_datastore
|
||||||
|
|
||||||
|
self.datastore.import_options(self.options, 'self', true)
|
||||||
|
|
||||||
|
# If there are default options, import their values into the datastore
|
||||||
|
if (module_info['DefaultOptions'])
|
||||||
|
self.datastore.import_options_from_hash(module_info['DefaultOptions'], true, 'self')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# This method ensures that the options associated with this module all
|
# This method ensures that the options associated with this module all
|
||||||
|
|
|
@ -965,7 +965,15 @@ class Core
|
||||||
# If all was specified, then flush all of the entries
|
# If all was specified, then flush all of the entries
|
||||||
if args[0] == 'all'
|
if args[0] == 'all'
|
||||||
print_line("Flushing datastore...")
|
print_line("Flushing datastore...")
|
||||||
datastore.clear
|
|
||||||
|
# Re-import default options into the module's datastore
|
||||||
|
if (active_module and global == false)
|
||||||
|
active_module.import_defaults
|
||||||
|
# Or simply clear the global datastore
|
||||||
|
else
|
||||||
|
datastore.clear
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue