[beast: 16/18] LAUNCHERS: abort if seteuid/setreuid failed to drop priviledges
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 16/18] LAUNCHERS: abort if seteuid/setreuid failed to drop priviledges
- Date: Mon, 5 Oct 2015 22:50:45 +0000 (UTC)
commit 90a498e67a8fab2c265edc6c6e630d9cf5ae5ae3
Author: Tim Janik <timj gnu org>
Date: Thu Sep 24 22:02:22 2015 +0200
LAUNCHERS: abort if seteuid/setreuid failed to drop priviledges
launchers/suidmain.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/launchers/suidmain.c b/launchers/suidmain.c
index 8a0d43d..c56f8c1 100644
--- a/launchers/suidmain.c
+++ b/launchers/suidmain.c
@@ -54,9 +54,17 @@ main (int argc,
if (euid != uid)
{
#if HAVE_SETEUID
- seteuid (uid);
+ if (seteuid (uid) < 0)
+ {
+ perror ("seteuid()");
+ _exit (127);
+ }
#elif HAVE_SETREUID
- setreuid (-1, uid);
+ if (setreuid (-1, uid) < 0)
+ {
+ perror ("setreuid()");
+ _exit (127);
+ }
#else
#error platform misses facility to drop privileges
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]