summaryrefslogtreecommitdiff
path: root/lib/custodian
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-17 23:23:53 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-17 23:23:53 +0000
commit8d4f8df269045f61f3922dfb827a729b727f5307 (patch)
tree4ffba6ef1bdf1d281ade878e3ab7349d3c285e7c /lib/custodian
parente512dcab32f2cad1c4c369270ac7cc7749614e80 (diff)
strip newlines from the banner we read.
Diffstat (limited to 'lib/custodian')
-rwxr-xr-xlib/custodian/protocol-tests/tcp.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/custodian/protocol-tests/tcp.rb b/lib/custodian/protocol-tests/tcp.rb
index acf4737..08707a5 100755
--- a/lib/custodian/protocol-tests/tcp.rb
+++ b/lib/custodian/protocol-tests/tcp.rb
@@ -90,7 +90,10 @@ class TCPTest
# read a banner from the remote server
read = socket.gets(nil)
+
+ # trim to a sane length & strip newlines.
read = read[0,255]
+ read.gsub!(/[\n\r]/, "") unless ( read.nil? )
socket.close()
@@ -116,7 +119,6 @@ class TCPTest
@error = "TIMEOUT: #{e}"
return false
end
-
@error = "Misc failure"
return false
end
@@ -134,7 +136,7 @@ end
#
-# Sample test, for testing.
+# Sample test, for basic testing.
#
if __FILE__ == $0 then