Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

Commit

Permalink
Handle nil keyboard interactive authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Sep 16, 2016
1 parent 141ede3 commit f7e9a7a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mole/cmd/mole/ssh.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"errors"
"fmt"
"net"

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit f7e9a7a

Please sign in to comment.