Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
export LC_ALL=C
|
|
|
|
unset LANG
|
|
|
|
unset LANGUAGE
|
|
|
|
. common/config.sh
|
|
|
|
|
|
|
|
USE_PAM="yes"
|
|
|
|
FAILURE_TESTS="yes"
|
|
|
|
|
|
|
|
succeeded=0
|
|
|
|
failed=0
|
|
|
|
failed_tests=""
|
|
|
|
|
|
|
|
run_test()
|
|
|
|
{
|
|
|
|
[ -f RUN_TEST.STOP ] && exit 1
|
|
|
|
|
2023-02-28 02:35:47 +05:30
|
|
|
passed=0
|
2023-02-25 05:22:25 +05:30
|
|
|
if $1 > $1.log 2>&1
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
then
|
2023-02-28 02:35:47 +05:30
|
|
|
passed=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$2" ]; then # ignore failure
|
|
|
|
echo -n "."
|
|
|
|
elif [ $passed -eq 1 ]; then
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
succeeded=$((succeeded+1))
|
|
|
|
echo -n "+"
|
|
|
|
else
|
|
|
|
failed=$((failed+1))
|
|
|
|
failed_tests="$failed_tests $1"
|
|
|
|
echo -n "-"
|
|
|
|
fi
|
|
|
|
cat $1.log >> testsuite.log
|
|
|
|
[ -f /etc/passwd.lock ] && echo $1 /etc/passwd.lock || true
|
|
|
|
[ -f /etc/group.lock ] && echo $1 /etc/group.lock || true
|
|
|
|
[ -f /etc/shadow.lock ] && echo $1 /etc/shadow.lock || true
|
|
|
|
[ -f /etc/gshadow.lock ] && echo $1 /etc/gshadow.lock || true
|
2021-11-08 05:26:31 +05:30
|
|
|
[ -f /etc/gshadow.lock ] && echo $1 /etc/gshadow.lock || true
|
|
|
|
rm -rf /tmp/test-uidmap
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
if [ "$(stat -c"%G" /etc/shadow)" != "shadow" ]
|
|
|
|
then
|
|
|
|
echo $1
|
|
|
|
ls -l /etc/shadow
|
|
|
|
chgrp shadow /etc/shadow
|
|
|
|
fi
|
|
|
|
if [ -d /nonexistent ]
|
|
|
|
then
|
|
|
|
echo $1 /nonexistent
|
|
|
|
rmdir /nonexistent
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "+: test passed"
|
|
|
|
echo "-: test failed"
|
|
|
|
|
|
|
|
# Empty the complete log.
|
|
|
|
> testsuite.log
|
|
|
|
|
2021-08-18 23:51:06 +05:30
|
|
|
find "${build_path}" -name "*.gcda" -delete
|
2023-02-28 02:35:47 +05:30
|
|
|
# ignore the result of the first test. ~magic~
|
|
|
|
run_test ./su/01/su_user.test ignore_failure
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/01/su_user.test
|
2023-02-28 01:54:11 +05:30
|
|
|
run_test ./su/01/su_root.test
|
2021-08-18 23:51:06 +05:30
|
|
|
find "${build_path}" -name "*.gcda" -exec chmod a+rw {} \;
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/02/env_FOO-options_--login
|
|
|
|
run_test ./su/02/env_FOO-options_--login_bash
|
|
|
|
run_test ./su/02/env_FOO-options_--preserve-environment
|
|
|
|
run_test ./su/02/env_FOO-options_--preserve-environment_bash
|
|
|
|
run_test ./su/02/env_FOO-options_-
|
|
|
|
run_test ./su/02/env_FOO-options_-_bash
|
|
|
|
run_test ./su/02/env_FOO-options_-l-m
|
|
|
|
run_test ./su/02/env_FOO-options_-l-m_bash
|
|
|
|
run_test ./su/02/env_FOO-options_-l
|
|
|
|
run_test ./su/02/env_FOO-options_-l_bash
|
|
|
|
run_test ./su/02/env_FOO-options_-m_bash
|
|
|
|
run_test ./su/02/env_FOO-options_-m
|
|
|
|
run_test ./su/02/env_FOO-options_-p
|
|
|
|
run_test ./su/02/env_FOO-options_-p_bash
|
|
|
|
run_test ./su/02/env_FOO-options__bash
|
|
|
|
run_test ./su/02/env_FOO-options_
|
|
|
|
run_test ./su/02/env_FOO-options_-p-
|
|
|
|
run_test ./su/02/env_FOO-options_-p-_bash
|
|
|
|
run_test ./su/02/env_special-options_-l-p
|
|
|
|
run_test ./su/02/env_special-options_-l
|
|
|
|
run_test ./su/02/env_special-options_-l-p_bash
|
|
|
|
run_test ./su/02/env_special-options_-l_bash
|
|
|
|
run_test ./su/02/env_special-options_-p
|
|
|
|
run_test ./su/02/env_special-options_-p_bash
|
|
|
|
run_test ./su/02/env_special-options_
|
|
|
|
run_test ./su/02/env_special-options__bash
|
|
|
|
run_test ./su/02/env_special_root-options_-l-p
|
|
|
|
run_test ./su/02/env_special_root-options_-l-p_bash
|
|
|
|
run_test ./su/02/env_special_root-options_-l
|
|
|
|
run_test ./su/02/env_special_root-options_-l_bash
|
|
|
|
run_test ./su/02/env_special_root-options_-p
|
|
|
|
run_test ./su/02/env_special_root-options_-p_bash
|
|
|
|
run_test ./su/02/env_special_root-options_
|
|
|
|
run_test ./su/02/env_special_root-options__bash
|
|
|
|
run_test ./su/03/su_run_command01.test
|
2020-08-29 01:45:47 +05:30
|
|
|
run_test ./su/03/su_run_command02.test
|
|
|
|
run_test ./su/03/su_run_command03.test
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/03/su_run_command04.test
|
2020-08-29 01:45:47 +05:30
|
|
|
run_test ./su/03/su_run_command05.test
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/03/su_run_command06.test
|
|
|
|
run_test ./su/03/su_run_command07.test
|
2020-08-29 01:45:47 +05:30
|
|
|
run_test ./su/03/su_run_command08.test
|
|
|
|
run_test ./su/03/su_run_command09.test
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/03/su_run_command10.test
|
2020-08-29 01:45:47 +05:30
|
|
|
run_test ./su/03/su_run_command11.test
|
|
|
|
run_test ./su/03/su_run_command12.test
|
|
|
|
run_test ./su/03/su_run_command13.test
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/03/su_run_command14.test
|
|
|
|
run_test ./su/03/su_run_command15.test
|
|
|
|
run_test ./su/03/su_run_command16.test
|
2020-08-29 01:45:47 +05:30
|
|
|
run_test ./su/03/su_run_command17.test
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
run_test ./su/04/su_wrong_user.test
|
|
|
|
run_test ./su/04/su_user_wrong_passwd.test
|
|
|
|
run_test ./su/04/su_user_wrong_passwd_syslog.test
|
|
|
|
run_test ./su/05/su_user_wrong_passwd_syslog.test
|
|
|
|
run_test ./su/06/su_user_syslog.test
|
|
|
|
run_test ./su/07/su_user_syslog.test
|
|
|
|
run_test ./su/08/env_special-options_
|
|
|
|
run_test ./su/08/env_special_root-options_
|
|
|
|
run_test ./su/09/env_special-options_
|
|
|
|
run_test ./su/09/env_special_root-options_
|
|
|
|
run_test ./su/10_su_sulog_success/su.test
|
|
|
|
run_test ./su/11_su_sulog_failure/su.test
|
|
|
|
run_test ./su/12_su_child_failure/su.test
|
|
|
|
run_test ./su/13_su_child_success/su.test
|
|
|
|
run_test ./libsubid/01_list_ranges/list_ranges.test
|
|
|
|
run_test ./libsubid/02_get_subid_owners/get_subid_owners.test
|
|
|
|
run_test ./libsubid/03_add_remove/add_remove_subids.test
|
2021-02-08 17:50:04 +05:30
|
|
|
run_test ./newuidmap/01_newuidmap/newuidmap.test
|
|
|
|
run_test ./newuidmap/02_newuidmap_relaxed_gid_check/newuidmap.test
|
|
|
|
run_test ./newgidmap/01_newgidmap/newgidmap.test
|
|
|
|
run_test ./newgidmap/02_newgidmap_relaxed_gid_check/newgidmap.test
|
subids: support nsswitch
Closes #154
When starting any operation to do with subuid delegation, check
nsswitch for a module to use. If none is specified, then use
the traditional /etc/subuid and /etc/subgid files.
Currently only one module is supported, and there is no fallback
to the files on errors. Several possibilities could be considered:
1. in case of connection error, fall back to files
2. in case of unknown user, also fall back to files
etc...
When non-files nss module is used, functions to edit the range
are not supported. It may make sense to support it, but it also
may make sense to require another tool to be used.
libsubordinateio also uses the nss_ helpers. This is how for instance
lxc could easily be converted to supporting nsswitch.
Add a set of test cases, including a dummy libsubid_zzz module. This
hardcodes values such that:
'ubuntu' gets 200000 - 300000
'user1' gets 100000 - 165536
'error' emulates an nss module error
'unknown' emulates a user unknown to the nss module
'conn' emulates a connection error ot the nss module
Changes to libsubid:
Change the list_owner_ranges api: return a count instead of making the array
null terminated.
This is a breaking change, so bump the libsubid abi major number.
Rename free_subuid_range and free_subgid_range to ungrant_subuid_range,
because otherwise it's confusing with free_subid_ranges which frees
memory.
Run libsubid tests in jenkins
Switch argument order in find_subid_owners
Move the db locking into subordinateio.c
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-02-01 05:08:20 +05:30
|
|
|
run_test ./libsubid/04_nss/subidnss.test
|
2022-11-19 03:44:43 +05:30
|
|
|
run_test ./usertools/62_usermod_remove_supplementary_groups/usermod.test
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
|
|
|
|
echo
|
|
|
|
echo "$succeeded test(s) passed"
|
|
|
|
echo "$failed test(s) failed"
|
|
|
|
echo "log written in 'testsuite.log'"
|
2021-08-18 23:51:06 +05:30
|
|
|
if [ "$failed" != 0 ]
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
then
|
|
|
|
echo "the following tests failed:"
|
2021-08-18 23:51:06 +05:30
|
|
|
echo "$failed_tests"
|
2021-11-08 05:26:31 +05:30
|
|
|
exit 1
|
Create a new libsubid
Closes #154
Currently this has three functions: one which returns the
list of subuid ranges for a user, one returning the subgids,
and one which frees the ranges lists.
I might be mistaken about what -disable-man means; some of
the code suggests it means just don't re-generate them, but
not totally ignore them. But that doesn't seem to really work,
so let's just ignore man/ when -disable-man.
Remove --disable-shared. I'm not sure why it was there, but it stems
from long, long ago, and I suspect it comes from some ancient
toolchain bug.
Create a tests/run_some, a shorter version of run_all. I'll
slowly add tests to this as I verify they work, then I can
work on fixing the once which don't.
Also, don't touch man/ if not -enable-man.
Changelog:
Apr 22: change the subid list api as recomended by Dan Walsh.
Apr 23: implement get_subid_owner
Apr 24: implement range add/release
Apr 25: finish tests and rebase
May 10: make @owner const
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-04-19 04:33:54 +05:30
|
|
|
fi
|