fix (#426): username case sensitive on sftp

better strategy is to:
1. attempt the login "as is"
2. attempt the lowercase version in case of error
This commit is contained in:
Mickael Kerjean 2022-01-31 23:31:17 +11:00
parent 71dd675c7c
commit 7b95dde25f

View file

@ -38,7 +38,7 @@ func (s Sftp) Init(params map[string]string, app *App) (IBackend, error) {
}{
params["hostname"],
params["port"],
strings.ToLower(params["username"]),
params["username"],
params["password"],
params["passphrase"],
}
@ -126,7 +126,11 @@ func (s Sftp) Init(params map[string]string, app *App) (IBackend, error) {
client, err := ssh.Dial("tcp", addr, config)
if err != nil {
return &s, ErrAuthenticationFailed
config.User = strings.ToLower(p.username)
client, err = ssh.Dial("tcp", addr, config)
if err != nil {
return &s, ErrAuthenticationFailed
}
}
s.SSHClient = client