Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(47)

Side by Side Diff: ssh/client_auth_test.go

Issue 24550043: code review 24550043: gosshnew/ssh: fix connection leak in TestClientAuthInva... (Closed)
Patch Set: diff -r e442b718b9b7 https://hanwen%40google.com@code.google.com/p/gosshnew/ Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package ssh 5 package ssh
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "crypto/dsa" 9 "crypto/dsa"
10 "io" 10 "io"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 defer l.Close() 172 defer l.Close()
173 c, err := l.Accept() 173 c, err := l.Accept()
174 if err != nil { 174 if err != nil {
175 t.Errorf("Unable to accept incoming connection: %v", err ) 175 t.Errorf("Unable to accept incoming connection: %v", err )
176 return 176 return
177 } 177 }
178 if err := c.Handshake(); err != nil { 178 if err := c.Handshake(); err != nil {
179 // not Errorf because this is expected to 179 // not Errorf because this is expected to
180 // fail for some tests. 180 // fail for some tests.
181 t.Logf("Handshaking error: %v", err) 181 t.Logf("Handshaking error: %v", err)
182 c.Close()
182 return 183 return
183 } 184 }
184 defer c.Close() 185 defer c.Close()
jpsugar 2013/11/11 18:48:17 How about just moving this up above c.Handshake?
hanwen-google 2013/11/12 14:44:42 Done.
185 }() 186 }()
186 return l.Addr().String() 187 return l.Addr().String()
187 } 188 }
188 189
189 func TestClientAuthPublicKey(t *testing.T) { 190 func TestClientAuthPublicKey(t *testing.T) {
190 config := &ClientConfig{ 191 config := &ClientConfig{
191 User: "testuser", 192 User: "testuser",
192 Auth: []ClientAuth{ 193 Auth: []ClientAuth{
193 ClientAuthKeyring(clientKeychain), 194 ClientAuthKeyring(clientKeychain),
194 }, 195 },
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 }, 360 },
360 } 361 }
361 c, err := Dial("tcp", newMockAuthServer(t), config) 362 c, err := Dial("tcp", newMockAuthServer(t), config)
362 if err == nil || !strings.Contains(err.Error(), "no common algorithms") { 363 if err == nil || !strings.Contains(err.Error(), "no common algorithms") {
363 t.Errorf("got %v, expected 'no common algorithms'", err) 364 t.Errorf("got %v, expected 'no common algorithms'", err)
364 } 365 }
365 if c != nil { 366 if c != nil {
366 c.Close() 367 c.Close()
367 } 368 }
368 } 369 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b