Fix incorrect user accounting error handling#57875
Conversation
| if (errno != 0) { | ||
| return status_from_errno(); | ||
| } | ||
| // updwtmp doesn't report errors, per the c standard we can't trust errno here. |
There was a problem hiding this comment.
per the c standard
Are you sure this is specified in the C standard? That feels odd to me. Have a reference to the standard text?
There was a problem hiding this comment.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf
Section 7.5.3: "The value of errno may be set to nonzero by a library function call whether or not there is an error, provided the use of errno is not documented in the description of the function in this document."
|
friendly ping @zmb3 @rosstimothy |
boxofrad
left a comment
There was a problem hiding this comment.
Approving because it's clear we shouldn't be checking errno, but I'm unsure about how this fixes the accounting issue. Were we previously checking the uacc_* function return value and then not proceeding to write the session close?
|
@boxofrad yep, exactly that |
This change fixes a bug where Teleport would incorrectly check for errors from
updwtmp(), which doesn't report any (hence errno is unreliable).Resolves #54606.
Changelog: Fixed failure to close user accounting session