DescriptionUpdating SecurityKeyAuthHandlerPosix socket lifetime management
This change fixes two problems:
1.) Security key responses would not be delivered if the read end of
the socket was closed before the response was received. This
should be allowed since the write end was still open.
2.) An SSH error was always written when the socket was closed. This
was misleading when no error occrred and the socket was being
closed for a valid reason.
The old behavior would close the socket as soon as a read returned 0
bytes (or an error). The auth handler would read a request and forward
it to the remote machine, then immediately try to read another request.
If the code on the other end had closed its side of the connection, the
auth handler would receive EOF and close the socket. It would also
write an error to the write end of the socket which was also wrong.
The simpler change is to only write an error if the request timed out or
if we encountered a socket read error. Otherwise we just close our end
of the socket and the listener receives an EOF.
The bigger change is that we no longer queue up another socket read
operation until after we have received the response from the remote
machine. The SecurityKeySocket is meant to receive and respond to one
request at a time (per its class comments), and this new behavior also
makes lifetime management of the socket less complex.
BUG=671041
Committed: https://crrev.com/cb5a2ea87efd87a693c43a79cd1bde92a91b78cd
Cr-Commit-Position: refs/heads/master@{#439675}
Patch Set 1 #Patch Set 2 : Updating some additional unit tests #Patch Set 3 : Prereview tweaks #
Total comments: 9
Patch Set 4 : Addressing CR feedback #
Total comments: 2
Messages
Total messages: 21 (13 generated)
|