]> git.ipfire.org Git - thirdparty/coreutils.git/commit
chroot: with --userspec clear root's supplemental groups
authorPádraig Brady <P@draigBrady.com>
Fri, 16 May 2014 08:50:24 +0000 (09:50 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 21 May 2014 10:18:26 +0000 (11:18 +0100)
commitce0c08b52d893f6cad7ae9b7b59968406c85eeb9
tree379c01901adbe45d9cf5fbbb11887c357ad5abec
parent99960eeab9bf7fb479ab9f5342fc12a1fae629e6
chroot: with --userspec clear root's supplemental groups

It's dangerous and confusing to leave root's supplemental
groups in place when specifying other users with --userspec.
In the edge case that that is desired one can explicitly
specify --groups.

Also we implicitly set the system defined supplemental groups
for a user.  The existing mechanism where supplemental groups
needed to be explicitly specified is confusing and not general
when the lookup needs to be done within the chroot.

Also we extend the --groups syntax slightly to allow clearing
the set of supplementary groups using --groups=''.

* src/chroot.c (setgroups): On systems without supplemental groups,
clearing then is a noop and so should return success.
(main): Lookup the primary GID with getpwuid() when just a numeric
uid is specified, and also infer the USERNAME from this call,
needed when we're later looking up the supplemental groups for a user.
Support clearing supplemental groups, either implicitly for
unknown users, or explicitly when --groups='' is specified.
* tests/misc/chroot-credentials.sh: Various new test cases
* doc/coreutils.texi (chroot invocation): Adjust for the new behavior.
* NEWS: Mention the change in behavior.
NEWS
doc/coreutils.texi
src/chroot.c
tests/misc/chroot-credentials.sh