summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-12-14 16:00:28 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-12-14 16:00:28 +0100
commit5f3b126f3013cb78fa2e5a8beb935021e21d5c5d (patch)
treef73b2d969ade5cfdb353f76b11ac13555bd85b7c /lib/Utils
parent452013e2097aa985bf8c3f8296d00d189401eea3 (diff)
downloadabrt-5f3b126f3013cb78fa2e5a8beb935021e21d5c5d.tar.gz
abrt-5f3b126f3013cb78fa2e5a8beb935021e21d5c5d.tar.xz
abrt-5f3b126f3013cb78fa2e5a8beb935021e21d5c5d.zip
add paranoia checks on setuid/setgid
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/xfuncs.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp
index 0e57639..8621b5f 100644
--- a/lib/Utils/xfuncs.cpp
+++ b/lib/Utils/xfuncs.cpp
@@ -362,6 +362,18 @@ bool string_to_bool(const char *s)
return false;
}
+void xsetreuid(uid_t ruid, uid_t euid)
+{
+ if (setreuid(ruid, euid) != 0)
+ perror_msg_and_die("can't set %cid %d", 'u', (int)ruid);
+}
+
+void xsetregid(gid_t rgid, uid_t egid)
+{
+ if (setregid(rgid, egid) != 0)
+ perror_msg_and_die("can't set %cid %d", 'g', (int)rgid);
+}
+
uid_t getuidbyname(const char* login)
{
struct passwd* pwd = getpwnam(login);