diff options
author | Gaudenz Steinlin <gaudenz@debian.org> | 2013-09-09 08:33:48 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-01 06:38:53 +0100 |
commit | c8b8247f70607073af241f4aba682f09ccb3e76d (patch) | |
tree | 78b3d0e7d04145a074dbb5edf84b196033556b2f /src | |
parent | 3cc59ec3be6c9398fdb0cd7e20b626f2f423b4a7 (diff) | |
download | tinyproxy-c8b8247f70607073af241f4aba682f09ccb3e76d.tar.gz tinyproxy-c8b8247f70607073af241f4aba682f09ccb3e76d.zip |
[BB#115] Drop supplementary groups
Supplementary groups are inherited from the calling process. Drop all
supplementary groups if the "Group" configuration directive is set to
change to a different user. Otherwise the process may have more rights
than expected.
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -296,6 +296,16 @@ change_user (const char *program) exit (EX_NOPERM); } +#ifdef HAVE_SETGROUPS + /* Drop all supplementary groups, otherwise these are inherited from the calling process */ + if (setgroups (0, NULL) < 0) { + fprintf (stderr, + "%s: Unable to drop supplementary groups.\n", + program); + exit (EX_NOPERM); + } +#endif + log_message (LOG_INFO, "Now running as group \"%s\".", config.group); } |