Class: HrrRbSftp::Protocol::Version3::Extensions::HardlinkAtOpensshCom
- Inherits:
-
Extension
- Object
- Extension
- HrrRbSftp::Protocol::Version3::Extensions::HardlinkAtOpensshCom
- Defined in:
- lib/hrr_rb_sftp/protocol/version3/extensions/hardlink_at_openssh_com.rb
Overview
This class implements [email protected] version 1 extension format and responder.
Constant Summary collapse
- EXTENSION_NAME =
Represents [email protected] version 1 extension name.
"[email protected]"
- EXTENSION_DATA =
Represents [email protected] version 1 extension data.
"1"
- REQUEST_FORMAT =
Represents SSH_FXP_EXTENDED packet additional format for [email protected] version 1 extension.
{ :"extended-request" => { "[email protected]" => [ [DataTypes::String, :"oldpath"], [DataTypes::String, :"newpath"], ], }, }
Instance Attribute Summary
Attributes included from Loggable
Instance Method Summary collapse
-
#respond_to(request) ⇒ Hash{Symbol=>Object}
Responds to SSH_FXP_EXTENDED request with [email protected] extended-request.
Methods inherited from Extension
#context, #handles, #initialize, #version
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn
Constructor Details
This class inherits a constructor from HrrRbSftp::Protocol::Version3::Extensions::Extension
Instance Method Details
#respond_to(request) ⇒ Hash{Symbol=>Object}
Responds to SSH_FXP_EXTENDED request with [email protected] extended-request.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/hardlink_at_openssh_com.rb', line 39 def respond_to request begin log_debug { "File.link(#{request[:"oldpath"].inspect}, #{request[:"newpath"].inspect})" } File.link(request[:"oldpath"], request[:"newpath"]) { :"type" => Packets::SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => Packets::SSH_FXP_STATUS::SSH_FX_OK, :"error message" => "Success", :"language tag" => "", } rescue Errno::ENOENT => e log_debug { e. } { :"type" => Packets::SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => Packets::SSH_FXP_STATUS::SSH_FX_NO_SUCH_FILE, :"error message" => "No such file or directory", :"language tag" => "", } rescue Errno::EACCES => e log_debug { e. } { :"type" => Packets::SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => Packets::SSH_FXP_STATUS::SSH_FX_PERMISSION_DENIED, :"error message" => "Permission denied", :"language tag" => "", } rescue Errno::EEXIST => e log_debug { e. } { :"type" => Packets::SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => Packets::SSH_FXP_STATUS::SSH_FX_FAILURE, :"error message" => "File exists", :"language tag" => "", } end end |