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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux