metasploit_data_models 0.22.1 → 0.22.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c10785a13c01bc2f665452025f6e3760c2ae461
4
- data.tar.gz: c2347bc23c46c2220837dbed38dcfafd667da197
3
+ metadata.gz: beb915aba1fb4d85ab017f76f7d31ff538913a5a
4
+ data.tar.gz: b0e62635cdfdec070b670a6f9647e490ee7d6346
5
5
  SHA512:
6
- metadata.gz: 88988f1f7348f8e3472265becac4ddd3f3fecc00eb6ba696e4f6ca9e03ae95b427f91a16e8e91f4d1cf53e88fa6a474e96d3832e65eb1aa3bec9ded553d4ae85
7
- data.tar.gz: c1461576f9e91b6f70bb0029b6673d07aaf03877bc4e011030b989e651adc478cedf5c54c69c69aac96f0338af3204fa382c47770dad29a8c526607d966ee518
6
+ metadata.gz: 02815fdbe61b9a55a542f66eb4a7abd9cd0ee756b4c2d2dce9dbefd70acc8e87bcaa9038ddc9191a4cc33c30cb59bc0bd60e1c8489f497fb579ed9638c570331
7
+ data.tar.gz: 5bc91a434e144eb058d6fe31c2950d6b6c77ea6cee52583d436f96c065b672a7c2cfdb31847b76cb3d3b0dd7c05b5b932afa5ceb503487e2c8aa33e28ab5eca7
@@ -222,14 +222,19 @@ class Mdm::Service < ActiveRecord::Base
222
222
  in: PROTOS
223
223
  }
224
224
 
225
- validates :host_id,
226
- uniqueness: {
227
- message: 'already has a service with this port and proto',
228
- scope: [
229
- :port,
230
- :proto
231
- ]
232
- }
225
+ validate :uniq_port_proto_per_host
226
+
227
+ # Custom validation to ensure that the combination of port and protocol
228
+ # for a service doesn't already exist for the same host.
229
+ def uniq_port_proto_per_host
230
+ no_dupes = Mdm::Service.where(host_id: host.id, port: port, proto: proto).blank?
231
+ error_msg = 'This host already has a service with this port and protocol.'
232
+
233
+ unless no_dupes
234
+ errors.add(:port, error_msg)
235
+ errors.add(:proto, error_msg)
236
+ end
237
+ end
233
238
 
234
239
  #
235
240
  # Class Methods
@@ -6,7 +6,7 @@ module MetasploitDataModels
6
6
  # The minor version number, scoped to the {MAJOR} version number.
7
7
  MINOR = 22
8
8
  # The patch number, scoped to the {MINOR} version number.
9
- PATCH = 1
9
+ PATCH = 2
10
10
 
11
11
  # The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
12
12
  # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Huckins
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-01-16 00:00:00.000000000 Z
14
+ date: 2015-01-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake