diff options
author | Damien Miller <djm@mindrot.org> | 2019-09-13 05:12:42 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-09-13 05:15:14 +0200 |
commit | c17e4638e5592688264fc0349f61bfc7b4425aa5 (patch) | |
tree | 58f25b12311c84426d1a250d33398ddea5a48c49 /uidswap.c | |
parent | upstream: Allow prepending a list of algorithms to the default set (diff) | |
download | openssh-c17e4638e5592688264fc0349f61bfc7b4425aa5.tar.xz openssh-c17e4638e5592688264fc0349f61bfc7b4425aa5.zip |
explicitly test set[ug]id() return values
Legacy !_POSIX_SAVED_IDS path only; coverity report via Ed Maste
ok dtucker@
Diffstat (limited to 'uidswap.c')
-rw-r--r-- | uidswap.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -162,8 +162,10 @@ restore_uid(void) * Propagate the real uid (usually more privileged) to effective uid * as well. */ - setuid(getuid()); - setgid(getgid()); + if (setuid(getuid()) == -1) + fatal("%s: setuid failed: %s", __func__, strerror(errno)); + if (setgid(getgid()) == -1) + fatal("%s: setgid failed: %s", __func__, strerror(errno)); #endif /* SAVED_IDS_WORK_WITH_SETEUID */ if (setgroups(saved_egroupslen, saved_egroups) == -1) |