public
Description: Pure Ruby implementation of an SSH (protocol 2) client
Homepage: http://rubyforge.org/projects/net-ssh
Clone URL: git://github.com/jamis/net-ssh.git
Search Repo:
Use #chomp instead of #strip to clean the version string.

This lets Net::SSH play nicely with servers like Mocana SSH, which
include a trailing space character in their version string. (In
their defence, this is not technically allowed by the SSH2 spec.)
jamis (author)
Sat Jun 07 14:40:45 -0700 2008
commit  330585a416c3a906a6d3c7e08d3ca6626cac79a5
tree    a1b661bd34805ba987544f1bf3bcb1c80431e4c0
parent  28d6ee27e997ec2d2614f0380f4e4aebcb8bcae0
...
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
0
@@ -1,3 +1,8 @@
0
+=== *unreleased*
0
+
0
+* Use #chomp instead of #strip when cleaning the version string reported by the remote host, so that trailing whitespace is preserved (this is to play nice with servers like Mocana SSH) [Timo Gatsonides]
0
+
0
+
0
 === 2.0.2 / 29 May 2008
0
 
0
 * Make sure the agent client understands both RSA "identities answers" [Jamis Buck]
...
46
47
48
49
 
 
50
51
52
53
54
55
56
57
 
58
59
60
...
46
47
48
 
49
50
51
52
53
54
55
 
 
 
56
57
58
59
0
@@ -46,15 +46,14 @@ module Net; module SSH; module Transport
0
           @header << @version
0
         end
0
 
0
- debug { "remote is #{@version.strip}" }
0
+ @version.chomp!
0
+ debug { "remote is `#{@version}'" }
0
 
0
         unless @version.match(/^SSH-(1\.99|2\.0)-/)
0
           raise Net::SSH::Exception, "incompatible SSH version `#{@version}'"
0
         end
0
 
0
- @version.strip!
0
-
0
- debug { "local is #{PROTO_VERSION}" }
0
+ debug { "local is `#{PROTO_VERSION}'" }
0
         socket.write "#{PROTO_VERSION}\r\n"
0
       end
0
   end
...
17
18
19
20
 
 
 
21
22
 
23
24
25
...
17
18
19
 
20
21
22
23
 
24
25
26
27
0
@@ -17,9 +17,11 @@ module Transport
0
       assert_equal "SSH-2.0-Testing_1.0", s.version
0
     end
0
 
0
- def test_trailing_whitespace_should_be_stripped
0
+ def test_trailing_whitespace_should_be_preserved
0
+ # some servers, like Mocana, send a version string with trailing
0
+ # spaces, which are significant when exchanging keys later.
0
       s = subject(socket(true, "SSH-2.0-Testing_1.0 \r\n"))
0
- assert_equal "SSH-2.0-Testing_1.0", s.version
0
+ assert_equal "SSH-2.0-Testing_1.0 ", s.version
0
     end
0
 
0
     def test_unacceptible_server_version_should_raise_exception

Comments

    No one has commented yet.