mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
add rsync support ...
and better document quota management issues for system commands. rsync and git are not enabled in the default config so don't install them in sample Dockerfiles, simply add a comment to facilitate their installation if needed Fixes #44
This commit is contained in:
@@ -431,6 +431,46 @@ func TestSSHCommandQuotaScan(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRsyncOptions(t *testing.T) {
|
||||
conn := Connection{
|
||||
User: dataprovider.User{
|
||||
Permissions: []string{dataprovider.PermAny},
|
||||
HomeDir: os.TempDir(),
|
||||
},
|
||||
}
|
||||
sshCmd := sshCommand{
|
||||
command: "rsync",
|
||||
connection: conn,
|
||||
args: []string{"--server", "-vlogDtprze.iLsfxC", ".", "/"},
|
||||
}
|
||||
cmd, err := sshCmd.getSystemCommand()
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if !utils.IsStringInSlice("--safe-links", cmd.cmd.Args) {
|
||||
t.Errorf("--safe-links must be added if the user has the create symlinks permission")
|
||||
}
|
||||
conn = Connection{
|
||||
User: dataprovider.User{
|
||||
Permissions: []string{dataprovider.PermDownload, dataprovider.PermUpload, dataprovider.PermCreateDirs,
|
||||
dataprovider.PermListItems, dataprovider.PermOverwrite, dataprovider.PermDelete, dataprovider.PermRename},
|
||||
HomeDir: os.TempDir(),
|
||||
},
|
||||
}
|
||||
sshCmd = sshCommand{
|
||||
command: "rsync",
|
||||
connection: conn,
|
||||
args: []string{"--server", "-vlogDtprze.iLsfxC", ".", "/"},
|
||||
}
|
||||
cmd, err = sshCmd.getSystemCommand()
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if !utils.IsStringInSlice("--munge-links", cmd.cmd.Args) {
|
||||
t.Errorf("--munge-links must be added if the user has the create symlinks permission")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSystemCommandErrors(t *testing.T) {
|
||||
buf := make([]byte, 65535)
|
||||
stdErrBuf := make([]byte, 65535)
|
||||
|
||||
Reference in New Issue
Block a user