write back error status when authentication timeout

pull/362/head
Darien Raymond 2017-01-08 23:19:03 +01:00
parent 2e46e95536
commit 74938dc428
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 1 additions and 4 deletions

View File

@ -105,10 +105,7 @@ func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol
if expectedAuth == authPassword {
username, password, err := readUsernamePassword(reader)
if err != nil {
return nil, errors.Base(err).Message("Socks|Server: Failed to read username or password.")
}
if !s.config.HasAccount(username, password) {
if err != nil || !s.config.HasAccount(username, password) {
writeSocks5AuthenticationResponse(writer, 0xFF)
return nil, errors.Base(err).Message("Socks|Server: Invalid username or password.")
}