Skip to content

Commit

Permalink
auth: handle improperly formatted OK correctly
Browse files Browse the repository at this point in the history
Propely wait for REJECT after sending the cancel - without this, we
could actually get a panic if the bus sends an OK without a GUID.
  • Loading branch information
guelfey committed Feb 13, 2022
1 parent 958b2d1 commit 301a69e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ func (conn *Conn) tryAuth(m Auth, state authState, in *bufio.Reader) (error, boo
return err, false
}
state = waitingForReject
} else {
conn.uuid = string(s[1])
return nil, true
}
conn.uuid = string(s[1])
return nil, true
case state == waitingForData:
err = authWriteLine(conn.transport, []byte("ERROR"))
if err != nil {
Expand All @@ -191,9 +192,10 @@ func (conn *Conn) tryAuth(m Auth, state authState, in *bufio.Reader) (error, boo
return err, false
}
state = waitingForReject
} else {
conn.uuid = string(s[1])
return nil, true
}
conn.uuid = string(s[1])
return nil, true
case state == waitingForOk && string(s[0]) == "DATA":
err = authWriteLine(conn.transport, []byte("DATA"))
if err != nil {
Expand Down

0 comments on commit 301a69e

Please sign in to comment.