net-ssh 0.6.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. data/doc/manual-html/chapter-1.html +59 -24
  2. data/doc/manual-html/chapter-2.html +116 -77
  3. data/doc/manual-html/chapter-3.html +80 -41
  4. data/doc/manual-html/chapter-4.html +111 -71
  5. data/doc/manual-html/chapter-5.html +267 -155
  6. data/doc/manual-html/chapter-6.html +211 -75
  7. data/doc/manual-html/chapter-7.html +331 -0
  8. data/doc/manual-html/index.html +39 -13
  9. data/doc/manual-html/{manual.css → stylesheets/manual.css} +81 -8
  10. data/doc/manual-html/stylesheets/ruby.css +17 -0
  11. data/doc/manual/chapter.erb +20 -0
  12. data/doc/manual/manual.rb +80 -9
  13. data/doc/manual/manual.yml +12 -2
  14. data/doc/manual/page.erb +1 -1
  15. data/doc/manual/parts/channels_callbacks.txt +11 -11
  16. data/doc/manual/parts/channels_loop.txt +6 -6
  17. data/doc/manual/parts/channels_open.txt +9 -9
  18. data/doc/manual/parts/exec_channels.txt +15 -15
  19. data/doc/manual/parts/exec_open.txt +17 -18
  20. data/doc/manual/parts/exec_popen3.txt +18 -18
  21. data/doc/manual/parts/forward_direct.txt +16 -16
  22. data/doc/manual/parts/forward_intro.txt +7 -7
  23. data/doc/manual/parts/forward_local.txt +9 -9
  24. data/doc/manual/parts/forward_remote.txt +9 -9
  25. data/doc/manual/parts/intro_getting.txt +11 -11
  26. data/doc/manual/parts/proxy_http.txt +27 -27
  27. data/doc/manual/parts/proxy_socks.txt +17 -17
  28. data/doc/manual/parts/session_key.txt +13 -14
  29. data/doc/manual/parts/session_options.txt +14 -14
  30. data/doc/manual/parts/session_session.txt +9 -9
  31. data/doc/manual/parts/session_start.txt +27 -27
  32. data/doc/manual/parts/shells_channels.txt +72 -0
  33. data/doc/manual/parts/shells_clients.txt +51 -0
  34. data/doc/manual/parts/shells_intro.txt +7 -0
  35. data/doc/manual/parts/shells_shell.txt +50 -0
  36. data/doc/manual/parts/shells_sync.txt +42 -0
  37. data/doc/manual/{manual.css → stylesheets/manual.css} +81 -8
  38. data/doc/manual/stylesheets/ruby.css +17 -0
  39. data/examples/channel-demo.rb +1 -1
  40. data/examples/port-forward.rb +1 -1
  41. data/examples/process-demo.rb +1 -1
  42. data/examples/remote-net-port-forward.rb +1 -1
  43. data/examples/remote-port-forward.rb +1 -1
  44. data/examples/shell-demo.rb +46 -0
  45. data/examples/ssh-client.rb +67 -0
  46. data/examples/sync-shell-demo.rb +69 -0
  47. data/examples/tail-demo.rb +1 -1
  48. data/lib/net/ssh.rb +1 -1
  49. data/lib/net/ssh/connection/channel.rb +61 -7
  50. data/lib/net/ssh/connection/constants.rb +1 -1
  51. data/lib/net/ssh/connection/driver.rb +61 -8
  52. data/lib/net/ssh/connection/services.rb +1 -1
  53. data/lib/net/ssh/connection/term.rb +1 -1
  54. data/lib/net/ssh/errors.rb +1 -1
  55. data/lib/net/ssh/proxy/errors.rb +1 -1
  56. data/lib/net/ssh/proxy/http.rb +1 -1
  57. data/lib/net/ssh/proxy/socks4.rb +1 -1
  58. data/lib/net/ssh/proxy/socks5.rb +1 -1
  59. data/lib/net/ssh/service/forward/driver.rb +1 -1
  60. data/lib/net/ssh/service/forward/local-network-handler.rb +1 -1
  61. data/lib/net/ssh/service/forward/remote-network-handler.rb +1 -1
  62. data/lib/net/ssh/service/forward/services.rb +1 -1
  63. data/lib/net/ssh/service/process/driver.rb +1 -1
  64. data/lib/net/ssh/service/process/open.rb +1 -1
  65. data/lib/net/ssh/service/process/popen3.rb +20 -2
  66. data/lib/net/ssh/service/process/services.rb +1 -1
  67. data/lib/net/ssh/service/services.rb +3 -1
  68. data/lib/net/ssh/service/shell/driver.rb +86 -0
  69. data/lib/net/ssh/service/shell/services.rb +54 -0
  70. data/lib/net/ssh/service/shell/shell.rb +213 -0
  71. data/lib/net/ssh/service/shell/sync.rb +114 -0
  72. data/lib/net/ssh/session.rb +9 -1
  73. data/lib/net/ssh/transport/algorithm-negotiator.rb +1 -1
  74. data/lib/net/ssh/transport/compress/compressor.rb +1 -1
  75. data/lib/net/ssh/transport/compress/decompressor.rb +1 -1
  76. data/lib/net/ssh/transport/compress/none-compressor.rb +1 -1
  77. data/lib/net/ssh/transport/compress/none-decompressor.rb +1 -1
  78. data/lib/net/ssh/transport/compress/services.rb +1 -1
  79. data/lib/net/ssh/transport/compress/zlib-compressor.rb +1 -1
  80. data/lib/net/ssh/transport/compress/zlib-decompressor.rb +1 -1
  81. data/lib/net/ssh/transport/constants.rb +1 -1
  82. data/lib/net/ssh/transport/errors.rb +1 -1
  83. data/lib/net/ssh/transport/identity-cipher.rb +1 -1
  84. data/lib/net/ssh/transport/kex/dh-gex.rb +1 -1
  85. data/lib/net/ssh/transport/kex/dh.rb +1 -1
  86. data/lib/net/ssh/transport/kex/services.rb +1 -1
  87. data/lib/net/ssh/transport/ossl/buffer-factory.rb +1 -1
  88. data/lib/net/ssh/transport/ossl/buffer.rb +1 -1
  89. data/lib/net/ssh/transport/ossl/cipher-factory.rb +1 -1
  90. data/lib/net/ssh/transport/ossl/digest-factory.rb +1 -1
  91. data/lib/net/ssh/transport/ossl/hmac-factory.rb +1 -1
  92. data/lib/net/ssh/transport/ossl/hmac/hmac.rb +1 -1
  93. data/lib/net/ssh/transport/ossl/hmac/md5-96.rb +1 -1
  94. data/lib/net/ssh/transport/ossl/hmac/md5.rb +1 -1
  95. data/lib/net/ssh/transport/ossl/hmac/none.rb +1 -1
  96. data/lib/net/ssh/transport/ossl/hmac/services.rb +1 -1
  97. data/lib/net/ssh/transport/ossl/hmac/sha1-96.rb +1 -1
  98. data/lib/net/ssh/transport/ossl/hmac/sha1.rb +1 -1
  99. data/lib/net/ssh/transport/ossl/key-factory.rb +5 -2
  100. data/lib/net/ssh/transport/ossl/services.rb +1 -1
  101. data/lib/net/ssh/transport/packet-stream.rb +1 -1
  102. data/lib/net/ssh/transport/services.rb +1 -1
  103. data/lib/net/ssh/transport/session.rb +10 -1
  104. data/lib/net/ssh/transport/version-negotiator.rb +1 -1
  105. data/lib/net/ssh/userauth/agent.rb +1 -1
  106. data/lib/net/ssh/userauth/constants.rb +1 -1
  107. data/lib/net/ssh/userauth/driver.rb +1 -1
  108. data/lib/net/ssh/userauth/methods/hostbased.rb +1 -1
  109. data/lib/net/ssh/userauth/methods/keyboard-interactive.rb +104 -0
  110. data/lib/net/ssh/userauth/methods/password.rb +1 -1
  111. data/lib/net/ssh/userauth/methods/publickey.rb +1 -1
  112. data/lib/net/ssh/userauth/methods/services.rb +28 -6
  113. data/lib/net/ssh/userauth/services.rb +8 -5
  114. data/lib/net/ssh/userauth/userkeys.rb +1 -1
  115. data/lib/net/ssh/util/buffer.rb +1 -1
  116. data/lib/net/ssh/util/openssl.rb +1 -1
  117. data/lib/net/ssh/util/prompter.rb +1 -1
  118. data/lib/net/ssh/version.rb +2 -2
  119. data/test/ALL-TESTS.rb +1 -1
  120. data/test/connection/tc_channel.rb +1 -1
  121. data/test/connection/tc_driver.rb +1 -1
  122. data/test/connection/tc_integration.rb +1 -1
  123. data/test/proxy/tc_http.rb +1 -1
  124. data/test/proxy/tc_socks4.rb +1 -1
  125. data/test/proxy/tc_socks5.rb +1 -1
  126. data/test/service/forward/tc_driver.rb +1 -1
  127. data/test/service/forward/tc_local_network_handler.rb +1 -1
  128. data/test/service/forward/tc_remote_network_handler.rb +1 -1
  129. data/test/service/process/tc_driver.rb +1 -1
  130. data/test/service/process/tc_integration.rb +1 -1
  131. data/test/service/process/tc_open.rb +1 -1
  132. data/test/service/process/tc_popen3.rb +13 -13
  133. data/test/tc_integration.rb +1 -1
  134. data/test/transport/compress/tc_none_compress.rb +1 -1
  135. data/test/transport/compress/tc_none_decompress.rb +1 -1
  136. data/test/transport/compress/tc_zlib_compress.rb +1 -1
  137. data/test/transport/compress/tc_zlib_decompress.rb +1 -1
  138. data/test/transport/kex/tc_dh.rb +2 -1
  139. data/test/transport/kex/tc_dh_gex.rb +1 -1
  140. data/test/transport/ossl/hmac/tc_hmac.rb +1 -1
  141. data/test/transport/ossl/hmac/tc_md5.rb +1 -1
  142. data/test/transport/ossl/hmac/tc_md5_96.rb +1 -1
  143. data/test/transport/ossl/hmac/tc_none.rb +1 -1
  144. data/test/transport/ossl/hmac/tc_sha1.rb +1 -1
  145. data/test/transport/ossl/hmac/tc_sha1_96.rb +1 -1
  146. data/test/transport/ossl/tc_buffer.rb +1 -1
  147. data/test/transport/ossl/tc_buffer_factory.rb +1 -1
  148. data/test/transport/ossl/tc_cipher_factory.rb +1 -1
  149. data/test/transport/ossl/tc_digest_factory.rb +1 -1
  150. data/test/transport/ossl/tc_hmac_factory.rb +1 -1
  151. data/test/transport/ossl/tc_key_factory.rb +1 -1
  152. data/test/transport/tc_algorithm_negotiator.rb +1 -1
  153. data/test/transport/tc_identity_cipher.rb +1 -1
  154. data/test/transport/tc_integration.rb +1 -1
  155. data/test/transport/tc_packet_stream.rb +1 -1
  156. data/test/transport/tc_session.rb +1 -1
  157. data/test/transport/tc_version_negotiator.rb +1 -1
  158. data/test/userauth/methods/tc_hostbased.rb +1 -1
  159. data/test/userauth/methods/tc_password.rb +1 -1
  160. data/test/userauth/methods/tc_publickey.rb +1 -1
  161. data/test/userauth/tc_agent.rb +1 -1
  162. data/test/userauth/tc_driver.rb +1 -1
  163. data/test/userauth/tc_integration.rb +15 -1
  164. data/test/userauth/tc_userkeys.rb +1 -1
  165. data/test/util/tc_buffer.rb +5 -5
  166. metadata +26 -6
@@ -0,0 +1,114 @@
1
+ #--
2
+ # =============================================================================
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
+ # All rights reserved.
5
+ #
6
+ # This source file is distributed as part of the Net::SSH Secure Shell Client
7
+ # library for Ruby. This file (and the library as a whole) may be used only as
8
+ # allowed by either the BSD license, or the Ruby license (or, by association
9
+ # with the Ruby license, the GPL). See the "doc" subdirectory of the Net::SSH
10
+ # distribution for the texts of these licenses.
11
+ # -----------------------------------------------------------------------------
12
+ # net-ssh website : http://net-ssh.rubyforge.org
13
+ # project website: http://rubyforge.org/projects/net-ssh
14
+ # =============================================================================
15
+ #++
16
+
17
+ require 'stringio'
18
+
19
+ module Net
20
+ module SSH
21
+ module Service
22
+ module Shell
23
+
24
+ # A version of Shell::Shell that acts synchronously, allowing clients
25
+ # to execute a command via a shell, wait for it to finish, and then
26
+ # inspect both the stdout and stderr from the command, as well as the
27
+ # exit status.
28
+ class SyncShell
29
+
30
+ # A struct representing the result of executing a command.
31
+ CommandOutput = Struct.new( :stdout, :stderr, :status )
32
+
33
+ # The unique confirmation string that is used to recognize the
34
+ # end of a command's execution.
35
+ CONFIRMATION = "2357foobarbazzabraboof7532"
36
+
37
+ # Create a new SyncShell that uses the given +shell+ factory to obtain
38
+ # a shell to wrap. The other parameters are used
39
+ def initialize( shell, log, pty_opts )
40
+ @log = log
41
+ @shell = shell.call( pty_opts )
42
+ end
43
+
44
+ # Delegates to Shell::Shell.open?
45
+ def open?
46
+ @shell.open?
47
+ end
48
+
49
+ # Attempts to invoke the given command, which must not be
50
+ # terminated with a newline. If +stdin+ is not nil, it will be sent
51
+ # to the shell immediately after sending the request to execute the
52
+ # command. It is expected that this will be used by the program that
53
+ # was just executed somehow, but this is not (cannot) be enforced.
54
+ def send_command( cmd, stdin=nil )
55
+ @log.debug "executing #{cmd.inspect}" if @log.debug?
56
+ send_data "#{cmd}; echo -n #{CONFIRMATION} $?\n"
57
+ send_data stdin if stdin
58
+
59
+ out = ""
60
+ err = ""
61
+
62
+ @log.debug "waiting for #{cmd.inspect}" if @log.debug?
63
+ loop do
64
+ sleep 0.01
65
+ out << @shell.stdout while @shell.open? && @shell.stdout?
66
+ err << @shell.stderr while @shell.open? && @shell.stderr?
67
+
68
+ break if !@shell.open? || out.index( CONFIRMATION + " " )
69
+ end
70
+
71
+ if @log.debug?
72
+ @log.debug "#{cmd.inspect} finished"
73
+ @log.debug " stdout --> #{out.inspect}"
74
+ @log.debug " stderr --> #{err.inspect}"
75
+ end
76
+
77
+ if @shell.open?
78
+ match = out.match( /#{CONFIRMATION} /o )
79
+ out = match.pre_match
80
+ status = match.post_match.strip.to_i
81
+ else
82
+ status = 0
83
+ end
84
+
85
+ CommandOutput.new( out, ( err.empty? ? nil : err ), status )
86
+ end
87
+
88
+ # Sends the given string directly to the shell, without waiting for
89
+ # any response.
90
+ def send_data( data )
91
+ @shell.send_data data
92
+ end
93
+
94
+ # Dends the given string directly to the shell as the given type of
95
+ # data, without waiting for any response.
96
+ def send_extended_data( type, data )
97
+ @shell.send_extended_data type, data
98
+ end
99
+
100
+ # Reinterprets missing methods as requests to execute commands. The
101
+ # parameters to the method are concatenated together with spaces
102
+ # and sent to the shell via #send_command.
103
+ def method_missing( sym, *args )
104
+ cmd = sym.to_s
105
+ cmd << " " << args.join( " " ) unless args.empty?
106
+ send_command cmd
107
+ end
108
+
109
+ end
110
+
111
+ end # SyncShell
112
+ end # Service
113
+ end # SSH
114
+ end # Net
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -26,6 +26,12 @@ module Net
26
26
  # The dependency-injection registry used by this session.
27
27
  attr_reader :registry
28
28
 
29
+ # The name of the host that this session is connected to.
30
+ attr_reader :host
31
+
32
+ # The hash of options that were used to establish this session.
33
+ attr_reader :options
34
+
29
35
  # Create a new SSH session. This method polymorphically accepts a
30
36
  # variable number of parameters, as follows:
31
37
  #
@@ -231,6 +237,8 @@ module Net
231
237
  ].each do |i|
232
238
  @options.delete i
233
239
  end
240
+
241
+ @options.freeze
234
242
  end
235
243
  private :process_arguments
236
244
 
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -101,7 +101,10 @@ module Net
101
101
 
102
102
  blob = Base64.decode64( blob )
103
103
  reader = @buffers.reader( blob )
104
- return reader.read_key
104
+ key = reader.read_key or
105
+ raise OpenSSL::PKey::PKeyError,
106
+ "not a public key #{filename.inspect}"
107
+ return key
105
108
  end
106
109
 
107
110
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # =============================================================================
3
- # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu)
3
+ # Copyright (c) 2004,2005 Jamis Buck (jamis_buck@byu.edu)
4
4
  # All rights reserved.
5
5
  #
6
6
  # This source file is distributed as part of the Net::SSH Secure Shell Client
@@ -231,6 +231,8 @@ module Net
231
231
  end
232
232
 
233
233
  buffer = @packet_receiver.get
234
+ next unless buffer
235
+
234
236
  type = buffer.read_byte
235
237
  @logger.debug "got packet of type #{type}" if @logger.debug?
236
238
 
@@ -289,6 +291,13 @@ module Net
289
291
  @packet_sender.send message
290
292
  end
291
293
 
294
+ # Returns true if there are bytes to be read on the socket. Note that
295
+ # this only means there is an encrypted packet ready to be read, not
296
+ # that there is data available to any particular SSH channel.
297
+ def reader_ready?
298
+ IO.select([@socket],nil,nil,0) != nil
299
+ end
300
+
292
301
  end
293
302
 
294
303
  end