mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-24 01:04:39 +01:00
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:
parent
71dd675c7c
commit
7b95dde25f
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue