You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the only way to revert the effects of a switch_user_group is to drop the returned SwitchUserGuard. However, Drop is not allowed to fail, so any internal failure directly translates to a panic:
implDropforSwitchUserGuard{fndrop(&mutself){// Panic on error here, as failing to set values back// is a possible security breach.set_effective_uid(self.uid).unwrap();set_effective_gid(self.gid).unwrap();}}
As a consumer of this crate, I'd like to have a way to switch back to the original state (consuming the guard at the same time) and get back a Result to handle the error case as usual.
The text was updated successfully, but these errors were encountered:
lucab
changed the title
switch: please provide a graceful destructor SwitchUserGuard
switch: please provide a graceful destructor for SwitchUserGuard
Oct 23, 2018
Currently, the only way to revert the effects of a
switch_user_group
is to drop the returnedSwitchUserGuard
. However,Drop
is not allowed to fail, so any internal failure directly translates to a panic:As a consumer of this crate, I'd like to have a way to switch back to the original state (consuming the guard at the same time) and get back a
Result
to handle the error case as usual.I guess the signature would be something like:
The text was updated successfully, but these errors were encountered: