2
# Verify that the credentials are changed correctly.
4
# Copyright (C) 2009-2011 Free Software Foundation, Inc.
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
. "${srcdir=.}/init.sh"; path_prepend_ ../src
26
# Verify that root credentials are kept.
27
test $(chroot / whoami) = root || fail=1
28
test "$(groups)" = "$(chroot / groups)" || fail=1
30
# Verify that credentials are changed correctly.
31
whoami_after_chroot=$(
32
chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami
34
test "$whoami_after_chroot" != root || fail=1
36
# Verify that there are no additional groups.
38
chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP \
39
--groups=$NON_ROOT_GROUP / id -G
41
test "$id_G_after_chroot" = $NON_ROOT_GROUP || fail=1
43
# Verify that when specifying only the user name we get the current
45
test "$(chroot --userspec=$NON_ROOT_USERNAME / id -g)" = "$(id -g)" \
48
# Verify that when specifying only a group we get the current user ID
49
test "$(chroot --userspec=:$NON_ROOT_GROUP / id -u)" = "$(id -u)" \