|
@@ -158,7 +158,7 @@ func TestUploadResumeInvalidOffset(t *testing.T) {
|
|
|
Username: "testuser",
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
- conn := common.NewBaseConnection("", common.ProtocolSFTP, user)
|
|
|
+ conn := common.NewBaseConnection("", common.ProtocolSFTP, "", user)
|
|
|
baseTransfer := common.NewBaseTransfer(file, conn, nil, file.Name(), file.Name(), testfile, common.TransferUpload, 10, 0, 0, false, fs)
|
|
|
transfer := newTransfer(baseTransfer, nil, nil, nil)
|
|
|
_, err = transfer.WriteAt([]byte("test"), 0)
|
|
@@ -186,7 +186,7 @@ func TestReadWriteErrors(t *testing.T) {
|
|
|
Username: "testuser",
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
- conn := common.NewBaseConnection("", common.ProtocolSFTP, user)
|
|
|
+ conn := common.NewBaseConnection("", common.ProtocolSFTP, "", user)
|
|
|
baseTransfer := common.NewBaseTransfer(file, conn, nil, file.Name(), file.Name(), testfile, common.TransferDownload, 0, 0, 0, false, fs)
|
|
|
transfer := newTransfer(baseTransfer, nil, nil, nil)
|
|
|
err = file.Close()
|
|
@@ -234,7 +234,7 @@ func TestReadWriteErrors(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
func TestUnsupportedListOP(t *testing.T) {
|
|
|
- conn := common.NewBaseConnection("", common.ProtocolSFTP, dataprovider.User{})
|
|
|
+ conn := common.NewBaseConnection("", common.ProtocolSFTP, "", dataprovider.User{})
|
|
|
sftpConn := Connection{
|
|
|
BaseConnection: conn,
|
|
|
}
|
|
@@ -255,7 +255,7 @@ func TestTransferCancelFn(t *testing.T) {
|
|
|
Username: "testuser",
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
- conn := common.NewBaseConnection("", common.ProtocolSFTP, user)
|
|
|
+ conn := common.NewBaseConnection("", common.ProtocolSFTP, "", user)
|
|
|
baseTransfer := common.NewBaseTransfer(file, conn, cancelFn, file.Name(), file.Name(), testfile, common.TransferDownload, 0, 0, 0, false, fs)
|
|
|
transfer := newTransfer(baseTransfer, nil, nil, nil)
|
|
|
|
|
@@ -279,7 +279,7 @@ func TestUploadFiles(t *testing.T) {
|
|
|
fs := vfs.NewOsFs("123", os.TempDir(), "")
|
|
|
u := dataprovider.User{}
|
|
|
c := Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, u),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", u),
|
|
|
}
|
|
|
var flags sftp.FileOpenFlags
|
|
|
flags.Write = true
|
|
@@ -331,7 +331,7 @@ func TestWithInvalidHome(t *testing.T) {
|
|
|
fs, err := u.GetFilesystem("123")
|
|
|
assert.NoError(t, err)
|
|
|
c := Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, u),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", u),
|
|
|
}
|
|
|
_, err = fs.ResolvePath("../upper_path")
|
|
|
assert.Error(t, err, "tested path is not a home subdir")
|
|
@@ -366,7 +366,7 @@ func TestSFTPGetUsedQuota(t *testing.T) {
|
|
|
u.Permissions = make(map[string][]string)
|
|
|
u.Permissions["/"] = []string{dataprovider.PermAny}
|
|
|
connection := Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, u),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", u),
|
|
|
}
|
|
|
quotaResult := connection.HasSpace(false, false, "/")
|
|
|
assert.False(t, quotaResult.HasSpace)
|
|
@@ -463,7 +463,7 @@ func TestSSHCommandErrors(t *testing.T) {
|
|
|
user.Permissions = make(map[string][]string)
|
|
|
user.Permissions["/"] = []string{dataprovider.PermAny}
|
|
|
connection := Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSSH, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSSH, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
cmd := sshCommand{
|
|
@@ -601,7 +601,7 @@ func TestCommandsWithExtensionsFilter(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSSH, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSSH, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
cmd := sshCommand{
|
|
@@ -662,7 +662,7 @@ func TestSSHCommandsRemoteFs(t *testing.T) {
|
|
|
},
|
|
|
}
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
cmd := sshCommand{
|
|
@@ -707,7 +707,7 @@ func TestSSHCmdGetFsErrors(t *testing.T) {
|
|
|
user.Permissions = map[string][]string{}
|
|
|
user.Permissions["/"] = []string{dataprovider.PermAny}
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
cmd := sshCommand{
|
|
@@ -758,7 +758,7 @@ func TestGitVirtualFolders(t *testing.T) {
|
|
|
HomeDir: os.TempDir(),
|
|
|
}
|
|
|
conn := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
cmd := sshCommand{
|
|
|
command: "git-receive-pack",
|
|
@@ -804,7 +804,7 @@ func TestRsyncOptions(t *testing.T) {
|
|
|
HomeDir: os.TempDir(),
|
|
|
}
|
|
|
conn := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
sshCmd := sshCommand{
|
|
|
command: "rsync",
|
|
@@ -821,7 +821,7 @@ func TestRsyncOptions(t *testing.T) {
|
|
|
user.Permissions = permissions
|
|
|
|
|
|
conn = &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
sshCmd = sshCommand{
|
|
|
command: "rsync",
|
|
@@ -853,7 +853,7 @@ func TestSystemCommandSizeForPath(t *testing.T) {
|
|
|
fs, err := user.GetFilesystem("123")
|
|
|
assert.NoError(t, err)
|
|
|
conn := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
sshCmd := sshCommand{
|
|
|
command: "rsync",
|
|
@@ -915,7 +915,7 @@ func TestSystemCommandErrors(t *testing.T) {
|
|
|
fs, err := user.GetFilesystem("123")
|
|
|
assert.NoError(t, err)
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
var sshCmd sshCommand
|
|
@@ -991,7 +991,7 @@ func TestCommandGetFsError(t *testing.T) {
|
|
|
},
|
|
|
}
|
|
|
conn := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
sshCmd := sshCommand{
|
|
|
command: "rsync",
|
|
@@ -1009,7 +1009,7 @@ func TestCommandGetFsError(t *testing.T) {
|
|
|
ReadError: nil,
|
|
|
}
|
|
|
conn = &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1101,7 +1101,7 @@ func TestSCPUploadError(t *testing.T) {
|
|
|
user.Permissions["/"] = []string{dataprovider.PermAny}
|
|
|
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1140,7 +1140,7 @@ func TestSCPInvalidEndDir(t *testing.T) {
|
|
|
StdErrBuffer: bytes.NewBuffer(stdErrBuf),
|
|
|
}
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, dataprovider.User{
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", dataprovider.User{
|
|
|
HomeDir: os.TempDir(),
|
|
|
}),
|
|
|
channel: &mockSSHChannel,
|
|
@@ -1166,7 +1166,7 @@ func TestSCPParseUploadMessage(t *testing.T) {
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, dataprovider.User{
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", dataprovider.User{
|
|
|
HomeDir: os.TempDir(),
|
|
|
}),
|
|
|
channel: &mockSSHChannel,
|
|
@@ -1203,7 +1203,7 @@ func TestSCPProtocolMessages(t *testing.T) {
|
|
|
WriteError: writeErr,
|
|
|
}
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, dataprovider.User{}),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", dataprovider.User{}),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1264,7 +1264,7 @@ func TestSCPTestDownloadProtocolMessages(t *testing.T) {
|
|
|
WriteError: writeErr,
|
|
|
}
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, dataprovider.User{}),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", dataprovider.User{}),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1338,7 +1338,7 @@ func TestSCPCommandHandleErrors(t *testing.T) {
|
|
|
assert.NoError(t, err)
|
|
|
}()
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, dataprovider.User{}),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", dataprovider.User{}),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1379,7 +1379,7 @@ func TestSCPErrorsMockFs(t *testing.T) {
|
|
|
}()
|
|
|
connection := &Connection{
|
|
|
channel: &mockSSHChannel,
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, u),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", u),
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
|
sshCommand: sshCommand{
|
|
@@ -1421,7 +1421,7 @@ func TestSCPRecursiveDownloadErrors(t *testing.T) {
|
|
|
}()
|
|
|
fs := vfs.NewOsFs("123", os.TempDir(), "")
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, dataprovider.User{
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", dataprovider.User{
|
|
|
HomeDir: os.TempDir(),
|
|
|
}),
|
|
|
channel: &mockSSHChannel,
|
|
@@ -1467,7 +1467,7 @@ func TestSCPRecursiveUploadErrors(t *testing.T) {
|
|
|
WriteError: writeErr,
|
|
|
}
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, dataprovider.User{}),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", dataprovider.User{}),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1508,7 +1508,7 @@ func TestSCPCreateDirs(t *testing.T) {
|
|
|
fs, err := u.GetFilesystem("123")
|
|
|
assert.NoError(t, err)
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, u),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", u),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1542,7 +1542,7 @@ func TestSCPDownloadFileData(t *testing.T) {
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, dataprovider.User{HomeDir: os.TempDir()}),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", dataprovider.User{HomeDir: os.TempDir()}),
|
|
|
channel: &mockSSHChannelReadErr,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1592,7 +1592,7 @@ func TestSCPUploadFiledata(t *testing.T) {
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", user),
|
|
|
channel: &mockSSHChannel,
|
|
|
}
|
|
|
scpCommand := scpCommand{
|
|
@@ -1681,7 +1681,7 @@ func TestUploadError(t *testing.T) {
|
|
|
}
|
|
|
fs := vfs.NewOsFs("", os.TempDir(), "")
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSCP, "", user),
|
|
|
}
|
|
|
|
|
|
testfile := "testfile"
|
|
@@ -1725,7 +1725,7 @@ func TestTransferFailingReader(t *testing.T) {
|
|
|
|
|
|
fs := newMockOsFs(nil, nil, true, "", os.TempDir())
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
|
|
|
request := sftp.NewRequest("Open", "afile.txt")
|
|
@@ -1884,7 +1884,7 @@ func TestRecursiveCopyErrors(t *testing.T) {
|
|
|
fs, err := user.GetFilesystem("123")
|
|
|
assert.NoError(t, err)
|
|
|
conn := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, user),
|
|
|
+ BaseConnection: common.NewBaseConnection("", common.ProtocolSFTP, "", user),
|
|
|
}
|
|
|
sshCmd := sshCommand{
|
|
|
command: "sftpgo-copy",
|
|
@@ -1933,7 +1933,7 @@ func TestRecoverer(t *testing.T) {
|
|
|
c.AcceptInboundConnection(nil, nil)
|
|
|
connID := "connectionID"
|
|
|
connection := &Connection{
|
|
|
- BaseConnection: common.NewBaseConnection(connID, common.ProtocolSFTP, dataprovider.User{}),
|
|
|
+ BaseConnection: common.NewBaseConnection(connID, common.ProtocolSFTP, "", dataprovider.User{}),
|
|
|
}
|
|
|
c.handleSftpConnection(nil, connection)
|
|
|
sshCmd := sshCommand{
|