[gnome-terminal/gnome-3-12] Fix su/sudo detection.
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal/gnome-3-12] Fix su/sudo detection.
- Date: Mon, 28 Apr 2014 08:18:51 +0000 (UTC)
commit abdebd3fd459038a98e2f5a4aad0d296e391363b
Author: Gustau Perez <gustau perez gmail com>
Date: Tue Apr 8 09:42:34 2014 +0000
Fix su/sudo detection.
Commit 1244dbb6f0381ced states that gnome-terminal doesn't work under sudo. To
detect this that checks whether the uid or gid have changed or that the
e[uid|gid] are 0.
If the user already belongs to the group wheel or was root without doing any su or sudo
gnome-terminal will exit.
What we need to check is whether e[uid|gid] have changed (because the user was
root already or because the user belongs to the wheel/root group) and
check if the e[uid|gid] are 0. In that case the gnome-terminal is run under
su/sudo and gnome-terminal should bail out.
https://bugzilla.gnome.org/show_bug.cgi?id=727799
(cherry picked from commit 612345d2e47585f691006fa488125b2dc687117a)
src/server.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/server.c b/src/server.c
index bcad276..fc66249 100644
--- a/src/server.c
+++ b/src/server.c
@@ -72,9 +72,9 @@ main (int argc, char **argv)
const char *home_dir;
GError *error = NULL;
- if (G_UNLIKELY (getuid () != geteuid () ||
- getgid () != getegid () ||
- geteuid () == 0 ||
+ if (G_UNLIKELY ((getuid () != geteuid () ||
+ getgid () != getegid ()) &&
+ geteuid () == 0 &&
getegid () == 0)) {
g_printerr ("Wrong euid/egid, exiting.\n");
return EXIT_FAILURE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]