MCPcopy
hub / github.com/gliderlabs/ssh / TestPasswordAuthBadPass

Function TestPasswordAuthBadPass

options_test.go:50–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func 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
72type wrappedConn struct {
73 net.Conn

Callers

nothing calls this directly

Calls 4

SetOptionMethod · 0.95
serveOnceMethod · 0.95
newLocalListenerFunction · 0.85
PasswordAuthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…