Skip to content

Fixes a stack trace when deleting files #339

Merged
merged 3 commits into from Apr 16, 2012
View
9 data/sql/migrate/20120411173220_rename_workspace_members.rb
@@ -0,0 +1,9 @@
+class RenameWorkspaceMembers < ActiveRecord::Migration
+ def up
+ rename_table :project_members, :workspace_members
+ end
+
+ def down
+ rename_table :workspace_members, :project_members
+ end
+end
View
8 ...etasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/loot.rb
@@ -13,8 +13,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.loot_delete_file(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.loot_delete_file(self[:id])
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
View
8 ...asploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/report.rb
@@ -16,8 +16,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.report_delete_file(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.report_delete_file(self[:id])
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
View
8 ...ata_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/report_template.rb
@@ -9,8 +9,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.report_template_delete_file(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.report_template_delete_file(self[:id])
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
View
2 ...sploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/session.rb
@@ -18,7 +18,7 @@ def self.included(base)
private
def stop
- c = Pro::Client.get
+ c = Pro::Client.get rescue nil
c.session_stop(self.local_id) rescue nil # ignore exceptions (XXX - ideally, stopped an already-stopped session wouldn't throw XMLRPCException)
end
}
View
8 ...etasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/task.rb
@@ -15,8 +15,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.task_delete_log(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.task_delete_log(self[:id]) if c
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
Something went wrong with that request. Please try again.