forked from TrueCloudLab/rclone
vendor: update all dependencies
This commit is contained in:
parent
17b4058ee9
commit
abb9f89f65
443 changed files with 32118 additions and 18237 deletions
246
vendor/github.com/pkg/sftp/sftp.go
generated
vendored
246
vendor/github.com/pkg/sftp/sftp.go
generated
vendored
|
@ -9,139 +9,148 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
ssh_FXP_INIT = 1
|
||||
ssh_FXP_VERSION = 2
|
||||
ssh_FXP_OPEN = 3
|
||||
ssh_FXP_CLOSE = 4
|
||||
ssh_FXP_READ = 5
|
||||
ssh_FXP_WRITE = 6
|
||||
ssh_FXP_LSTAT = 7
|
||||
ssh_FXP_FSTAT = 8
|
||||
ssh_FXP_SETSTAT = 9
|
||||
ssh_FXP_FSETSTAT = 10
|
||||
ssh_FXP_OPENDIR = 11
|
||||
ssh_FXP_READDIR = 12
|
||||
ssh_FXP_REMOVE = 13
|
||||
ssh_FXP_MKDIR = 14
|
||||
ssh_FXP_RMDIR = 15
|
||||
ssh_FXP_REALPATH = 16
|
||||
ssh_FXP_STAT = 17
|
||||
ssh_FXP_RENAME = 18
|
||||
ssh_FXP_READLINK = 19
|
||||
ssh_FXP_SYMLINK = 20
|
||||
ssh_FXP_STATUS = 101
|
||||
ssh_FXP_HANDLE = 102
|
||||
ssh_FXP_DATA = 103
|
||||
ssh_FXP_NAME = 104
|
||||
ssh_FXP_ATTRS = 105
|
||||
ssh_FXP_EXTENDED = 200
|
||||
ssh_FXP_EXTENDED_REPLY = 201
|
||||
sshFxpInit = 1
|
||||
sshFxpVersion = 2
|
||||
sshFxpOpen = 3
|
||||
sshFxpClose = 4
|
||||
sshFxpRead = 5
|
||||
sshFxpWrite = 6
|
||||
sshFxpLstat = 7
|
||||
sshFxpFstat = 8
|
||||
sshFxpSetstat = 9
|
||||
sshFxpFsetstat = 10
|
||||
sshFxpOpendir = 11
|
||||
sshFxpReaddir = 12
|
||||
sshFxpRemove = 13
|
||||
sshFxpMkdir = 14
|
||||
sshFxpRmdir = 15
|
||||
sshFxpRealpath = 16
|
||||
sshFxpStat = 17
|
||||
sshFxpRename = 18
|
||||
sshFxpReadlink = 19
|
||||
sshFxpSymlink = 20
|
||||
sshFxpStatus = 101
|
||||
sshFxpHandle = 102
|
||||
sshFxpData = 103
|
||||
sshFxpName = 104
|
||||
sshFxpAttrs = 105
|
||||
sshFxpExtended = 200
|
||||
sshFxpExtendedReply = 201
|
||||
)
|
||||
|
||||
const (
|
||||
ssh_FX_OK = 0
|
||||
ssh_FX_EOF = 1
|
||||
ssh_FX_NO_SUCH_FILE = 2
|
||||
ssh_FX_PERMISSION_DENIED = 3
|
||||
ssh_FX_FAILURE = 4
|
||||
ssh_FX_BAD_MESSAGE = 5
|
||||
ssh_FX_NO_CONNECTION = 6
|
||||
ssh_FX_CONNECTION_LOST = 7
|
||||
ssh_FX_OP_UNSUPPORTED = 8
|
||||
sshFxOk = 0
|
||||
sshFxEOF = 1
|
||||
sshFxNoSuchFile = 2
|
||||
sshFxPermissionDenied = 3
|
||||
sshFxFailure = 4
|
||||
sshFxBadMessage = 5
|
||||
sshFxNoConnection = 6
|
||||
sshFxConnectionLost = 7
|
||||
sshFxOPUnsupported = 8
|
||||
|
||||
// see draft-ietf-secsh-filexfer-13
|
||||
// https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.1
|
||||
ssh_FX_INVALID_HANDLE = 9
|
||||
ssh_FX_NO_SUCH_PATH = 10
|
||||
ssh_FX_FILE_ALREADY_EXISTS = 11
|
||||
ssh_FX_WRITE_PROTECT = 12
|
||||
ssh_FX_NO_MEDIA = 13
|
||||
ssh_FX_NO_SPACE_ON_FILESYSTEM = 14
|
||||
ssh_FX_QUOTA_EXCEEDED = 15
|
||||
ssh_FX_UNKNOWN_PRINCIPAL = 16
|
||||
ssh_FX_LOCK_CONFLICT = 17
|
||||
ssh_FX_DIR_NOT_EMPTY = 18
|
||||
ssh_FX_NOT_A_DIRECTORY = 19
|
||||
ssh_FX_INVALID_FILENAME = 20
|
||||
ssh_FX_LINK_LOOP = 21
|
||||
ssh_FX_CANNOT_DELETE = 22
|
||||
ssh_FX_INVALID_PARAMETER = 23
|
||||
ssh_FX_FILE_IS_A_DIRECTORY = 24
|
||||
ssh_FX_BYTE_RANGE_LOCK_CONFLICT = 25
|
||||
ssh_FX_BYTE_RANGE_LOCK_REFUSED = 26
|
||||
ssh_FX_DELETE_PENDING = 27
|
||||
ssh_FX_FILE_CORRUPT = 28
|
||||
ssh_FX_OWNER_INVALID = 29
|
||||
ssh_FX_GROUP_INVALID = 30
|
||||
ssh_FX_NO_MATCHING_BYTE_RANGE_LOCK = 31
|
||||
sshFxInvalidHandle = 9
|
||||
sshFxNoSuchPath = 10
|
||||
sshFxFileAlreadyExists = 11
|
||||
sshFxWriteProtect = 12
|
||||
sshFxNoMedia = 13
|
||||
sshFxNoSpaceOnFilesystem = 14
|
||||
sshFxQuotaExceeded = 15
|
||||
sshFxUnlnownPrincipal = 16
|
||||
sshFxLockConflict = 17
|
||||
sshFxDitNotEmpty = 18
|
||||
sshFxNotADirectory = 19
|
||||
sshFxInvalidFilename = 20
|
||||
sshFxLinkLoop = 21
|
||||
sshFxCannotDelete = 22
|
||||
sshFxInvalidParameter = 23
|
||||
sshFxFileIsADirectory = 24
|
||||
sshFxByteRangeLockConflict = 25
|
||||
sshFxByteRangeLockRefused = 26
|
||||
sshFxDeletePending = 27
|
||||
sshFxFileCorrupt = 28
|
||||
sshFxOwnerInvalid = 29
|
||||
sshFxGroupInvalid = 30
|
||||
sshFxNoMatchingByteRangeLock = 31
|
||||
)
|
||||
|
||||
const (
|
||||
ssh_FXF_READ = 0x00000001
|
||||
ssh_FXF_WRITE = 0x00000002
|
||||
ssh_FXF_APPEND = 0x00000004
|
||||
ssh_FXF_CREAT = 0x00000008
|
||||
ssh_FXF_TRUNC = 0x00000010
|
||||
ssh_FXF_EXCL = 0x00000020
|
||||
sshFxfRead = 0x00000001
|
||||
sshFxfWrite = 0x00000002
|
||||
sshFxfAppend = 0x00000004
|
||||
sshFxfCreat = 0x00000008
|
||||
sshFxfTrunc = 0x00000010
|
||||
sshFxfExcl = 0x00000020
|
||||
)
|
||||
|
||||
var (
|
||||
// supportedSFTPExtensions defines the supported extensions
|
||||
supportedSFTPExtensions = []sshExtensionPair{
|
||||
{"hardlink@openssh.com", "1"},
|
||||
{"posix-rename@openssh.com", "1"},
|
||||
}
|
||||
sftpExtensions = supportedSFTPExtensions
|
||||
)
|
||||
|
||||
type fxp uint8
|
||||
|
||||
func (f fxp) String() string {
|
||||
switch f {
|
||||
case ssh_FXP_INIT:
|
||||
case sshFxpInit:
|
||||
return "SSH_FXP_INIT"
|
||||
case ssh_FXP_VERSION:
|
||||
case sshFxpVersion:
|
||||
return "SSH_FXP_VERSION"
|
||||
case ssh_FXP_OPEN:
|
||||
case sshFxpOpen:
|
||||
return "SSH_FXP_OPEN"
|
||||
case ssh_FXP_CLOSE:
|
||||
case sshFxpClose:
|
||||
return "SSH_FXP_CLOSE"
|
||||
case ssh_FXP_READ:
|
||||
case sshFxpRead:
|
||||
return "SSH_FXP_READ"
|
||||
case ssh_FXP_WRITE:
|
||||
case sshFxpWrite:
|
||||
return "SSH_FXP_WRITE"
|
||||
case ssh_FXP_LSTAT:
|
||||
case sshFxpLstat:
|
||||
return "SSH_FXP_LSTAT"
|
||||
case ssh_FXP_FSTAT:
|
||||
case sshFxpFstat:
|
||||
return "SSH_FXP_FSTAT"
|
||||
case ssh_FXP_SETSTAT:
|
||||
case sshFxpSetstat:
|
||||
return "SSH_FXP_SETSTAT"
|
||||
case ssh_FXP_FSETSTAT:
|
||||
case sshFxpFsetstat:
|
||||
return "SSH_FXP_FSETSTAT"
|
||||
case ssh_FXP_OPENDIR:
|
||||
case sshFxpOpendir:
|
||||
return "SSH_FXP_OPENDIR"
|
||||
case ssh_FXP_READDIR:
|
||||
case sshFxpReaddir:
|
||||
return "SSH_FXP_READDIR"
|
||||
case ssh_FXP_REMOVE:
|
||||
case sshFxpRemove:
|
||||
return "SSH_FXP_REMOVE"
|
||||
case ssh_FXP_MKDIR:
|
||||
case sshFxpMkdir:
|
||||
return "SSH_FXP_MKDIR"
|
||||
case ssh_FXP_RMDIR:
|
||||
case sshFxpRmdir:
|
||||
return "SSH_FXP_RMDIR"
|
||||
case ssh_FXP_REALPATH:
|
||||
case sshFxpRealpath:
|
||||
return "SSH_FXP_REALPATH"
|
||||
case ssh_FXP_STAT:
|
||||
case sshFxpStat:
|
||||
return "SSH_FXP_STAT"
|
||||
case ssh_FXP_RENAME:
|
||||
case sshFxpRename:
|
||||
return "SSH_FXP_RENAME"
|
||||
case ssh_FXP_READLINK:
|
||||
case sshFxpReadlink:
|
||||
return "SSH_FXP_READLINK"
|
||||
case ssh_FXP_SYMLINK:
|
||||
case sshFxpSymlink:
|
||||
return "SSH_FXP_SYMLINK"
|
||||
case ssh_FXP_STATUS:
|
||||
case sshFxpStatus:
|
||||
return "SSH_FXP_STATUS"
|
||||
case ssh_FXP_HANDLE:
|
||||
case sshFxpHandle:
|
||||
return "SSH_FXP_HANDLE"
|
||||
case ssh_FXP_DATA:
|
||||
case sshFxpData:
|
||||
return "SSH_FXP_DATA"
|
||||
case ssh_FXP_NAME:
|
||||
case sshFxpName:
|
||||
return "SSH_FXP_NAME"
|
||||
case ssh_FXP_ATTRS:
|
||||
case sshFxpAttrs:
|
||||
return "SSH_FXP_ATTRS"
|
||||
case ssh_FXP_EXTENDED:
|
||||
case sshFxpExtended:
|
||||
return "SSH_FXP_EXTENDED"
|
||||
case ssh_FXP_EXTENDED_REPLY:
|
||||
case sshFxpExtendedReply:
|
||||
return "SSH_FXP_EXTENDED_REPLY"
|
||||
default:
|
||||
return "unknown"
|
||||
|
@ -152,23 +161,23 @@ type fx uint8
|
|||
|
||||
func (f fx) String() string {
|
||||
switch f {
|
||||
case ssh_FX_OK:
|
||||
case sshFxOk:
|
||||
return "SSH_FX_OK"
|
||||
case ssh_FX_EOF:
|
||||
case sshFxEOF:
|
||||
return "SSH_FX_EOF"
|
||||
case ssh_FX_NO_SUCH_FILE:
|
||||
case sshFxNoSuchFile:
|
||||
return "SSH_FX_NO_SUCH_FILE"
|
||||
case ssh_FX_PERMISSION_DENIED:
|
||||
case sshFxPermissionDenied:
|
||||
return "SSH_FX_PERMISSION_DENIED"
|
||||
case ssh_FX_FAILURE:
|
||||
case sshFxFailure:
|
||||
return "SSH_FX_FAILURE"
|
||||
case ssh_FX_BAD_MESSAGE:
|
||||
case sshFxBadMessage:
|
||||
return "SSH_FX_BAD_MESSAGE"
|
||||
case ssh_FX_NO_CONNECTION:
|
||||
case sshFxNoConnection:
|
||||
return "SSH_FX_NO_CONNECTION"
|
||||
case ssh_FX_CONNECTION_LOST:
|
||||
case sshFxConnectionLost:
|
||||
return "SSH_FX_CONNECTION_LOST"
|
||||
case ssh_FX_OP_UNSUPPORTED:
|
||||
case sshFxOPUnsupported:
|
||||
return "SSH_FX_OP_UNSUPPORTED"
|
||||
default:
|
||||
return "unknown"
|
||||
|
@ -214,4 +223,37 @@ type StatusError struct {
|
|||
msg, lang string
|
||||
}
|
||||
|
||||
func (s *StatusError) Error() string { return fmt.Sprintf("sftp: %q (%v)", s.msg, fx(s.Code)) }
|
||||
func (s *StatusError) Error() string {
|
||||
return fmt.Sprintf("sftp: %q (%v)", s.msg, fx(s.Code))
|
||||
}
|
||||
|
||||
// FxCode returns the error code typed to match against the exported codes
|
||||
func (s *StatusError) FxCode() fxerr {
|
||||
return fxerr(s.Code)
|
||||
}
|
||||
|
||||
func getSupportedExtensionByName(extensionName string) (sshExtensionPair, error) {
|
||||
for _, supportedExtension := range supportedSFTPExtensions {
|
||||
if supportedExtension.Name == extensionName {
|
||||
return supportedExtension, nil
|
||||
}
|
||||
}
|
||||
return sshExtensionPair{}, fmt.Errorf("Unsupported extension: %v", extensionName)
|
||||
}
|
||||
|
||||
// SetSFTPExtensions allows to customize the supported server extensions.
|
||||
// See the variable supportedSFTPExtensions for supported extensions.
|
||||
// This method accepts a slice of sshExtensionPair names for example 'hardlink@openssh.com'.
|
||||
// If an invalid extension is given an error will be returned and nothing will be changed
|
||||
func SetSFTPExtensions(extensions ...string) error {
|
||||
tempExtensions := []sshExtensionPair{}
|
||||
for _, extension := range extensions {
|
||||
sftpExtension, err := getSupportedExtensionByName(extension)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tempExtensions = append(tempExtensions, sftpExtension)
|
||||
}
|
||||
sftpExtensions = tempExtensions
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue