sftpd test: add a debug log

The git push test sometime fails when running on travis.
The issue cannot be replicated locally so print the logs to try to
understand what is happening
This commit is contained in:
Nicola Murino
2019-12-29 23:27:32 +01:00
parent 80e9902324
commit 20606a0043
2 changed files with 34 additions and 6 deletions

View File

@@ -353,6 +353,9 @@ func buildUserHomeDir(user *User) {
}
func validatePermissions(user *User) error {
if len(user.Permissions) == 0 {
return &ValidationError{err: "Please grant some permissions to this user"}
}
permissions := make(map[string][]string)
if _, ok := user.Permissions["/"]; !ok {
return &ValidationError{err: fmt.Sprintf("Permissions for the root dir \"/\" must be set")}
@@ -391,9 +394,6 @@ func validateUser(user *User) error {
if len(user.Password) == 0 && len(user.PublicKeys) == 0 {
return &ValidationError{err: "Please set a password or at least a public_key"}
}
if len(user.Permissions) == 0 {
return &ValidationError{err: "Please grant some permissions to this user"}
}
if !filepath.IsAbs(user.HomeDir) {
return &ValidationError{err: fmt.Sprintf("home_dir must be an absolute path, actual value: %v", user.HomeDir)}
}