From c5c74fb557d825f9a8b67c51cfeeb5a48adfc6c0 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Sat, 17 Nov 2012 23:23:53 +0000 Subject: strip newlines from the banner we read. --- lib/custodian/protocol-tests/tcp.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/custodian') 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 -- cgit v1.2.1