From f7e9a7a832f488d6e79b49f2ae34d1b995edf303 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Fri, 16 Sep 2016 08:42:00 +0200 Subject: [PATCH] Handle nil keyboard interactive authentication --- src/mole/cmd/mole/ssh.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mole/cmd/mole/ssh.go b/src/mole/cmd/mole/ssh.go index 808f2a1..5af2761 100644 --- a/src/mole/cmd/mole/ssh.go +++ b/src/mole/cmd/mole/ssh.go @@ -1,7 +1,6 @@ package main import ( - "errors" "fmt" "net" @@ -82,8 +81,11 @@ func sshHost(host string, cfg *conf.Config) (*ssh.Client, error) { func kbdInteractive(secret string) ssh.KeyboardInteractiveChallenge { return func(user, instruction string, questions []string, echos []bool) (answers []string, err error) { + if len(questions) == 0 { + return nil, nil + } if len(questions) != 1 { - return nil, errors.New("too complex questionnaire") + return nil, fmt.Errorf("too complex questionnaire: %#v", questions) } return []string{secret}, nil }