From: Hans de Goede <hdegoede@redhat.com>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH xawtv3] alevtd: Drop supplementary group IDs when dropping privileges
Date: Mon, 15 Feb 2016 23:13:58 +0100 [thread overview]
Message-ID: <1455574438-27640-1-git-send-email-hdegoede@redhat.com> (raw)
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
reply other threads:[~2016-02-15 22:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455574438-27640-1-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).