summaryrefslogtreecommitdiff
path: root/worker/tests/smtp.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-13 15:13:30 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-13 15:13:30 +0000
commit5fd15341264b5aae31d41afcd09affea0df6ee24 (patch)
tree9db07cd8043869b1b822c1d3eb618f9e56aefdd5 /worker/tests/smtp.rb
parentd8eca31453dd8131a7d101e9f7f9dd667d8dc6ef (diff)
Added validation of target + port
Diffstat (limited to 'worker/tests/smtp.rb')
-rwxr-xr-xworker/tests/smtp.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/worker/tests/smtp.rb b/worker/tests/smtp.rb
index 58029e4..aa577d6 100755
--- a/worker/tests/smtp.rb
+++ b/worker/tests/smtp.rb
@@ -29,6 +29,24 @@ class SMTPTest
#
def initialize( data )
@test_data = data
+ @error = nil
+
+
+ #
+ # Ensure we have a host to probe
+ #
+ if ( @test_data["target_host"].nil? )
+ @error = "Missing target for the test."
+ raise ArgumentError, @error
+ end
+
+ #
+ # Ensure we have a port to test.
+ #
+ if ( @test_data["test_port"].nil? )
+ @error = "Missing port for the test."
+ raise ArgumentError, @error
+ end
end
@@ -48,7 +66,7 @@ class SMTPTest
# Get the hostname & port to test against.
#
host = @test_data['target_host']
- port = 25
+ port = @test_data['test_port']
puts "SMTP testing host #{host}:#{port}" if ( @test_data['verbose'] )