The implementation of the operations available to version 5 of the SFTP protocol.
Methods
Classes and Modules
Module Net::SFTP::Protocol::V_05::Impl::ACEConstants
| F_CREATE_NEW | = | 0x00000000 |
| F_CREATE_TRUNCATE | = | 0x00000001 |
| F_OPEN_EXISTING | = | 0x00000002 |
| F_OPEN_OR_CREATE | = | 0x00000003 |
| F_TRUNCATE_EXISTING | = | 0x00000004 |
| F_APPEND_DATA | = | 0x00000008 |
| F_APPEND_DATA_ATOMIC | = | 0x00000010 |
| F_TEXT_MODE | = | 0x00000020 |
| F_READ_LOCK | = | 0x00000040 |
| F_WRITE_LOCK | = | 0x00000080 |
| F_DELETE_LOCK | = | 0x00000100 |
Public Instance methods
The open operation changed in version 4. This method keeps the same interface as previous versions, but changes how the parameters are interpreted and converted into a packet.
[ show source ]
# File lib/net/sftp/protocol/05/impl.rb, line 61
61: def open( id, path, flags, mode=0660 )
62: sftp_flags, desired_access = case
63: when flags & IO::WRONLY != 0 then
64: [ F_CREATE_TRUNCATE,
65: ACE::F_WRITE_DATA | ACE::F_WRITE_ATTRIBUTES ]
66: when flags & IO::RDWR != 0 then
67: [ F_OPEN_OR_CREATE,
68: ACE::F_READ_DATA | ACE::F_READ_ATTRIBUTES |
69: ACE::F_WRITE_DATA | ACE::F_WRITE_ATTRIBUTES ]
70: when flags & IO::APPEND != 0 then
71: [ F_OPEN_OR_CREATE | F_APPEND_DATA,
72: ACE::F_WRITE_DATA | ACE::F_WRITE_ATTRIBUTES |
73: ACE::F_APPEND_DATA ]
74: else
75: [ F_OPEN_EXISTING,
76: ACE::F_READ_DATA | ACE::F_READ_ATTRIBUTES ]
77: end
78:
79: sftp_flags |= F_OPEN_OR_CREATE if flags & IO::CREAT != 0
80: sftp_flags |= F_TRUNCATE_EXISTING if flags & IO::TRUNC != 0
81:
82: attributes = @attr_factory.empty
83: attributes.permissions = mode
84:
85: open_raw id, path, desired_access, sftp_flags, attributes
86: end