net-ssh 0.6.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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
@@ -0,0 +1,104 @@
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 'net/ssh/errors'
18
+ require 'net/ssh/userauth/constants'
19
+
20
+ module Net
21
+ module SSH
22
+ module UserAuth
23
+ module Methods
24
+
25
+ # Implements the "keyboard-interactive" SSH authentication method.
26
+ class KeyboardInteractive
27
+ include Net::SSH::UserAuth::Constants
28
+
29
+ # Represents an information request from the server
30
+ InfoRequest = Struct.new( :name, :instruction, :password, :prompts )
31
+
32
+ # Represents a single prompt in an InfoRequest.
33
+ Prompt = Struct.new( :prompt, :echo )
34
+
35
+ USERAUTH_INFO_REQUEST = 60
36
+ USERAUTH_INFO_RESPONSE = 61
37
+
38
+ # The messenger to use when communicating.
39
+ attr_writer :messenger
40
+
41
+ # Create a new Password authenticator. It will use the given buffers
42
+ # factory to create new buffer instances. The +callback+ should be
43
+ # a proc object to use to specialize the behavior of this
44
+ # authentication method.
45
+ def initialize( buffers, callback )
46
+ @buffers = buffers
47
+ @callback = callback
48
+ end
49
+
50
+ # Attempt to authenticate the given user for the given service. The
51
+ # data hash must specify a <tt>:password</tt> value, otherwise this
52
+ # will always return false.
53
+ def authenticate( next_service, username, data={} )
54
+ password = data[:password]
55
+
56
+ msg = @buffers.writer
57
+ msg.write_byte USERAUTH_REQUEST
58
+ msg.write_string username
59
+ msg.write_string next_service
60
+ msg.write_string "keyboard-interactive"
61
+ msg.write_string ""
62
+ msg.write_string ""
63
+ @messenger.send_message msg
64
+
65
+ loop do
66
+ message = @messenger.wait_for_message
67
+
68
+ case message.message_type
69
+ when USERAUTH_SUCCESS
70
+ return true
71
+ when USERAUTH_FAILURE
72
+ return false
73
+ when USERAUTH_INFO_REQUEST
74
+ name = message.buffer.read_string
75
+ instruction = message.buffer.read_string
76
+ req = InfoRequest.new( name, instruction, password, [] )
77
+ password = nil # only use the given password once
78
+
79
+ lang_tag = message.buffer.read_string
80
+ message.buffer.read_long.times do
81
+ prompt = message.buffer.read_string
82
+ echo = message.buffer.read_bool
83
+ req.prompts << Prompt.new( prompt, echo )
84
+ end
85
+
86
+ responses = @callback.call( req )
87
+ msg = @buffers.writer
88
+ msg.write_byte USERAUTH_INFO_RESPONSE
89
+ msg.write_long responses.length
90
+ msg.write_string *responses
91
+ @messenger.send_message msg
92
+ else
93
+ raise Net::SSH::Exception,
94
+ "unexpected reply in keyboard interactive: " +
95
+ message.inspect
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ end
102
+ end
103
+ end
104
+ 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
@@ -29,11 +29,33 @@ module Net
29
29
  method
30
30
  end
31
31
 
32
- # Just alias keyboard_interactive to password, for now
33
- # TODO: keyboard_interactive should probably actually prompt
34
- # for a password if one wasn't given...need to read up on this
35
- # more.
36
- b.keyboard_interactive { b.password }
32
+ b.keyboard_interactive do |c,p|
33
+ require 'net/ssh/userauth/methods/keyboard-interactive'
34
+ method = KeyboardInteractive.new( c[:transport][:buffers],
35
+ c[:keyboard_interactive_callback] )
36
+ method.messenger = c[:userauth][:driver]
37
+ method
38
+ end
39
+
40
+ b.keyboard_interactive_prompter do
41
+ require 'net/ssh/util/prompter'
42
+ Net::SSH::Util::Prompter.new
43
+ end
44
+
45
+ b.keyboard_interactive_callback do |c,p|
46
+ proc do |req|
47
+ responses = []
48
+ puts req.name unless req.name.empty?
49
+ puts req.instruction unless req.instruction.empty?
50
+ req.prompts.each do |prompt|
51
+ response = prompt.echo ?
52
+ gets.chomp :
53
+ c[:keyboard_interactive_prompter].password( prompt.prompt )
54
+ responses << response
55
+ end
56
+ responses
57
+ end
58
+ end
37
59
 
38
60
  b.publickey do |c,p|
39
61
  require 'net/ssh/userauth/methods/publickey'
@@ -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
@@ -38,13 +38,16 @@ module Net
38
38
  b.default_agent_version { 2 }
39
39
 
40
40
  b.agent( :model => :prototype ) do |c,p|
41
- if ( socket_factory = c[:agent_socket_factory] )
41
+ socket_factory = c[:agent_socket_factory]
42
+ socket_name = c[:default_agent_socket_name]
43
+
44
+ if socket_name && socket_factory
42
45
  require 'net/ssh/userauth/agent'
43
46
  require 'net/ssh/transport/services'
44
47
 
45
48
  agent = Agent.new
46
49
  agent.socket_factory = socket_factory
47
- agent.socket_name = c[:default_agent_socket_name]
50
+ agent.socket_name = socket_name
48
51
  agent.version = c[:default_agent_version]
49
52
  agent.buffers = c[:transport][:buffers]
50
53
  agent.keys = c[:transport][:keys]
@@ -93,9 +96,9 @@ module Net
93
96
 
94
97
  b.authentication_method_order do
95
98
  [ "publickey",
96
- "keyboard-interactive",
99
+ "hostbased",
97
100
  "password",
98
- "hostbased" ]
101
+ "keyboard-interactive" ]
99
102
  end
100
103
 
101
104
  b.driver do |c,p|
@@ -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
@@ -19,7 +19,7 @@ module Net
19
19
  module Version
20
20
 
21
21
  MAJOR = 0
22
- MINOR = 6
22
+ MINOR = 9
23
23
  TINY = 0
24
24
 
25
25
  STRING = [ MAJOR, MINOR, TINY ].join( "." )
data/test/ALL-TESTS.rb CHANGED
@@ -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
@@ -47,7 +47,7 @@ class TC_Process_POpen3 < Test::Unit::TestCase
47
47
 
48
48
  class TC_SSHStdinPipe < Test::Unit::TestCase
49
49
  def setup
50
- @channel = MockObject.new
50
+ @channel = Channel.new
51
51
  @pipe = Net::SSH::Service::Process::POpen3Manager::SSHStdinPipe.new(
52
52
  @channel )
53
53
  end
@@ -76,9 +76,11 @@ class TC_Process_POpen3 < Test::Unit::TestCase
76
76
  end
77
77
 
78
78
  def test_read_empty
79
+ klass = class << @channel.connection; self; end
80
+ pipe = @pipe
81
+ klass.send(:define_method,:process) { pipe.instance_variable_set( :@data, "foo" ) }
79
82
  s = @pipe.read
80
- assert_equal "", s
81
- assert_equal [ [ :loop, :with_block ] ], @channel.connection.events
83
+ assert_equal "foo", s
82
84
  end
83
85
 
84
86
  def test_read_full
@@ -97,16 +99,14 @@ class TC_Process_POpen3 < Test::Unit::TestCase
97
99
  end
98
100
 
99
101
  def test_read_empty
102
+ klass = class << @channel.connection; self; end
103
+ pipe = @pipe
104
+ klass.send(:define_method,:process) do
105
+ data = pipe.instance_variable_get( :@data )
106
+ pipe.instance_variable_set( :@data, (data||"") + "foo" )
107
+ end
100
108
  s = @pipe.read
101
- assert_equal "", s
102
- assert_equal [ [ :loop, :with_block ] ], @channel.connection.events
103
- end
104
-
105
- def test_read_non_stderr
106
- @pipe.do_data @channel, 0, "foo"
107
- s = @pipe.read
108
- assert_equal "", s
109
- assert_equal [ [ :loop, :with_block ] ], @channel.connection.events
109
+ assert_equal "foo", s
110
110
  end
111
111
 
112
112
  def test_read_stderr