(t *testing.T)
| 48 | } |
| 49 | |
| 50 | func TestPasswordAuthBadPass(t *testing.T) { |
| 51 | t.Parallel() |
| 52 | l := newLocalListener() |
| 53 | srv := &Server{Handler: func(s Session) {}} |
| 54 | srv.SetOption(PasswordAuth(func(ctx Context, password string) bool { |
| 55 | return false |
| 56 | })) |
| 57 | go srv.serveOnce(l) |
| 58 | _, err := gossh.Dial("tcp", l.Addr().String(), &gossh.ClientConfig{ |
| 59 | User: "testuser", |
| 60 | Auth: []gossh.AuthMethod{ |
| 61 | gossh.Password("testpass"), |
| 62 | }, |
| 63 | HostKeyCallback: gossh.InsecureIgnoreHostKey(), |
| 64 | }) |
| 65 | if err != nil { |
| 66 | if !strings.Contains(err.Error(), "unable to authenticate") { |
| 67 | t.Fatal(err) |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | type wrappedConn struct { |
| 73 | net.Conn |
nothing calls this directly
no test coverage detected
searching dependent graphs…