linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH xawtv3] alevtd: Drop supplementary group IDs when dropping privileges
@ 2016-02-15 22:13 Hans de Goede
  0 siblings, 0 replies; only message in thread
From: Hans de Goede @ 2016-02-15 22:13 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Hans de Goede

Noticed by rpmlint, seek POS36-C on the web for details about the problem.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 vbistuff/alevtd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vbistuff/alevtd.c b/vbistuff/alevtd.c
index c6211d3..2df4886 100644
--- a/vbistuff/alevtd.c
+++ b/vbistuff/alevtd.c
@@ -168,8 +168,10 @@ fix_ug(void)
     }
 
     /* set group */
-    if (getegid() != gr->gr_gid || getgid() != gr->gr_gid)
+    if (getegid() != gr->gr_gid || getgid() != gr->gr_gid) {
+        setgroups(0, NULL);
 	setgid(gr->gr_gid);
+    }
     if (getegid() != gr->gr_gid || getgid() != gr->gr_gid) {
 	xerror(LOG_ERR,"setgid failed",NULL);
 	exit(1);
@@ -177,8 +179,10 @@ fix_ug(void)
     strncpy(group,gr->gr_name,16);
 
     /* set user */
-    if (geteuid() != pw->pw_uid || getuid() != pw->pw_uid)
+    if (geteuid() != pw->pw_uid || getuid() != pw->pw_uid) {
+        setgroups(0, NULL);
 	setuid(pw->pw_uid);
+    }
     if (geteuid() != pw->pw_uid || getuid() != pw->pw_uid) {
 	xerror(LOG_ERR,"setuid failed",NULL);
 	exit(1);
-- 
2.7.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-15 22:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-15 22:13 [PATCH xawtv3] alevtd: Drop supplementary group IDs when dropping privileges Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).