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 <hdego...@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to