1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 22:36:12 -04:00

handle nil error

This commit is contained in:
Darien Raymond 2017-01-17 10:22:18 +01:00
parent f42894cc50
commit 6056cc6638
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

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