diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2015-01-27 20:32:33 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-02-13 18:36:50 +0100 |
commit | dc13b1aff629b0271eb6b75a9f3bdb43c9767093 (patch) | |
tree | e76648c6b4b492c266b91c09b9b57c8407eb7b74 | |
parent | 00ac96c02b8f11a57c2c7bc67166f07043549ebb (diff) | |
download | sssd-dc13b1aff629b0271eb6b75a9f3bdb43c9767093.tar.gz sssd-dc13b1aff629b0271eb6b75a9f3bdb43c9767093.tar.xz sssd-dc13b1aff629b0271eb6b75a9f3bdb43c9767093.zip |
SELINUX: Check the return value of setuid and setgid
Silences a Coverity warning
Reviewed-by: Pavel Reichl <preichl@redhat.com>
(cherry picked from commit b0f46a3019e0ff4f375ef07682ceb9418751707f)
-rw-r--r-- | src/providers/ipa/selinux_child.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/providers/ipa/selinux_child.c b/src/providers/ipa/selinux_child.c index 7297f5ed3..63d4b9297 100644 --- a/src/providers/ipa/selinux_child.c +++ b/src/providers/ipa/selinux_child.c @@ -220,11 +220,21 @@ int main(int argc, const char *argv[]) * We need to switch also the real ID to 0. */ if (getuid() != 0) { - setuid(0); + ret = setuid(0); + if (ret == -1) { + ret = errno; + DEBUG(SSSDBG_CRIT_FAILURE, + "setuid failed: %d, selinux_child might not work!\n", ret); + } } if (getgid() != 0) { - setgid(0); + ret = setgid(0); + if (ret == -1) { + ret = errno; + DEBUG(SSSDBG_CRIT_FAILURE, + "setgid failed: %d, selinux_child might not work!\n", ret); + } } DEBUG(SSSDBG_TRACE_INTERNAL, |