summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-05-27 23:06:15 +0200
committerJim Meyering <meyering@redhat.com>2009-06-02 16:34:53 +0200
commit2e62250e987dfb2e6253f512ef52707edc626719 (patch)
treeb026ed22fd91612cbbcb0479782214035663f8b4 /tests
parentbb7ff3bccdf643bbe4ae01c09db996e79092da80 (diff)
downloadcoreutils-2e62250e987dfb2e6253f512ef52707edc626719.tar.xz
chroot: don't set bogus user-ID or group-ID for --u=U: or --u=:G
* src/chroot.c (main): Initialize both "uid" and "gid". To -1. This also allows one to set the user-ID or primary group-ID to 0, in case it's not that already. * tests/chroot/credentials: Test for the above.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/chroot/credentials9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/chroot/credentials b/tests/chroot/credentials
index 23d66bd62..b76edea7d 100755
--- a/tests/chroot/credentials
+++ b/tests/chroot/credentials
@@ -40,4 +40,13 @@ test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami)" != root
test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP --groups= / id -nG)"\
= $NON_ROOT_GROUP || fail=1
+# Verify that when specifying only the user name we get the current
+# primary group ID.
+test "$(chroot --userspec=$NON_ROOT_USERNAME / id -g)" = "$(id -g)" \
+ || fail=1
+
+# Verify that when specifying only a group we get the current user ID
+test "$(chroot --userspec=:$NON_ROOT_GROUP / id -u)" = "$(id -u)" \
+ || fail=1
+
Exit $fail