Class: HrrRbSftp::Protocol::Version3::Extensions::PosixRenameAtOpensshCom
- Inherits:
-
Extension
- Object
- Extension
- HrrRbSftp::Protocol::Version3::Extensions::PosixRenameAtOpensshCom
- Defined in:
- lib/hrr_rb_sftp/protocol/version3/extensions/posix_rename_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 |
# File 'lib/hrr_rb_sftp/protocol/version3/extensions/posix_rename_at_openssh_com.rb', line 39 def respond_to request begin oldpath = request[:"oldpath"] newpath = request[:"newpath"] log_debug { "File.rename(#{oldpath.inspect}, #{newpath.inspect})" } File.rename(oldpath, 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" => "", } end end |