Skip to content

Commit db63837

Browse files
ssh: accept WSAECONNABORTED in TestClientAuthMaxAuthTriesPublicKey
Fixes golang/go#50805 Change-Id: Icdd2835b1626240faf61936288f279570c873158 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/381614 Trust: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
1 parent dad3315 commit db63837

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ssh/client_auth_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"log"
1414
"net"
1515
"os"
16+
"runtime"
1617
"strings"
1718
"testing"
1819
)
@@ -639,7 +640,15 @@ func TestClientAuthMaxAuthTriesPublicKey(t *testing.T) {
639640
if err := tryAuth(t, invalidConfig); err == nil {
640641
t.Fatalf("client: got no error, want %s", expectedErr)
641642
} else if err.Error() != expectedErr.Error() {
642-
t.Fatalf("client: got %s, want %s", err, expectedErr)
643+
// On Windows we can see a WSAECONNABORTED error
644+
// if the client writes another authentication request
645+
// before the client goroutine reads the disconnection
646+
// message. See issue 50805.
647+
if runtime.GOOS == "windows" && strings.Contains(err.Error(), "wsarecv: An established connection was aborted") {
648+
// OK.
649+
} else {
650+
t.Fatalf("client: got %s, want %s", err, expectedErr)
651+
}
643652
}
644653
}
645654

0 commit comments

Comments
 (0)