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.
- data/doc/manual-html/chapter-1.html +59 -24
- data/doc/manual-html/chapter-2.html +116 -77
- data/doc/manual-html/chapter-3.html +80 -41
- data/doc/manual-html/chapter-4.html +111 -71
- data/doc/manual-html/chapter-5.html +267 -155
- data/doc/manual-html/chapter-6.html +211 -75
- data/doc/manual-html/chapter-7.html +331 -0
- data/doc/manual-html/index.html +39 -13
- data/doc/manual-html/{manual.css → stylesheets/manual.css} +81 -8
- data/doc/manual-html/stylesheets/ruby.css +17 -0
- data/doc/manual/chapter.erb +20 -0
- data/doc/manual/manual.rb +80 -9
- data/doc/manual/manual.yml +12 -2
- data/doc/manual/page.erb +1 -1
- data/doc/manual/parts/channels_callbacks.txt +11 -11
- data/doc/manual/parts/channels_loop.txt +6 -6
- data/doc/manual/parts/channels_open.txt +9 -9
- data/doc/manual/parts/exec_channels.txt +15 -15
- data/doc/manual/parts/exec_open.txt +17 -18
- data/doc/manual/parts/exec_popen3.txt +18 -18
- data/doc/manual/parts/forward_direct.txt +16 -16
- data/doc/manual/parts/forward_intro.txt +7 -7
- data/doc/manual/parts/forward_local.txt +9 -9
- data/doc/manual/parts/forward_remote.txt +9 -9
- data/doc/manual/parts/intro_getting.txt +11 -11
- data/doc/manual/parts/proxy_http.txt +27 -27
- data/doc/manual/parts/proxy_socks.txt +17 -17
- data/doc/manual/parts/session_key.txt +13 -14
- data/doc/manual/parts/session_options.txt +14 -14
- data/doc/manual/parts/session_session.txt +9 -9
- data/doc/manual/parts/session_start.txt +27 -27
- data/doc/manual/parts/shells_channels.txt +72 -0
- data/doc/manual/parts/shells_clients.txt +51 -0
- data/doc/manual/parts/shells_intro.txt +7 -0
- data/doc/manual/parts/shells_shell.txt +50 -0
- data/doc/manual/parts/shells_sync.txt +42 -0
- data/doc/manual/{manual.css → stylesheets/manual.css} +81 -8
- data/doc/manual/stylesheets/ruby.css +17 -0
- data/examples/channel-demo.rb +1 -1
- data/examples/port-forward.rb +1 -1
- data/examples/process-demo.rb +1 -1
- data/examples/remote-net-port-forward.rb +1 -1
- data/examples/remote-port-forward.rb +1 -1
- data/examples/shell-demo.rb +46 -0
- data/examples/ssh-client.rb +67 -0
- data/examples/sync-shell-demo.rb +69 -0
- data/examples/tail-demo.rb +1 -1
- data/lib/net/ssh.rb +1 -1
- data/lib/net/ssh/connection/channel.rb +61 -7
- data/lib/net/ssh/connection/constants.rb +1 -1
- data/lib/net/ssh/connection/driver.rb +61 -8
- data/lib/net/ssh/connection/services.rb +1 -1
- data/lib/net/ssh/connection/term.rb +1 -1
- data/lib/net/ssh/errors.rb +1 -1
- data/lib/net/ssh/proxy/errors.rb +1 -1
- data/lib/net/ssh/proxy/http.rb +1 -1
- data/lib/net/ssh/proxy/socks4.rb +1 -1
- data/lib/net/ssh/proxy/socks5.rb +1 -1
- data/lib/net/ssh/service/forward/driver.rb +1 -1
- data/lib/net/ssh/service/forward/local-network-handler.rb +1 -1
- data/lib/net/ssh/service/forward/remote-network-handler.rb +1 -1
- data/lib/net/ssh/service/forward/services.rb +1 -1
- data/lib/net/ssh/service/process/driver.rb +1 -1
- data/lib/net/ssh/service/process/open.rb +1 -1
- data/lib/net/ssh/service/process/popen3.rb +20 -2
- data/lib/net/ssh/service/process/services.rb +1 -1
- data/lib/net/ssh/service/services.rb +3 -1
- data/lib/net/ssh/service/shell/driver.rb +86 -0
- data/lib/net/ssh/service/shell/services.rb +54 -0
- data/lib/net/ssh/service/shell/shell.rb +213 -0
- data/lib/net/ssh/service/shell/sync.rb +114 -0
- data/lib/net/ssh/session.rb +9 -1
- data/lib/net/ssh/transport/algorithm-negotiator.rb +1 -1
- data/lib/net/ssh/transport/compress/compressor.rb +1 -1
- data/lib/net/ssh/transport/compress/decompressor.rb +1 -1
- data/lib/net/ssh/transport/compress/none-compressor.rb +1 -1
- data/lib/net/ssh/transport/compress/none-decompressor.rb +1 -1
- data/lib/net/ssh/transport/compress/services.rb +1 -1
- data/lib/net/ssh/transport/compress/zlib-compressor.rb +1 -1
- data/lib/net/ssh/transport/compress/zlib-decompressor.rb +1 -1
- data/lib/net/ssh/transport/constants.rb +1 -1
- data/lib/net/ssh/transport/errors.rb +1 -1
- data/lib/net/ssh/transport/identity-cipher.rb +1 -1
- data/lib/net/ssh/transport/kex/dh-gex.rb +1 -1
- data/lib/net/ssh/transport/kex/dh.rb +1 -1
- data/lib/net/ssh/transport/kex/services.rb +1 -1
- data/lib/net/ssh/transport/ossl/buffer-factory.rb +1 -1
- data/lib/net/ssh/transport/ossl/buffer.rb +1 -1
- data/lib/net/ssh/transport/ossl/cipher-factory.rb +1 -1
- data/lib/net/ssh/transport/ossl/digest-factory.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac-factory.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/hmac.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/md5-96.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/md5.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/none.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/services.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/sha1-96.rb +1 -1
- data/lib/net/ssh/transport/ossl/hmac/sha1.rb +1 -1
- data/lib/net/ssh/transport/ossl/key-factory.rb +5 -2
- data/lib/net/ssh/transport/ossl/services.rb +1 -1
- data/lib/net/ssh/transport/packet-stream.rb +1 -1
- data/lib/net/ssh/transport/services.rb +1 -1
- data/lib/net/ssh/transport/session.rb +10 -1
- data/lib/net/ssh/transport/version-negotiator.rb +1 -1
- data/lib/net/ssh/userauth/agent.rb +1 -1
- data/lib/net/ssh/userauth/constants.rb +1 -1
- data/lib/net/ssh/userauth/driver.rb +1 -1
- data/lib/net/ssh/userauth/methods/hostbased.rb +1 -1
- data/lib/net/ssh/userauth/methods/keyboard-interactive.rb +104 -0
- data/lib/net/ssh/userauth/methods/password.rb +1 -1
- data/lib/net/ssh/userauth/methods/publickey.rb +1 -1
- data/lib/net/ssh/userauth/methods/services.rb +28 -6
- data/lib/net/ssh/userauth/services.rb +8 -5
- data/lib/net/ssh/userauth/userkeys.rb +1 -1
- data/lib/net/ssh/util/buffer.rb +1 -1
- data/lib/net/ssh/util/openssl.rb +1 -1
- data/lib/net/ssh/util/prompter.rb +1 -1
- data/lib/net/ssh/version.rb +2 -2
- data/test/ALL-TESTS.rb +1 -1
- data/test/connection/tc_channel.rb +1 -1
- data/test/connection/tc_driver.rb +1 -1
- data/test/connection/tc_integration.rb +1 -1
- data/test/proxy/tc_http.rb +1 -1
- data/test/proxy/tc_socks4.rb +1 -1
- data/test/proxy/tc_socks5.rb +1 -1
- data/test/service/forward/tc_driver.rb +1 -1
- data/test/service/forward/tc_local_network_handler.rb +1 -1
- data/test/service/forward/tc_remote_network_handler.rb +1 -1
- data/test/service/process/tc_driver.rb +1 -1
- data/test/service/process/tc_integration.rb +1 -1
- data/test/service/process/tc_open.rb +1 -1
- data/test/service/process/tc_popen3.rb +13 -13
- data/test/tc_integration.rb +1 -1
- data/test/transport/compress/tc_none_compress.rb +1 -1
- data/test/transport/compress/tc_none_decompress.rb +1 -1
- data/test/transport/compress/tc_zlib_compress.rb +1 -1
- data/test/transport/compress/tc_zlib_decompress.rb +1 -1
- data/test/transport/kex/tc_dh.rb +2 -1
- data/test/transport/kex/tc_dh_gex.rb +1 -1
- data/test/transport/ossl/hmac/tc_hmac.rb +1 -1
- data/test/transport/ossl/hmac/tc_md5.rb +1 -1
- data/test/transport/ossl/hmac/tc_md5_96.rb +1 -1
- data/test/transport/ossl/hmac/tc_none.rb +1 -1
- data/test/transport/ossl/hmac/tc_sha1.rb +1 -1
- data/test/transport/ossl/hmac/tc_sha1_96.rb +1 -1
- data/test/transport/ossl/tc_buffer.rb +1 -1
- data/test/transport/ossl/tc_buffer_factory.rb +1 -1
- data/test/transport/ossl/tc_cipher_factory.rb +1 -1
- data/test/transport/ossl/tc_digest_factory.rb +1 -1
- data/test/transport/ossl/tc_hmac_factory.rb +1 -1
- data/test/transport/ossl/tc_key_factory.rb +1 -1
- data/test/transport/tc_algorithm_negotiator.rb +1 -1
- data/test/transport/tc_identity_cipher.rb +1 -1
- data/test/transport/tc_integration.rb +1 -1
- data/test/transport/tc_packet_stream.rb +1 -1
- data/test/transport/tc_session.rb +1 -1
- data/test/transport/tc_version_negotiator.rb +1 -1
- data/test/userauth/methods/tc_hostbased.rb +1 -1
- data/test/userauth/methods/tc_password.rb +1 -1
- data/test/userauth/methods/tc_publickey.rb +1 -1
- data/test/userauth/tc_agent.rb +1 -1
- data/test/userauth/tc_driver.rb +1 -1
- data/test/userauth/tc_integration.rb +15 -1
- data/test/userauth/tc_userkeys.rb +1 -1
- data/test/util/tc_buffer.rb +5 -5
- 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
|
data/lib/net/ssh/session.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#--
|
2
2
|
# =============================================================================
|
3
|
-
# Copyright (c) 2004, Jamis Buck (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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 (
|
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
|
-
|
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 (
|
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 (
|
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 (
|
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 (
|
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
|