[Intel-gfx] [PATCH 3/4] backlight: Drop rights before executing pkexec

Hans de Goede hdegoede at redhat.com
Mon Feb 17 13:16:53 CET 2014


Event though we've failed to open the backlight normally, we may still be
running under a suid-root xserver, so drop any elevated rights before
executing what we hope will be pkxec.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/backlight.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backlight.c b/src/backlight.c
index 518d756..dc26307 100644
--- a/src/backlight.c
+++ b/src/backlight.c
@@ -295,6 +295,10 @@ static int __backlight_helper_init(struct backlight *b, char *iface)
 
 	switch ((b->pid = fork())) {
 	case 0:
+		if (setgid(getgid()) != 0)
+			_exit(127);
+		if (setuid(getuid()) != 0)
+			_exit(127);
 		close(fds[1]);
 		dup2(fds[0], 0);
 		close(fds[0]);
-- 
1.8.5.3




More information about the Intel-gfx mailing list