mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
keyboard interactive auth: respect hook disabled setting
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -3742,8 +3742,12 @@ func executeKeyboardInteractiveProgram(user *User, authHook string, client ssh.K
|
|||||||
}
|
}
|
||||||
|
|
||||||
func doKeyboardInteractiveAuth(user *User, authHook string, client ssh.KeyboardInteractiveChallenge, ip, protocol string) (User, error) {
|
func doKeyboardInteractiveAuth(user *User, authHook string, client ssh.KeyboardInteractiveChallenge, ip, protocol string) (User, error) {
|
||||||
|
if err := user.LoadAndApplyGroupSettings(); err != nil {
|
||||||
|
return *user, err
|
||||||
|
}
|
||||||
var authResult int
|
var authResult int
|
||||||
var err error
|
var err error
|
||||||
|
if !user.Filters.Hooks.ExternalAuthDisabled {
|
||||||
if plugin.Handler.HasAuthScope(plugin.AuthScopeKeyboardInteractive) {
|
if plugin.Handler.HasAuthScope(plugin.AuthScopeKeyboardInteractive) {
|
||||||
authResult, err = executeKeyboardInteractivePlugin(user, client, ip, protocol)
|
authResult, err = executeKeyboardInteractivePlugin(user, client, ip, protocol)
|
||||||
if authResult == 1 && err == nil {
|
if authResult == 1 && err == nil {
|
||||||
@@ -3758,16 +3762,15 @@ func doKeyboardInteractiveAuth(user *User, authHook string, client ssh.KeyboardI
|
|||||||
} else {
|
} else {
|
||||||
authResult, err = doBuiltinKeyboardInteractiveAuth(user, client, ip, protocol)
|
authResult, err = doBuiltinKeyboardInteractiveAuth(user, client, ip, protocol)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
authResult, err = doBuiltinKeyboardInteractiveAuth(user, client, ip, protocol)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return *user, err
|
return *user, err
|
||||||
}
|
}
|
||||||
if authResult != 1 {
|
if authResult != 1 {
|
||||||
return *user, fmt.Errorf("keyboard interactive auth failed, result: %v", authResult)
|
return *user, fmt.Errorf("keyboard interactive auth failed, result: %v", authResult)
|
||||||
}
|
}
|
||||||
err = user.LoadAndApplyGroupSettings()
|
|
||||||
if err != nil {
|
|
||||||
return *user, err
|
|
||||||
}
|
|
||||||
err = user.CheckLoginConditions()
|
err = user.CheckLoginConditions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return *user, err
|
return *user, err
|
||||||
|
|||||||
Reference in New Issue
Block a user