setresgid and setresuid not portable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Light Display Manager |
Fix Released
|
Undecided
|
Matt Fischer |
Bug Description
I saw this thread
http://
I have same problem but on NetBSD.
Here is a patch, but untested:
--- src/privileges.
+++ src/privileges.c 2012-05-14 19:33:25.000000000 -0500
@@ -20,14 +20,34 @@
g_
g_debug ("Dropping privileges to uid %i", user_get_uid (user));
+#ifdef HAVE_SETRESGID
g_assert (setresgid (user_get_gid (user), user_get_gid (user), -1) == 0);
+#else
+ g_assert (setgid (user_get_gid (user)) == 0);
+ g_assert (setegid (user_get_gid (user)) == 0);
+#endif
+#ifdef HAVE_SETRESUID
g_assert (setresuid (user_get_uid (user), user_get_uid (user), -1) == 0);
+#else
+ g_assert (setuid (user_get_uid (user)) == 0);
+ g_assert (seteuid (user_get_uid (user)) == 0);
+#endif
}
void
privileges_reclaim (void)
{
g_debug ("Restoring privileges");
+#ifdef HAVE_SETRESUID
g_assert (setresuid (0, 0, -1) == 0);
+#else
+ g_assert (setuid (0) == 0);
+ g_assert (seteuid (0) == 0);
+#endif
+#ifdef HAVE_SETRESGID
g_assert (setresgid (0, 0, -1) == 0);
+#else
+ g_assert (setgid (0) == 0);
+ g_assert (setegid (0) == 0);
+#endif
}
Related branches
- Robert Ancell: Pending requested
-
Diff: 64 lines (+28/-1)2 files modifiedconfigure.ac (+2/-0)
src/privileges.c (+26/-1)
Changed in lightdm: | |
status: | New → In Progress |
assignee: | nobody → Matt Fischer (mfisch) |
The configure.ac / config.h.in would need to be setup to check for these two also.