[LTP] [RFC PATCH v2 3/3] Remove admin_tools test
Petr Vorel
pvorel@suse.cz
Thu Sep 27 16:57:20 CEST 2018
Removing cron, at, su related tests as they don't really fit into
"kernel testing", it'd be better to have them in some "LTP userspace"
project.
ACL are considered as "kernel tests", but it would be easier to write
something from scratch, thus remove them as well.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* at: removed at_allow01, at_deny01, Makefiles
* Removed also su and acls tests.
---
runtest/admin_tools | 9 -
runtest/commands | 1 -
scenario_groups/default | 1 -
testcases/commands/.gitignore | 1 -
testcases/commands/at/Makefile | 31 --
testcases/commands/at/at_allow01 | 188 -------
testcases/commands/at/at_deny01 | 195 -------
testcases/commands/cron/00_Descriptions.txt | 4 -
testcases/commands/cron/Makefile | 29 --
testcases/commands/cron/README.tests | 25 -
testcases/commands/cron/cron02 | 80 ---
testcases/commands/cron/cron03 | 83 ---
testcases/commands/cron/cron_allow01 | 202 --------
testcases/commands/cron/cron_deny01 | 192 -------
testcases/commands/cron/cron_dirs_check.c | 44 --
testcases/commands/cron/cron_dirs_checks01 | 46 --
.../commands/cron/cron_illegal_cron_lines | 39 --
testcases/commands/cron/cron_neg_tests.sh | 141 -----
testcases/commands/cron/cron_pos_tests.sh | 118 -----
testcases/commands/cron/cron_tests.sh | 276 ----------
testcases/commands/su/Makefile | 31 --
testcases/commands/su/su01 | 181 -------
testcases/commands/su/su01_s1 | 486 ------------------
testcases/commands/su/su_set_passwd | 14 -
testcases/kernel/fs/acls/.gitignore | 2 -
testcases/kernel/fs/acls/Makefile | 40 --
testcases/kernel/fs/acls/acl_file_test.c | 73 ---
testcases/kernel/fs/acls/acl_link_test.c | 56 --
testcases/kernel/fs/acls/acl_test01 | 186 -------
29 files changed, 2774 deletions(-)
delete mode 100644 runtest/admin_tools
delete mode 100644 testcases/commands/at/Makefile
delete mode 100755 testcases/commands/at/at_allow01
delete mode 100755 testcases/commands/at/at_deny01
delete mode 100644 testcases/commands/cron/00_Descriptions.txt
delete mode 100644 testcases/commands/cron/Makefile
delete mode 100644 testcases/commands/cron/README.tests
delete mode 100755 testcases/commands/cron/cron02
delete mode 100755 testcases/commands/cron/cron03
delete mode 100755 testcases/commands/cron/cron_allow01
delete mode 100755 testcases/commands/cron/cron_deny01
delete mode 100644 testcases/commands/cron/cron_dirs_check.c
delete mode 100755 testcases/commands/cron/cron_dirs_checks01
delete mode 100644 testcases/commands/cron/cron_illegal_cron_lines
delete mode 100755 testcases/commands/cron/cron_neg_tests.sh
delete mode 100755 testcases/commands/cron/cron_pos_tests.sh
delete mode 100644 testcases/commands/cron/cron_tests.sh
delete mode 100644 testcases/commands/su/Makefile
delete mode 100755 testcases/commands/su/su01
delete mode 100755 testcases/commands/su/su01_s1
delete mode 100755 testcases/commands/su/su_set_passwd
delete mode 100644 testcases/kernel/fs/acls/.gitignore
delete mode 100644 testcases/kernel/fs/acls/Makefile
delete mode 100644 testcases/kernel/fs/acls/acl_file_test.c
delete mode 100644 testcases/kernel/fs/acls/acl_link_test.c
delete mode 100755 testcases/kernel/fs/acls/acl_test01
diff --git a/runtest/admin_tools b/runtest/admin_tools
deleted file mode 100644
index 0a46468c8..000000000
--- a/runtest/admin_tools
+++ /dev/null
@@ -1,9 +0,0 @@
-su01 export TCbin=$LTPROOT/testcases/bin;su01
-#cron01 cron01
-cron02 cron02
-cron_deny01 cron_deny01
-cron_allow01 cron_allow01
-cron_dirs_checks01 cron_dirs_checks01
-at_deny01 at_deny01
-at_allow01 at_allow01
-acl_test01 acl_test01
diff --git a/runtest/commands b/runtest/commands
index ee7e9f440..462633017 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -5,7 +5,6 @@ ldd01 ldd01
nm01 nm01
file01 file01.sh
tar01 tar_tests.sh
-cron cron_tests.sh
logrotate export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh
cpio01 cpio_tests.sh
unzip01 unzip01.sh
diff --git a/scenario_groups/default b/scenario_groups/default
index 5658a618b..b1739b77e 100644
--- a/scenario_groups/default
+++ b/scenario_groups/default
@@ -17,7 +17,6 @@ filecaps
cap_bounds
fcntl-locktests
connectors
-admin_tools
timers
power_management_tests
numa
diff --git a/testcases/commands/.gitignore b/testcases/commands/.gitignore
index 9aa1caf6c..0ed343881 100644
--- a/testcases/commands/.gitignore
+++ b/testcases/commands/.gitignore
@@ -1,5 +1,4 @@
/ldd/datafiles/lddfile.out
/ldd/datafiles/*.obj.so
-/cron/cron_dirs_check
/eject/eject_check_tray
/insmod/ltp_insmod01.ko
diff --git a/testcases/commands/at/Makefile b/testcases/commands/at/Makefile
deleted file mode 100644
index ca3fb04fe..000000000
--- a/testcases/commands/at/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# commands/at testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir ?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := at_allow01 at_deny01
-
-MAKE_TARGETS :=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/at/at_allow01 b/testcases/commands/at/at_allow01
deleted file mode 100755
index c0e9335cf..000000000
--- a/testcases/commands/at/at_allow01
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/bin/sh -u
-#
-# Copyright (C) 2008 CAI Qian <caiqian@cclom.cn>
-# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-#
-# FILE: /etc/at.allow
-#
-# PURPOSE: Test that /etc/at.allow , only allows those in the file to
-# run cron jobs.
-#
-# HISTORY:
-# 04/03 Jerone Young (jyoung5@us.ibm.com)
-#
-
-export TCID=at_allow01
-export TST_TOTAL=1
-export TST_COUNT=1
-TMP=${TMP:=/tmp}
-allow="/etc/at.allow"
-test_user1="test_user_1"
-test_user2="test_user_2"
-test_user1_home="/home/${test_user1}"
-test_user2_home="/home/${test_user2}"
-tmpfile="$TMP/at_allow_test"
-
-if [ "$(id -ru)" = 0 ]; then
- . cmdlib.sh
-fi
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup()
-{
- # Move any files that may get in the way.
- rm "${tmpfile}" >/dev/null 2>&1
- mv "${allow}" "${allow}.old" >/dev/null 2>&1
-
- # Remove users for clean enviroment.
- rm -rf "${test_user1_home}" "${test_user2_home}"
- userdel -r "${test_user1}" >/dev/null 2>&1
- userdel -r "${test_user2}" >/dev/null 2>&1
-
- # Create the 1st user.
- if ! useradd -g users -d "${test_user1_home}" -m "${test_user1}"; then
- echo "Could not add test user ${test_user1} to system."
- exit 1
- fi
-
- # Create the 2nd user.
- if ! useradd -g users -d "${test_user2_home}" -m "${test_user2}"; then
- echo "Could not add test user ${test_user2} to system."
- exit 1
- fi
-
- # This is the workaround for a potential bug.
- # [Bug 468337] At Refuse to Work with Non-login Shell
- # https://bugzilla.redhat.com/show_bug.cgi?id=468337
- # As we are running in non-login shell now, we cannot run the script
- # by simply given it a relative path. Therefore, we copy it to test
- # users' home directories, and run it from there.
- cp "$0" "${test_user1_home}/." &&
- cp "$0" "${test_user2_home}/." &&
- echo "export LTPROOT='$LTPROOT'" > "${test_user1_home}/cached_ltproot" &&
- echo "export LTPROOT='$LTPROOT'" > "${test_user2_home}/cached_ltproot"
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Couldn't copy over req'd files for test users"
- exit 1
- fi
-
- restart_daemon atd
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-do_cleanup()
-{
- # We forcefully remove those files anyway. Otherwise userdel may
- # give us bad warnings.
- rm -rf "${test_user1_home}" "${test_user2_home}"
- userdel -r "${test_user1}" >/dev/null 2>&1
- userdel -r "${test_user2}" >/dev/null 2>&1
- rm "${allow}"
- mv "${allow}.old" "${allow}" >/dev/null 2>&1
- rm "${tmpfile}" >/dev/null 2>&1
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: run_test
-#-----------------------------------------------------------------------
-run_test()
-{
- if [ $(whoami) = "${test_user1}" ]; then
- . "${test_user1_home}/cached_ltproot" || exit 1
- export PATH="$PATH:$LTPROOT/testcases/bin"
-
- echo "TEST: $allow should allow only those who in the file to run jobs."
- echo "(1) TEST THAT PERSON IN ${allow} IS ABLE TO RUN JOB."
- echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
- if ! at -m now + 1 minutes ; then
- echo "Error while adding job using at for user ${test_user1}."
- exit 1
- fi
- echo " Sleeping for 75 seconds...."
- sleep 75
-
- exit_code=1
- test -e "${tmpfile}" && exit_code=0
- if [ ${exit_code} -eq 1 ]; then
- tst_resm TFAIL "At did not allow user to execute job"
- else
- tst_resm TPASS "At allowed user to execute test job"
- fi
-
- rm -f "${tmpfile}" >/dev/null 2>&1
- exit ${exit_code}
-
- elif [ $(whoami) = "${test_user2}" ]; then
-
- . "${test_user2_home}/cached_ltproot" || exit 1
- export PATH="$PATH:$LTPROOT/testcases/bin"
-
- echo "(2) TEST PERSON THAT IS NOT IN ${allow} IS NOT ABLE TO RUN JOB."
-
- echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
- if ! at -m now + 1 minutes; then
- echo "Expected error while adding job user at for user ${test_user2}"
- fi
- echo "Sleeping for 75 seconds...."
- sleep 75
-
- exit_code=1
- test -e "${tmpfile}" || exit_code=0
- if [ ${exit_code} -eq 1 ]; then
- tst_resm TFAIL "At allowed user to execute test job"
- else
- tst_resm TPASS "At did not allow user to execute job"
- fi
-
- rm -f "${tmpfile}" >/dev/null 2>&1
- exit ${exit_code}
-
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: main
-#-----------------------------------------------------------------------
-if ! type at > /dev/null; then
- tst_resm TCONF "at command not found on system"
-elif [ "$(id -ru)" = 0 ]; then
- if do_setup; then
-
- if ! echo "${test_user1}" >"${allow}"; then
- exit_code=1
- elif ! su "${test_user1}" -lc "${test_user1_home}/${0##*/}"; then
- exit_code=1
- elif ! su "${test_user2}" -lc "${test_user2_home}/${0##*/}"; then
- exit_code=1
- else
- exit_code=0
- fi
- do_cleanup
- else
- exit_code=1
- fi
- exit ${exit_code}
-else
- run_test
- exit 0
-fi
diff --git a/testcases/commands/at/at_deny01 b/testcases/commands/at/at_deny01
deleted file mode 100755
index 176da14f6..000000000
--- a/testcases/commands/at/at_deny01
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/bin/sh -u
-#
-# Copyright (C) 2008 CAI Qian <caiqian@cclom.cn>
-# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# FILE: /etc/at.deny
-#
-# PURPOSE: Test that /etc/at.deny , does not allow those in the file
-# to run cron jobs.
-#
-# HISTORY:
-# 04/03 Jerone Young (jyoung5@us.ibm.com)
-#
-
-export TCID=at_deny01
-export TST_TOTAL=1
-export TST_COUNT=1
-TMP=${TMP:=/tmp}
-deny="/etc/at.deny"
-test_user1="test_user_1"
-test_user2="test_user_2"
-test_user1_home="/home/${test_user1}"
-test_user2_home="/home/${test_user2}"
-tmpfile="$TMP/at_deny_test"
-
-if [ "$(id -ru)" = 0 ]; then
- . cmdlib.sh
-fi
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup()
-{
- # Move any files that may get in the way.
- rm "${tmpfile}" >/dev/null 2>&1
- mv "${deny}" "${deny}.old" >/dev/null 2>&1
-
- # if /etc/at.allow is there, /etc/at.deny will be ignored. So, we
- # need to remove it first.
- if [ -f "/etc/at.allow" ]; then
- mv /etc/at.allow /etc/at.allow.old
- fi
-
- # Remove users for clean enviroment.
- rm -rf "${test_user1_home}" "${test_user2_home}"
- userdel -r "${test_user1}" >/dev/null 2>&1
- userdel -r "${test_user2}" >/dev/null 2>&1
-
- # Create the 1st user.
- if ! useradd -g users -d "${test_user1_home}" -m "${test_user1}"; then
- echo "Could not add test user ${test_user1} to system."
- exit 1
- fi
-
- # Create the 2nd user.
- if ! useradd -g users -d "${test_user2_home}" -m "${test_user2}"; then
- echo "Could not add test user ${test_user2} to system."
- exit 1
- fi
-
- # This is the workaround for a potential bug.
- # [Bug 468337] At Refuse to Work with Non-login Shell
- # https://bugzilla.redhat.com/show_bug.cgi?id=468337
- # As we are running in non-login shell now, we cannot run the script
- # by simply given it a relative path. Therefore, we copy it to test
- # users' home directories, and run it from there.
- cp "$0" "${test_user1_home}/." &&
- cp "$0" "${test_user2_home}/." &&
- echo "export LTPROOT='$LTPROOT'" > "${test_user1_home}/cached_ltproot" &&
- echo "export LTPROOT='$LTPROOT'" > "${test_user2_home}/cached_ltproot"
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Couldn't copy over req'd files for test users"
- exit 1
- fi
-
- restart_daemon atd
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-do_cleanup()
-{
- # We forcefully remove those files anyway. Otherwise userdel may
- # give us bad warnings.
- rm -rf "${test_user1_home}" "${test_user2_home}"
- userdel -r "${test_user1}" >/dev/null 2>&1
- userdel -r "${test_user2}" >/dev/null 2>&1
- rm "${deny}"
- mv "${deny}.old" "${deny}" >/dev/null 2>&1
- rm "${tmpfile}" >/dev/null 2>&1
-
- if [ -f /etc/at.allow.old ]; then
- mv /etc/at.allow.old /etc/at.allow
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: run_test
-#-----------------------------------------------------------------------
-run_test()
-{
- if [ $(whoami) = "${test_user1}" ]; then
- . "${test_user1_home}/cached_ltproot" || exit 1
- export PATH="$PATH:$LTPROOT/testcases/bin"
-
- echo "TEST: ${deny} should deny only those who are not in the file to run jobs."
- echo "(1) TEST THAT PERSON NOT IN ${deny} IS ABLE TO RUN JOB."
- echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
- if ! at -m now + 1 minutes; then
- echo "Error while adding job using at for user ${test_user1}."
- exit 1
- fi
- echo " Sleeping for 75 seconds...."
- sleep 75
-
- exit_code=1
- test -e "${tmpfile}" && exit_code=0
- if [ ${exit_code} -eq 1 ]; then
- tst_resm TFAIL "At denyed user to execute test job"
- else
- tst_resm TPASS "At did not deny user to execute job"
- fi
-
- rm -f "${tmpfile}" >/dev/null 2>&1
- exit ${exit_code}
-
- elif [ $(whoami) = "${test_user2}" ]; then
-
- . "${test_user2_home}/cached_ltproot" || exit 1
- export PATH="$PATH:$LTPROOT/testcases/bin"
-
- echo "(2) TEST THAT PERSON IN ${deny} IS NOT ABLE TO RUN JOB."
-
- echo "echo 'TEST JOB RAN' >>\"${tmpfile}\" 2>&1" |
- if ! at -m now + 1 minutes; then
- echo "Expected error while adding job user at for user ${test_user2}"
- fi
- echo "Sleeping for 75 seconds...."
- sleep 75
-
- exit_code=1
- test -e "${tmpfile}" || exit_code=0
- if [ ${exit_code} -eq 1 ]; then
- echo "At did not deny user to execute job, TEST FAILED."
- else
- echo "At denyed user to execute test job, TEST PASSED."
- fi
-
- rm -f "${tmpfile}" >/dev/null 2>&1
- exit ${exit_code}
-
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: main
-#-----------------------------------------------------------------------
-if ! type at > /dev/null; then
- tst_resm TCONF "at command not found on system"
-elif [ "$(id -ru)" = 0 ]; then
- if do_setup ; then
- if ! echo "${test_user2}" >"${deny}"; then
- exit_code=1
- elif ! su "${test_user1}" -lc "${test_user1_home}/${0##*/}"; then
- exit_code=1
- elif ! su "${test_user2}" -lc "${test_user2_home}/${0##*/}"; then
- exit_code=1
- else
- exit_code=0
- fi
- do_cleanup
- else
- exit_code=1
- fi
- exit ${exit_code}
-else
- run_test
- exit 0
-fi
diff --git a/testcases/commands/cron/00_Descriptions.txt b/testcases/commands/cron/00_Descriptions.txt
deleted file mode 100644
index 9566e0aaa..000000000
--- a/testcases/commands/cron/00_Descriptions.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-cron01
- Test that crontab <filename> installs the cron-job-file and cron will
- schedule the job correctly.
-
diff --git a/testcases/commands/cron/Makefile b/testcases/commands/cron/Makefile
deleted file mode 100644
index 4969ec7bb..000000000
--- a/testcases/commands/cron/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# commands/cron testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir ?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := cron0[23] cron_illegal_cron_lines cron_allow01 cron_deny01 cron_dirs_checks01 *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/cron/README.tests b/testcases/commands/cron/README.tests
deleted file mode 100644
index 0d5db7113..000000000
--- a/testcases/commands/cron/README.tests
+++ /dev/null
@@ -1,25 +0,0 @@
-This directory contains two scripts and one data file to test cron. Both
-shouldn't be run as root but they warn for themselves. If a username is
-given as parameter they run as this user.
-
-Both scripts save the current crontab and restore it after finishing.
-
-* Positive tests
-
- cron_pos_tests.sh [username]
-
- - add new job
- - check correct execution of job
- - delete job
-
-* Negative tests
-
- cron_neg_tests.sh [username]
-
- - try to edit the crontab of root
- - try to set illegal or nondefined execution times
- Here the script uses file illegal_cron_lines which contains two
- fields per line: the cron line to be tested (without script name),
- and the description of this test. The description is written to
- stdout during execution of the test.
- - try to do things you aren't allowed as non-root (cron runs as root)
diff --git a/testcases/commands/cron/cron02 b/testcases/commands/cron/cron02
deleted file mode 100755
index 16b425de3..000000000
--- a/testcases/commands/cron/cron02
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-#*********************************************************************
-# Copyright (c) International Business Machines Corp., 2000
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE : cron02
-#
-# PURPOSE: Test a postive cron job
-# - add new job
-# - check correct execution of job
-# - delete job
-#
-# HISTORY:
-# SUSE
-#
-
-TEST_USER="c01_user"
-TEST_USER_GROUP="users"
-TEST_USER_HOMEDIR="/home/$TEST_USER"
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup(){
- #erase any data from potential defunt cron test
- rm -rf /tmp/crontest > /dev/null 2>&1
-
- #erase user if he may exist , so we can have a clean env
- rm -rf /home/$TEST_USER
- userdel $TEST_USER
- sleep 1
-
- useradd -m -g $TEST_USER_GROUP $TEST_USER
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER to system $RHOST."
- exit 1
- }
- fi
-
- if [ -n "$CROND_DAEMON" ]; then
- restart_daemon $CROND_DAEMON
- else
- tst_brkm TBROK "Couldn't find crond or cron"
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-
-do_cleanup(){
- rm -rf /home/$TEST_USER
- userdel $TEST_USER
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: MAIN
-#-----------------------------------------------------------------------
-. cmdlib.sh
-
-do_setup
-cron_pos_tests.sh $TEST_USER
-EXIT_CODE=$?
-do_cleanup
-exit $EXIT_CODE
diff --git a/testcases/commands/cron/cron03 b/testcases/commands/cron/cron03
deleted file mode 100755
index 7ba7bf40c..000000000
--- a/testcases/commands/cron/cron03
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-#*********************************************************************
-# Copyright (c) International Business Machines Corp., 2000
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE : cron
-#
-# PURPOSE: Test a bad (negative) cron job
-# - try to edit the crontab of root
-# - try to set illegal or nondefined execution times
-# Here the script uses file illegal_cron_lines which contains two
-# fields per line: the cron line to be tested (without script name),
-# and the description of this test. The description is written to
-# stdout during execution of the test.
-# - try to do things you aren't allowed as non-root (cron runs as root)
-
-#
-# HISTORY:
-# SUSE
-#
-
-
-TEST_USER="c02_user"
-TEST_USER_GROUP="users"
-TEST_USER_HOMEDIR="/home/$TEST_USER"
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup(){
-
- #erase user if he may exist , so we can have a clean env
- rm -rf /home/$TEST_USER
- userdel $TEST_USER
- sleep 1
-
- useradd -m -g $TEST_USER_GROUP $TEST_USER
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER to system $RHOST."
- exit 1
- }
- fi
- # restart cron daemon
- # Red Hat uses crond, SuSE/Other uses cron.
- if [ -f /etc/init.d/crond ]; then
- /etc/init.d/crond restart
- else
- /etc/init.d/cron restart
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-
-do_cleanup(){
- rm -rf /home/$TEST_USER
- userdel $TEST_USER
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: MAIN
-#-----------------------------------------------------------------------
-do_setup
-cron_neg_tests.sh $TEST_USER
-EXIT_CODE=$?
-do_cleanup
-exit $EXIT_CODE
diff --git a/testcases/commands/cron/cron_allow01 b/testcases/commands/cron/cron_allow01
deleted file mode 100755
index 9a5e4d240..000000000
--- a/testcases/commands/cron/cron_allow01
+++ /dev/null
@@ -1,202 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE: /var/spool/cron/allow
-#
-# PURPOSE: Test that /var/spool/cron/allow , only allows those in the file to run cron jobs.
-#
-# HISTORY:
-# 04/03 Jerone Young (jyoung5@us.ibm.com)
-#
-
-echo "This script contains bashism that needs to be fixed!"
-
-iam=`whoami`
-
-tvar=${MACHTYPE%-*}
-tvar=${tvar#*-}
-
-if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ]
-then
-CRON_ALLOW="/etc/cron.allow"
-else
-CRON_ALLOW="/var/spool/cron/allow"
-fi
-
-TEST_USER1="ca_user1"
-TEST_USER1_HOME="/home/$TEST_USER1"
-TEST_USER2="ca_user2"
-TEST_USER2_HOME="/home/$TEST_USER2"
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup() {
- #move any files that may get in the way
- rm /tmp/cron_allow_test > /dev/null 2>&1
- rm /tmp/cron_allow_test1 > /dev/null 2>&1
- mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
-
- #remove users for clean enviroment
- su $TEST_USER1 -c "crontab -r"
- su $TEST_USER2 -c "crontab -r"
- rm -rf /home/$TEST_USER1
- rm -rf /home/$TEST_USER2
- userdel $TEST_USER1
- userdel $TEST_USER2
- sleep 1
-
-#create 1st user
- useradd -m -g users $TEST_USER1
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER1 to system."
- exit 1
- }
- fi
-
-#create 2nd user
- useradd -m -g users $TEST_USER2
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER2 to system."
- exit 1
- }
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-do_cleanup(){
- su $TEST_USER1 -c "crontab -r"
- su $TEST_USER2 -c "crontab -r"
- rm -rf /home/$TEST_USER1
- rm -rf /home/$TEST_USER2
- userdel $TEST_USER1
- userdel $TEST_USER2
- rm $CRON_ALLOW
- mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
- rm /tmp/cron_allow_test >/dev/null 2>&1
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: run_test
-#-----------------------------------------------------------------------
-run_test() {
-
-if [ $iam = $TEST_USER1 ]
-then
- echo "TEST: $CRON_ALLOW should only allow those in the file to
-run cron jobs."
-
- echo "(1) TEST THAT PERSON IN $CRON_ALLOW IS ABLE TO RUN JOB."
-
- echo "backup crontab...."
- crontab -l | grep '^[^#]' > /tmp/crontab-cronallow-save-$iam
-
- crontab - << EOF
- `date '+%M' | awk '{ORS=""; print ($1+2)%60 " * * * * "}'` echo "TEST JOB RAN" >> /tmp/cron_allow_test 2>&1
-EOF
- if [ $? != 0 ]; then
- echo Error while adding crontab for user $TEST_USER1
- exit 1
- fi
-
- echo "sleeping for 130 seconds...."
- sleep 130
-
- EXIT_CODE=1
- test -e /tmp/cron_allow_test && EXIT_CODE=0
-
- if [ $EXIT_CODE = 1 ]; then
- echo "Cron did not allow user to execute job , TEST FAILED"
- else
- echo "Cron allowed user to execute test job, TEST PASSED"
- fi
-
- echo "restore old crontab..."
- crontab /tmp/crontab-cronallow-save-$iam
- rm -f /tmp/crontab-cronallow-save-$iam
-
-
- rm -f /tmp/cron_allow_test
-
- exit $EXIT_CODE
-fi
-
-if [ $iam = $TEST_USER2 ]
-then
- echo "(2) TEST THAT PERSON NOT IN $CRON_ALLOW IS NOT ABLE TO RUN JOB."
-
- echo "backup crontab...."
- crontab -l | grep '^[^#]' > /tmp/crontab-cronallow-save-$iam
-
- crontab - << EOF
- `date '+%M' | awk '{ORS=""; print ($1+2)%60 " * * * * "}'` echo "TEST JOB RAN" >> /tmp/cron_allow_test1 2>&1
-EOF
- if [ $? != 0 ]; then
- echo Error while adding crontab for user $TEST_USER2
- fi
-
- echo "sleeping for 130 seconds...."
- sleep 130
-
- EXIT_CODE=0
- test -e /tmp/cron_allow_test1 && EXIT_CODE=1
-
- if [ $EXIT_CODE = 0 ]; then
- echo "Cron did not allow user to execute job , TEST PASSED"
- else
- echo "Cron allowed user to execute test job, TEST FAILED"
- fi
-
- echo "restore old crontab..."
- crontab /tmp/crontab-cronallow-save-$iam
- rm -f /tmp/crontab-cronallow-save-$iam
-
- rm -f /tmp/cron_allow_test1
-
- exit $EXIT_CODE
-fi
-
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: main
-#-----------------------------------------------------------------------
-if [ $iam = "root" ]
-then
- do_setup
- echo $TEST_USER1 > $CRON_ALLOW
- EXIT_CODE=0
- su $TEST_USER1 -c "$0"
- if [ $? != 0 ]
- then
- EXIT_CODE=1
- fi
- su $TEST_USER2 -c "$0"
- if [ $? != 0 ]
- then EXIT_CODE=1
- fi
- do_cleanup
- exit $EXIT_CODE
-else
- run_test
-fi
diff --git a/testcases/commands/cron/cron_deny01 b/testcases/commands/cron/cron_deny01
deleted file mode 100755
index 9d3203925..000000000
--- a/testcases/commands/cron/cron_deny01
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE: /var/spool/cron/allow
-#
-# PURPOSE: Test that /var/spool/cron/deny , does not allow those in the file to run cron jobs.
-#
-# HISTORY:
-# 04/03 Jerone Young (jyoung5@us.ibm.com)
-#
-
-echo "This script contains bashism that needs to be fixed!"
-
-iam=`whoami`
-
-tvar=${MACHTYPE%-*}
-tvar=${tvar#*-}
-
-if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ]
-then
-CRON_DENY="/etc/cron.deny"
-CRON_ALLOW="/etc/cron.allow"
-else
-CRON_DENY="/var/spool/cron/deny"
-CRON_ALLOW="/var/spool/cron/allow"
-fi
-
-TEST_USER1="cd_user1"
-TEST_USER1_HOME="/home/$TEST_USER1"
-TEST_USER2="cd_user2"
-TEST_USER2_HOME="/home/$TEST_USER2"
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup() {
- #move any files that may get in the way
- rm /tmp/cron_deny_test > /dev/null 2>&1
- rm /tmp/cron_deny_test1 > /dev/null 2>&1
-
- mv $CRON_DENY $CRON_DENY.old > /dev/null 2>&1
- mv $CRON_ALLOW $CRON_ALLOW.old > /dev/null 2>&1
-
- #remove users for clean enviroment
- su $TEST_USER1 -c "crontab -r"
- su $TEST_USER2 -c "crontab -r"
- rm -rf /home/$TEST_USER1
- rm -rf /home/$TEST_USER2
- userdel $TEST_USER1
- userdel $TEST_USER2
- sleep 1
-
-#create 1st user
- useradd -m -g users $TEST_USER1
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER1 to system."
- exit 1
- }
- fi
-
-#create 2nd user
- useradd -m -g users $TEST_USER2
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER2 to system."
- exit 1
- }
- fi
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-do_cleanup(){
- su $TEST_USER1 -c "crontab -r"
- su $TEST_USER2 -c "crontab -r"
- rm -rf /home/$TEST_USER1
- rm -rf /home/$TEST_USER2
- userdel $TEST_USER1
- userdel $TEST_USER2
- rm $CRON_DENY
- mv $CRON_DENY.old $CRON_DENY > /dev/null 2>&1
- mv $CRON_ALLOW.old $CRON_ALLOW > /dev/null 2>&1
- rm /tmp/cron_allow_test >/dev/null 2>&1
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: run_test
-#-----------------------------------------------------------------------
-run_test() {
-
-if [ $iam = $TEST_USER1 ]
-then
- echo "TEST: $CRON_DENY should allow only allow those who are not in the file to
-run cron jobs."
-
- echo "(1) TEST THAT PERSON NOT IN $CRON_DENY IS ABLE TO RUN JOB."
-
- crontab - << EOF
- `date '+%M' | awk '{ORS=""; print ($1+2)%60" * * * * "}'` echo "TEST JOB RAN" >> /tmp/cron_deny_test 2>&1
-EOF
- if [ $? != 0 ]; then
- echo Error while adding crontab for user $TEST_USER1
- exit 1
- fi
-
- echo "sleeping for 130 seconds...."
- sleep 130
-
- EXIT_CODE=1
- test -e /tmp/cron_deny_test && EXIT_CODE=0
-
- if [ $EXIT_CODE = 1 ]; then
- echo "Cron did not allow user to execute job , TEST FAILED"
- else
- echo "Cron allowed user to execute test job, TEST PASSED"
- fi
-
- rm -f /tmp/cron_deny_test
-
- exit $EXIT_CODE
-fi
-
-if [ $iam = $TEST_USER2 ]
-then
- echo "(2) TEST THAT PERSON IN $CRON_DENY IS NOT ABLE TO RUN JOB."
-
- crontab - << EOF
- `date '+%M' | awk '{ORS=""; print ($1+2)%60 " * * * * "}'` echo "TEST JOB RAN" >> /tmp/cron_deny_test 2>&1
-EOF
- if [ $? != 0 ]; then
- echo Error while adding crontab for user $TEST_USER2
- fi
-
- echo "sleeping for 130 seconds...."
- sleep 130
-
- EXIT_CODE=0
- test -e /tmp/cron_deny_test1 && EXIT_CODE=1
-
- if [ $EXIT_CODE = 0 ]; then
- echo "Cron did not allow user to execute job , TEST PASSED"
- else
- echo "Cron allowed user to execute test job, TEST FAILED"
- fi
-
- rm -f /tmp/cron_deny_test1
-
- exit $EXIT_CODE
-fi
-
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: main
-#-----------------------------------------------------------------------
-if [ $iam = "root" ]
-then
- do_setup
- echo $TEST_USER2 > $CRON_DENY
- EXIT_CODE=0
- su $TEST_USER1 -c "$0"
- if [ $? != 0 ]
- then
- EXIT_CODE=1
- fi
- su $TEST_USER2 -c "$0"
- if [ $? != 0 ]
- then EXIT_CODE=1
- fi
- do_cleanup
- exit $EXIT_CODE
-else
- run_test
-fi
diff --git a/testcases/commands/cron/cron_dirs_check.c b/testcases/commands/cron/cron_dirs_check.c
deleted file mode 100644
index cc9e0ad25..000000000
--- a/testcases/commands/cron/cron_dirs_check.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <unistd.h>
-
-/* Check directory Access */
-int check_directory_access(char *directory)
-{
-
- struct stat statbuf;
-
- printf("Checking %s\n", directory);
-
- if (stat(directory, &statbuf) == -1) {
- printf("FAIL: %s. Could not obtain directory status\n",
- directory);
- return 1;
- }
-
- if (statbuf.st_uid != 0) {
- printf("FAIL: %s. Invalid owner\n", directory);
- return 1;
- }
-
- if ((statbuf.st_mode & S_IWGRP) || (statbuf.st_mode & S_IWOTH)) {
- printf("FAIL: %s. Invalid write access\n", directory);
- return 1;
- }
-
- printf("PASS: %s\n", directory);
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
-
- if (argc != 2) {
- printf("Please enter target directory");
- return 1;
- }
-
- return check_directory_access(argv[1]);
-}
diff --git a/testcases/commands/cron/cron_dirs_checks01 b/testcases/commands/cron/cron_dirs_checks01
deleted file mode 100755
index ea1215e8d..000000000
--- a/testcases/commands/cron/cron_dirs_checks01
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#*********************************************************************
-# Copyright (c) International Business Machines Corp., 2000
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE : cron
-#
-# PUROPOSE: Ensure that the following directories only have root write access
-# /etc/cron.d
-# /etc/cron.daily
-# /etc/cron.hourly
-# /etc/cron.monthly
-# /etc/cron.weekly
-# /var/spool/cron
-# HISTORY:
-# Jerone Young (jyoung5@us.ibm.com)
-#
-
-DIRS="/etc/cron.d /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly /var/spool/cron"
-
-EXIT_CODE=0
-for i in $DIRS
-do
- cron_dirs_check $i
- if [ $? != 0 ]
- then
- echo "$i FAILED TEST!!!!!"
- EXIT_CODE=1
- fi
-
-done
-
-exit $EXIT_CODE
diff --git a/testcases/commands/cron/cron_illegal_cron_lines b/testcases/commands/cron/cron_illegal_cron_lines
deleted file mode 100644
index 3b32dc844..000000000
--- a/testcases/commands/cron/cron_illegal_cron_lines
+++ /dev/null
@@ -1,39 +0,0 @@
-# Collection of illegal cron lines
-# Comment lines must habe its '#' as first character.
-# The cron conf line and its description is seperated by '|'.
-# cron job command 'true' is appended automatically
-
-# Illegal Minutes
-61 * * * * | Minute 61
--1 * * * * | Minute -1 (might be interpreted as range)
-0.5 * * * * | Minute 0.5
--1-10 * * * *| Minute Range -1-10
-0-61 * * * * | Minute Range 0-61
-
-# Illegal hours
-0 25 * * * | Hour 25
-0 -2 * * * | Hour -2
-0 3.5 * * *| Hour 3.5
-0 -4-10 * * *| Hour Range -4-10
-0 0-25 * * * | Hour Range 0-25
-
-# Illegal day of month
-0 0 32 * * | Day 32
-0 0 -1 * * | Day -1
-0 0 3.5 * *| Day 3.5
-0 0 -3-3 * *| Day Range -3-3
-0 0 0-32 * *| Day Range 0-32
-
-# Illegal month
-0 0 1 13 * | Month 13
-0 0 1 -1 * | Month -1
-0 0 1 2.5 * | Month 2.5
-0 0 1 -2-3 * | Month Range -2-3
-0 0 1 0-13 * | Month Range 0-13
-
-# Illegal day of week
-0 0 * * 8 | Day of Week 8
-0 0 * * -2 | Day of Week -2
-0 0 * * 2.5 | Day of Week 2.5
-0 0 * * -7-7 | Day of Week Range -7-7
-0 0 * * 0-8 | Day of Week Range 0-8
diff --git a/testcases/commands/cron/cron_neg_tests.sh b/testcases/commands/cron/cron_neg_tests.sh
deleted file mode 100755
index 9c3d6f6c7..000000000
--- a/testcases/commands/cron/cron_neg_tests.sh
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/bash
-########################################################
-#
-# CHANGE ACTIVITY
-#
-# 10/01/04 Kris Wilson RHEL4 only allows super user
-# to use crontab.
-# to use crontab.
-# 12/03/04 Marty Ridgeway Pull RHEl4 tests out from script
-########################################################
-
-iam=`whoami`
-
-if [ $iam = "root" ]; then
- if [ $# -lt 1 ] ; then
- echo Either do not run this script as root or start it like
- echo " $0 <user>"
- exit 1
- fi
-
- su $1 -c "$0 $*"
- exit $?
-fi
-
-#
-# 1. root einen cronjob unterjubeln
-#
-
-finalrc=0
-
-
-crontab -u root - << EOF
-0 * * * * true
-EOF
-
-rc=$?
-
-if [ $rc = "0" ]; then
- echo root has now an interesting cron job
- echo "crontab has a severe security breach (FAIL)"
- echo
- finalrc=1
-else
- echo "Editing a crontab of another user failed successfully (PASS)"
- echo
-fi
-
-
-#
-# 2. write some illegal crontabs
-#
-
-# Save crontab
-
-#crontab -l > /dev/null 2> /dev/null
-#if [ $? = "0" ]; then
-# echo Saving current crontab...
-# echo
-# crontab -l > /tmp/save-crontab-`whoami`
-# savedcrontab=1
-# crontab -r
-#fi
-
-#for line in `cat cron_illegal_cron_lines | grep '^[^#]' | sed -e 's/[ \t][ \t]*/_/g'` ; do
-# line=`echo $line | sed -e 's/_/ /g'`
- # echo Line: "$line"
-# cronconf=`echo "$line" | cut -f 1 -d '|'`
-# desc=`echo "$line" | cut -f 2 -d '|'`
-
-# echo "Test: $desc"
-# echo "$cronconf true" | crontab -
- # echo "$cronconf"
-# if [ $? = "0" ]; then
-# echo 'Test FAILED (or crontab returned wrong exit code)'
-# echo 'crontab -l:'
-# crontab -l
-# finalrc=1
-# fi
-# echo
-#done
-
-
-# Test whether cron uses setuid correctly
-
-echo
-echo setuid test
-echo
-
-tmpscript=cron_neg01_test
-rm -rf $tmpscript.out >/dev/null 2>&1
-
-
-cat > /tmp/$tmpscript << EOF
-touch /root/halloichwarhier
-sleep 1
-cat /root/halloichwarhier ; echo "res:$?"
-rm /root/halloichwarhier
-EOF
-
-chmod 755 /tmp/$tmpscript
-
-#
-cronline=`date '+%M' | awk '{print ($1+2)%60 " * * * * "}'`
-(echo "$cronline /tmp/$tmpscript >> /tmp/$tmpscript.out 2>> /tmp/$tmpscript.out" ; \
- echo "$cronline /tmp/$tmpscript >> /$tmpscript.out 2>> /$tmpscript.out") \
- | crontab -
-
-echo "sleeping 130 secs..."
-sleep 130
-
-echo
-echo "Results:"
-if [ "1" = `cat /tmp/$tmpscript.out | grep "res:0" | wc -l` ]; then
- echo "setuid test part 1 successfully failed (PASS)"
-else
- echo "cron executed scripts have root privileges! (FAIL)"
- finalrc=1
-fi
-
-CODE=0
-test -e /tmp/$tmpscript.out && CODE=1
-if [ $CODE = "1" ]; then
- echo "setuid test part 2 successfully failed (PASS)"
-else
- echo "cron writes script output with root privileges! (FAIL)"
- finalrc=1
-fi
-echo
-
-rm /tmp/$tmpscript* >/dev/null 2>&1
-crontab -r
-
-# Restore crontab
-
-if [ "$savedcrontab" = "1" ]; then
- echo "Restoring crontab..."
- cat /tmp/save-crontab-`whoami` | grep '^[^#]' | crontab -
- # rm -r /tmp/save-crontab-`whoami`
-fi
-
-exit $finalrc
diff --git a/testcases/commands/cron/cron_pos_tests.sh b/testcases/commands/cron/cron_pos_tests.sh
deleted file mode 100755
index ece114c84..000000000
--- a/testcases/commands/cron/cron_pos_tests.sh
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/bin/bash
-
-# Positive tests for cron, that means these tests have to pass
-
-iam=`whoami`
-
-tvar=${MACHTYPE%-*}
-tvar=${tvar#*-}
-
-if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ]
-then
- CRON_ALLOW="/etc/cron.allow"
-else
- CRON_ALLOW="/var/spool/cron/allow"
-fi
-
-
-if [ $iam = "root" ]; then
- if [ $# -lt 1 ] ; then
- echo Either do not run this script as root or start it like
- echo " $0 <user>"
- exit 1
- fi
-
- mv $CRON_ALLOW $CRON_ALLOW.old >/dev/null 2>&1
- su $1 -c "$0 $*"
- RC=$?
- mv $CRON_ALLOW.old $CRON_ALLOW >/dev/null 2>&1
- exit $RC
-fi
-
-function restorecrontab () {
- test -e /tmp/crontab-save-$iam && \
- crontab /tmp/crontab-save-$iam && \
- rm -f /tmp/crontab-save-$iam && \
- echo restored old crontab
-}
-
-echo Running as user $iam...
-
-# Save current users crontab
-
-test -e /tmp/crontab-save-$iam && rm -f /tmp/crontab-save-$iam
-
-if [ "0" -lt `crontab -l 2>/dev/null | wc -l` ]; then
-
- echo 'crontab of this user exists -> creating backup'
- crontab -l | grep '^[^#]' > /tmp/crontab-save-$iam
-fi
-
-
-# Do tests
-
-# 1. Add new job
-
-rm -rf /tmp/crontest >/dev/null 2>&1
-mkdir -p /tmp/crontest
-
-cat > /tmp/crontest/testjob_cron01 << EOF
-echo Testjob running
-date
-EOF
-
-chmod 755 /tmp/crontest/testjob_cron01
-
-crontab - << EOF
-`date '+%M' | awk '{ print ($1+2)%60 " * * * * "
-}'` /tmp/crontest/testjob_cron01 >> /tmp/crontest/output_cron01 2>&1
-EOF
-
-rc=$?
-
-if [ $rc = "1" ]; then
- echo Error while adding crontab for user $iam
- restorecrontab
- exit 1
-fi
-
-echo new job added successfully
-
-# 2. Wait for execution of job
-
-echo 'sleeping for 130 seconds...'
-sleep 130
-
-rc=1
-test -e /tmp/crontest/output_cron01 && rc=0
-
-if [ $rc = "1" ]; then
- echo Job has not been executed
- restorecrontab
- exit 1
-fi
-
-grep "Testjob running" /tmp/crontest/output_cron01
-rc=$?
-if [ $rc = "1" ]; then
- echo Job has not produced valid output
- restorecrontab
-fi
-
-echo 'job has been executed :-)'
-echo "testjob's output:"
-echo
-
-rm -rf /tmp/crontest
-
-# 3. Delete crontab
-
-crontab -r
-
-echo removed crontab
-
-# Restore old crontab file
-
-restorecrontab
-
-exit $rc
diff --git a/testcases/commands/cron/cron_tests.sh b/testcases/commands/cron/cron_tests.sh
deleted file mode 100644
index 47614f9e3..000000000
--- a/testcases/commands/cron/cron_tests.sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) International Business Machines Corp., 2001
-# Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Author: Manoj Iyer <manjo@mail.utexas.edu>
-
-TST_CNT=3
-TST_TESTFUNC=do_test
-TST_NEEDS_TMPDIR=1
-TST_SETUP=setup
-TST_CLEANUP=cleanup
-. tst_test.sh
-
-. daemonlib.sh
-
-SYSLOG_STARTED=
-CROND_STARTED=
-LOGS=
-
-grep_logs()
-{
- local pattern="$1"
- local fail_msg="$2"
- local pass_msg="${3:-}"
- local n="${4:-10}"
-
- local lines=10
- local out=out.$$
- local err=err.$$
- local i ret
-
- for i in $(seq 1 $n); do
- if [ "$LOGS" ]; then
- tail -n $lines $LOGS | grep "$pattern" > $out 2> $err
- else
- journalctl -n $lines | grep "$pattern" > $out 2> $err
- fi
- ret=$?
- [ $ret -eq 0 ] && break
- sleep 1
- done
-
- if [ $ret -ne 0 ]; then
- tst_res TFAIL "$fail_msg: `cat $err`"
- else
- [ "$pass_msg" ] && tst_res TPASS "$pass_msg"
- fi
-}
-
-create_crontab()
-{
- local crontab=cronjob.cron
- local script=$1
- local out=out.$$
-
- tst_res TINFO "creating crontab: $script"
-
- cat > $crontab <<EOF
-* * * * * $script
-EOF
-
- tst_res TINFO "installing crontab file"
- crontab $crontab > $out 2>&1
- if [ $? -ne 0 ]; then
- tst_brk TBROK "crontab: error while installing crontab file: `cat $out`"
- return 1
- fi
- return 0
-}
-
-remove_crontab()
-{
- local out=out.$$
- tst_res TINFO "removing crontab file"
- crontab -r > $out 2>&1
- if [ $? -ne 0 ]; then
- tst_brk TBROK "crontab: error while removing crontab file `cat $out`"
- return 1
- fi
- return 0
-}
-
-create_hello_script()
-{
- local script=$1
-
- cat > $script <<EOF
-#!/bin/sh
-echo "Hello Hell"
-exit 0
-EOF
- chmod +x $script
-}
-
-install_cron_test()
-{
- local script=$PWD/cronprg.sh
- local cron_out=$PWD/tst1_cron.out
- local err=err.log
- local sleep_sec
- local ts_min1 ts_min2 fail
-
- tst_res TINFO "test install cron job"
-
- cat > $script <<EOF
-#! /bin/sh
-DATE=\`LC_ALL=C date\`
-echo "Hello Hell today is \$DATE" > $cron_out 2>&1
-exit 0
-EOF
- chmod +x $script
-
- create_crontab $script 2> $err
-
- if [ $? -ne 0 ]; then
- tst_brk TBROK "crontab: error while creating cron job: `cat $err`"
- else
- tst_res TINFO "cron job installed successfully"
- fi
-
- grep_logs 'crontab.*REPLACE' \
- "cron activity not recorded" \
- "cron activity logged"
-
- # Sleep 3s after next minute since the loop below sleeps for 62 seconds, we
- # should start this 5-iteration loop closely following the start of a
- # minute.
- sleep_sec=$((123-`date +%-S`))
- tst_res TINFO "sleep for ${sleep_sec}s"
- sleep $sleep_sec
-
- # $script executed by the cron job will record the date and time into file
- # $cron_out. Get the minute recorded by the program, sleep to allow the cron
- # job to update file after 1m, and check if the value is advanced by 1.
- for i in $(seq 1 5); do
- tst_res TINFO "loop: $i: start"
-
- if [ ! -f "$cron_out" ]; then
- tst_res TFAIL "loop $i: file $cron_out doesn't exist"
- fail=1
- break
- fi
-
- ts_min1=$(awk '{print $8}' $cron_out | awk -F: '{printf("%d", $2);}')
-
- # wait for the cron job to update output file
- sleep 62
-
- # Check the time recorded in output file, this should be 1 minute ahead of
- # what was recored earlier.
- ts_min2=$(awk '{print $8}' $cron_out | awk -F: '{printf("%d", $2);}')
-
- if [ "x${ts_min1}" = "x" ] || [ "x${ts_min2}" = "x" ]; then
- tst_res TFAIL "loop $i: failed to get time: ts_min1: $ts_min1, ts_min2: $ts_min2"
- fail=1
- break
- fi
-
- [ $ts_min1 -eq 59 ] && ts_min1=0 || ts_min1=$(( $ts_min1+1 ))
-
- if [ $ts_min2 -ne $ts_min1 ]; then
- tst_res TFAIL "loop $i: failed to update every minute: expected: $ts_min1, received: $ts_min2"
- fail=1
- break
- fi
- done
-
- if [ ! "$fail" ]; then
- grep_logs "CMD ($script)" \
- "failed to install cron job installed and execute it" \
- "cron job installed and executed" 1
- fi
-
- remove_crontab
-}
-
-remove_cron_job_test()
-{
- local script=$PWD/cronprg.sh
-
- tst_res TINFO "test remove cron job"
-
- create_hello_script $script
- create_crontab $script
-
- grep_logs 'crontab.*REPLACE' \
- "crontab activity not recorded"
-
- remove_crontab && grep_logs DELETE \
- "crontab activity not recorded" \
- "crontab removed the cron job" 1
-}
-
-list_cron_jobs_test()
-{
- local script=$PWD/cronprg.sh
- local out=cron.out
-
- tst_res TINFO "test list installed cron jobs"
-
- create_hello_script $script
- create_crontab $script
-
- tst_res TINFO "crontab: listing cron jobs"
- crontab -l | grep "$script" > $out 2>&1 || \
- tst_brk TBROK "crontab failed while listing installed cron jobs: `cat $out`"
-
- remove_crontab
-
- crontab -l > $out 2>&1
- if [ $? -ne 0 ]; then
- grep -q "no crontab for" $out
- if [ $? -ne 0 ]; then
- tst_res TFAIL "crontab failed removing cron job: `cat $out`"
- else
- tst_res TPASS "crontab did not list any cron jobs"
- fi
- else
- tst_res TFAIL "crontab failed removing cron job: `cat $out`"
- fi
-}
-
-setup()
-{
- if [ "$SYSLOG_DAEMON" ]; then
- status_daemon $SYSLOG_DAEMON
- if [ $? -ne 0 ]; then
- restart_daemon $SYSLOG_DAEMON
- SYSLOG_STARTED=1
- fi
- fi
-
- if [ "$CROND_DAEMON" ]; then
- status_daemon $CROND_DAEMON
- if [ $? -ne 0 ]; then
- restart_daemon $CROND_DAEMON
- CROND_STARTED=1
- fi
- fi
-
- for f in /var/log/syslog /var/log/messages /var/log/cron /var/log/cron.log; do
- [ -f "$f" ] && LOGS="$f $LOGS"
- done
-}
-
-cleanup()
-{
- [ "$SYSLOG_STARTED" = "1" ] && stop_daemon $SYSLOG_DAEMON
- [ "$CROND_STARTED" = "1" ] && stop_daemon $CROND_DAEMON
-}
-
-do_test()
-{
- case $1 in
- 1) install_cron_test;;
- 2) remove_cron_job_test;;
- 3) list_cron_jobs_test;;
- esac
-}
-
-tst_run
diff --git a/testcases/commands/su/Makefile b/testcases/commands/su/Makefile
deleted file mode 100644
index da2ff036f..000000000
--- a/testcases/commands/su/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# commands/su testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir ?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := su01 su01_s1 su_set_passwd
-
-MAKE_TARGETS :=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
deleted file mode 100755
index 34386d937..000000000
--- a/testcases/commands/su/su01
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/bash
-#*********************************************************************
-# Copyright (c) International Business Machines Corp., 2003, 2004
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE : su
-#
-# PURPOSE: Tests the basic functionality of `su`.
-#
-# SETUP: The program `/usr/bin/expect' MUST be installed.
-#
-# HISTORY:
-# 03/03 Dustin Kirkland (dkirklan@us.ibm.com)
-# 03/03 Jerone Young (jeroney@us.ibm.com)
-# 10/01/04 Kris Wilson Port to Red Hat
-#
-#*********************************************************************
-
-echo "This script contains bashism that needs to be fixed!"
-
-if [ -z ${TCbin} ]
-then
- export TCbin=$PWD
-fi
-
-export TEST_USER1="su_usr1"
-
-tvar=${MACHTYPE%-*}
-tvar=${tvar#*-}
-
-# need to export tvar for su01_s1
-export tvar
-printf "Machine type is: $tvar\n\n"
-
-if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ]
-# Need to also set group for TEST_USER2
-then
-export TEST_USER1_GROUP="wheel"
-export TEST_USER2_GROUP="wheel"
-else
-export TEST_USER1_GROUP="trusted"
-export TEST_USER2_GROUP="trusted"
-fi
-export TEST_USER1_PASSWD="eal"
-export TEST_USER1_ENCRYPTED_PASSWD="42VmxaOByKwlA"
-export TEST_USER1_NEW_PASSWD="a_very_good_and_long_password"
-export TEST_USER1_HOMEDIR="/home/$TEST_USER1"
-
-export TEST_USER2="su_usr2"
-# Group needs to be trusted for Red Hat.
-#export TEST_USER2_GROUP="trusted"
-export TEST_USER2_PASSWD="eal"
-export TEST_USER2_ENCRYPTED_PASSWD="42VmxaOByKwlA"
-export TEST_USER2_HOMEDIR="/home/$TEST_USER2"
-
-#This is for enviroment test
-export TEST_LINE="YOU_HAVE_THE_VARIABLE"
-export TEST_ENV_FILE="/tmp/TEST_ENV_FILE_ROOT"
-export TEST_ENV_FILE_USER="/tmp/TEST_ENV_FILE_USER"
-export TEST_ENV_FILE2="/tmp/TEST_ENV_FILE_ROOT2"
-#-----------------------------------------------------------------------
-# FUNCTION: do_setup
-#-----------------------------------------------------------------------
-
-do_setup(){
-
-#REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
-rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
-rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
-rm -f $TEST_ENV_FILE > /dev/null 2>&1
-
-
-#Create 1st test user
- #erase user if he may exist , so we can have a clean en
- rm -rf /home/$TEST_USER1
- getent passwd $TEST_USER1 > /dev/null 2>&1 && userdel $TEST_USER1
- sleep 1
-
- useradd -m -g users $TEST_USER1
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER1."
- exit 1
- }
- fi
-
- usermod -G users,$TEST_USER1_GROUP $TEST_USER1
-
- #create users home directory (SLES 8 does not do this, even when specified in adduser)
-# Only do this if not RH; RH creates the directory.
- if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ]
- then {
- USER_UID=`id -u $TEST_USER1`
- USER_GID=`id -g $TEST_USER1`
- mkdir -p $TEST_USER1_HOMEDIR
- chown -R $USER_UID.$USER_GID $TEST_USER1_HOMEDIR
- }
- fi
-
- usermod -p $TEST_USER1_ENCRYPTED_PASSWD $TEST_USER1 > /dev/null 2>&1
- if [ $? != 0 ]
- then {
- echo "Could not set password for test user $TEST_USER1"
- exit 1
- }
- fi
-
-#Create 2nd test user
- #erase user if he may exist , so we can have a clean en
- rm -rf /home/$TEST_USER2
- getent passwd $TEST_USER2 > /dev/null 2>&1 && userdel $TEST_USER2
- sleep 1
-
- useradd -m -g users $TEST_USER2
-
- if [ $? != 0 ]
- then {
- echo "Could not add test user $TEST_USER2."
- exit 1
- }
- fi
-
- usermod -G users,$TEST_USER2_GROUP $TEST_USER2
-
- #create users home diretory (SLES 8 does not do this, even when specified in adduser)
-# Only do this if not RH; RH creates the directory.
- if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ]
- then {
- USER_UID=`id -u $TEST_USER2`
- USER_GID=`id -g $TEST_USER2`
- mkdir -p $TEST_USER2_HOMEDIR
- chown -R $USER_UID.$USER_GID $TEST_USER2_HOMEDIR
- }
- fi
-
- usermod -p $TEST_USER2_ENCRYPTED_PASSWD $TEST_USER2 > /dev/null 2>&1
- if [ $? != 0 ]
- then {
- echo "Could not set password for test user $TEST_USER2"
- exit 1
- }
- fi
-}
-
-
-#-----------------------------------------------------------------------
-# FUNCTION: do_cleanup
-#-----------------------------------------------------------------------
-
-do_cleanup() {
- rm -rf /home/$TEST_USER1
- rm -rf /home/$TEST_USER2
- userdel $TEST_USER1
- userdel $TEST_USER2
- #REMOVE ANY TEMPOARY FILES THAT MAY STILL BE AROUND
- rm -f $TEST_ENV_FILE_USER > /dev/null 2>&1
- rm -f $TEST_ENV_FILE2 > /dev/null 2>&1
- rm -f $TEST_ENV_FILE > /dev/null 2>&1
-}
-
-#-----------------------------------------------------------------------
-# FUNCTION: MAIN
-#-----------------------------------------------------------------------
-do_setup
-/bin/su $TEST_USER1 -c ${TCbin}/su01_s1
-EXIT_CODE=$?
-do_cleanup
-exit $EXIT_CODE
diff --git a/testcases/commands/su/su01_s1 b/testcases/commands/su/su01_s1
deleted file mode 100755
index 313207b64..000000000
--- a/testcases/commands/su/su01_s1
+++ /dev/null
@@ -1,486 +0,0 @@
-#! /usr/bin/expect -f
-#*********************************************************************
-# Copyright (c) International Business Machines Corp., 2003, 2004, 2007
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# FILE : su
-#
-# PURPOSE: Tests the basic functionality of `su`.
-#
-# SETUP: The program `/usr/bin/expect' MUST be installed.
-# The user invoking this test script must NOT be "root".
-# The PASSWD variable should be set prior to execution
-#
-# HISTORY:
-# 03/03 Dustin Kirkland (dkirklan@us.ibm.com)
-# 03/03 Jerone Young (jeroney@us.ibm.com)
-# 10/01/04 Kris Wilson Skip test 7 if RedHat; no -e option.
-# 05/23/07 Kris Wilson Make test 7 work for SLES.
-########################################################################
-
-# The root user cannot succesfully execute su test because the root user
-# is able to become anyone without entering passwords
-set whoami [ exec whoami ]
-if { $whoami=="root" } {
- send_user "ERROR: You must execute the 'su' tests as a non-root user\n"
- exit 1
-}
-
-#Grab input from enviroment
-if [info exists env(PASSWD)] {
- set PASSWD $env(PASSWD)
-} else {
- send_user "YOU NEED TO SET ENVIROMENT VARIABLE PASSWD. \n"
- exit 1
-}
-
-if [info exists env(TEST_USER2)] {
- set USER1 $env(TEST_USER2)
-} else {
- send_user "YOU MUST SET ENVIRONMENT VARIABLE TEST_USER2"
- exit 1
-}
-
-# Need the release type from su01
-if [info exists env(tvar)] {
- set distro $env(tvar)
-} else {
- send_user "YOU MUST SET ENVIORMENT VARIABLE tvar"
- exit 1
-}
-
-if [info exists env(TEST_USER2_PASSWD)] {
- set USER1_PASSWORD $env(TEST_USER2_PASSWD)
-} else {
- send_user "YOU MUST SET ENVIROMENT VARIABLE TEST_USER2_PASSWD"
- exit 1
-}
-
-if [info exists env(TEST_LINE)] {
- set TEST_LINE_ENV $env(TEST_LINE)
-} else {
- send_user "YOU MUST SET ENVIROMENT VARIABLE TEST_LINE"
- exit 1
-}
-
-
-if [info exists env(TEST_ENV_FILE)] {
- set TEST_ENV_FILE $env(TEST_ENV_FILE)
-} else {
- send_user "YOU MUST SET ENVIROMENT VARIABLE TEST_ENV_FILE_USER"
- exit 1
-}
-
-if [info exists env(TEST_ENV_FILE2)] {
- set TEST_ENV_FILE2 $env(TEST_ENV_FILE2)
-} else {
- send_user "YOU MUST SET ENVIROMENT VARIABLE TEST_ENV_FILE2"
- exit 1
-}
-
-
-if [info exists env(TEST_ENV_FILE_USER)] {
- set TEST_ENV_FILE_USER1 $env(TEST_ENV_FILE_USER)
-} else {
- send_user "YOU MUST SET ENVIROMENT VARIABLE TEST_ENV_FILE_USER"
- exit 1
-}
-
-if [info exists env(TEST_USER1_NEW_PASSWD)] {
- set USER1_NEW_PASSWORD $env(TEST_USER1_NEW_PASSWD)
-} else {
- send_user "YOU MUST SET ENVIROMENT VARIABLE TEST_USER1_NEW_PASSWD"
- exit 1
-}
-
-
-set script_exit_code 0
-set i_can_root 0
-
-send_user "Starting 'su' Testing\n"
-
-# 1) su with no parameters and correct password.
-# - The su command should return a result code of 0
-# - The user ID should be root
-# - The user environment should be that of the invoking process
-# - The command should create a new shell with a new process ID
-
-send_user "\nTEST: su with no parameters and correct password\n"
-
-set i_am_root 0
-# run "whoami" to test user ID inside su shell
-spawn /bin/su -c whoami
-set i_am_root 0
-expect {
- "Password:" {
- send "$PASSWD\r"
- expect {
- "root" { set i_am_root 1
- set i_can_root 1
- }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-
-#Check that su user has same enviroment as current user
-set i_have_env 0
-set test_env_var " "
-if { $i_am_root==1 } {
- spawn su -c "/bin/su root -c \"echo \\\$TEST_LINE > $TEST_ENV_FILE\""
- expect {
- "Password:" {
- send "$PASSWD\r"
- }
- }
- expect eof
- wait
-
- set test_env_var [exec cat $TEST_ENV_FILE]
-
- if { $test_env_var==$TEST_LINE_ENV } {
- set i_have_env 1
- } else {
- send_user "/bin/su with correct password (FAILED), the enviroment was not kept after su.\n"
- }
-}
-
-
-#this variable is for any test, it can't run correctly if this test fails
-set test_one_passed 0
-
-if { ($i_am_root==1) && ($exit_code==0) && ($pid>0) && ($i_have_env==1) } {
- send_user "/bin/su with correct password & enviroment check ( PASSED )\n"
- set test_one_passed 1
-} else {
- send_user "/bin/su with correct password ( FAILED )\n"
- set script_exit_code 1
-}
-
-
-# 2) su with no parameters and incorrect password.
-# - The su command should return a result code of non-0
-# - The user should be returned to the invoking shell
-# - An appropriate failure message should be displayed
-
-send_user "\nTEST: su with no parameters and incorrect password \n"
-
-set displayed_error 0
-# run "whoami" to test user ID inside su shell
-spawn /bin/su -c whoami
-set displayed_error 0
-expect {
- "Password:" {
- send "wrong_$PASSWD\r"
- expect {
- "su: incorrect password" { set displayed_error 1 }
- "su: Authentication failure" { set displayed_error 1 }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-
-#Added for arm architecture
-
-send_user "\ndisplayed_error=$displayed_error"
-send_user "\nexit_code=$exit_code"
-send_user "\npid=$pid\n"
-
-if { ($displayed_error==1) && ($exit_code!=0) && ($pid>0) } {
- send_user "/bin/su with incorrect password ( PASSED )\n"
-} else {
- send_user "/bin/su with incorrect password ( FAILED )\n"
- set script_exit_code 1
-}
-
-# 3) su to root using name parameter and correct password.
-# - The su command should return a result code of 0
-# - The user ID should be root
-# - The user environment should be that of the invoking process
-# - The command should create a new shell with a new process ID
-
-send_user "\nTEST: su to root using name parameter and correct password. \n"
-
-set i_am_root 0
-# run "whoami" to test user ID inside su shell
-spawn /bin/su -l root -c whoami
-expect {
- "Password:" {
- send "$PASSWD\r"
- expect {
- "root" { set i_am_root 1 }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-
-
-#Check that su user does not have the same enviroment as current user
-set i_have_env 0
-set test_env " "
-if { $i_am_root==1 } {
- spawn /bin/sh -c "/bin/su -l root -c \"echo \"\\\$TEST_LINE > $TEST_ENV_FILE2\"\""
- expect {
- "Password:" {
- send "$PASSWD\r"
- }
- }
-
- set test_env [exec cat $TEST_ENV_FILE2]
-
- if { $test_env==$TEST_LINE_ENV } {
- set i_have_env 1
- send_user "/bin/su -l root with correct password (FAILED), because it did not change enviroment\n"
- }
-}
-
-
-if { ($i_am_root==1) && ($exit_code==0) && ($pid>0) && ($i_have_env==0) } {
- send_user "/bin/su -l root with correct password & enviroment check ( PASSED )\n"
-} else {
- send_user "/bin/su -l root with correct password ( FAILED )\n"
- set script_exit_code 1
-}
-
-
-# 4) su to root with name parameter and incorrect password.
-# - The su command should return a result code of non-0
-# - The user should be returned to the invoking shell
-# - An appropriate failure message should be displayed
-
-send_user "\nTEST: su to root with name parameter and incorrect password. \n"
-
-set displayed_error 0
-# run "whoami" to test user ID inside su shell
-spawn /bin/su -l root -c whoami
-expect {
- "Password:" {
- send "wrong_$PASSWD\r"
- expect {
- "su: incorrect password" { set displayed_error 1 }
- "su: Authentication failure" { set displayed_error 1 }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-if { ($displayed_error==1) && ($exit_code!=0) && ($pid>0) } {
- send_user "/bin/su -l root with incorrect password ( PASSED )\n"
-} else {
- send_user "/bin/su -l root with incorrect password ( FAILED )\n"
- set script_exit_code 1
-}
-
-
-# 5) su to user1 with name parameter and correct password.
-# - The su command should return a result code of 0
-# - The user ID should be user1
-# - The user environment should be that of the invoking process, in this case,that of user1
-# - The command should create a new shell with a new process ID
-# - Run "whoami" to test user ID inside su shell
-
-send_user "TEST: su to user1 with name parameter and correct password.\n"
-
-set i_am_correct 0
-spawn /bin/su -l $USER1 -c whoami
-expect {
- "Password:" {
- send "$USER1_PASSWORD\r"
- expect {
- "$USER1\r" { set i_am_correct 1 }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-
-set i_have_env 0
-set test_env_var 0
-#Check to see that su user does not have the same enviroment
-if { $i_am_correct==1 } {
- spawn /bin/sh -c "/bin/su -l $USER1 -c \"echo \"\\\$TEST_LINE > $TEST_ENV_FILE_USER1\"\""
- expect {
- "Password:" {
- send "$USER1_PASSWORD\r"
- }
- }
-
-}
-
-set test_env_var [exec cat $TEST_ENV_FILE_USER1]
-
-set i_have_env 0
-if { $test_env_var==$TEST_LINE_ENV } {
- set i_have_env 1
- send_user "/bin/su -l $USER1 with correct password (FAILED), because it did not change enviroment\n"
- set i_have_env 0
- if { $test_env_var==$TEST_LINE_ENV } {
- set i_have_env 1
- send_user "su -l $USER1 with correct password (FAILED), because it did not change enviroment\n"
- }
-}
-
-if { ($i_am_correct==1) && ($exit_code==0) && ($pid>0) && ($i_have_env==0) } {
- send_user "/bin/su -l $USER1 with correct password & enviroment check ( PASSED )\n"
-} else {
- send_user "/bin/su -l $USER1 with correct password ( FAILED )\n"
- set script_exit_code 1
-}
-
-
-
-# 6)su to user1 with name parameter and incorrect password.
-# - The su command should return a result code of non-0
-# - The user should be returned to the invoking shell
-# - An appropriate failure message should be displayed.
-
-send_user "TEST: su to user1 with name parameter and incorrect password.\n"
-spawn /bin/su -l $USER1 -c whoami
-set displayed_error 0
-expect {
- "Password:" {
- send "wrong_$USER1_PASSWORD\r"
- expect {
- "su: incorrect password" { set displayed_error 1 }
- "su: Authentication failure" { set displayed_error 1 }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-if { ($displayed_error==1) && ($exit_code!=0) && ($pid>0) } {
- send_user "/bin/su -l $USER1 with incorrect password ( PASSED )\n"
-} else {
- send_user "/bin/su -l $USER1 with incorrect password ( FAILED )\n"
- set script_exit_code 1
-}
-
-
-# 7) su to user1 with the user1 password expired
-# - user1 should not be allowed to log in
-# - The su command should return a result code of non-0
-# - The user should be returned to the invoking shell
-# - An appropriate failure message should be displayed.
-
-# Become root and expire $USER1 password
-
-# Skip this if Red Hat; -e option not supported.
-if { $distro != "redhat" && $distro != "redhat-linux" } {
-
-if { $test_one_passed==1} {
-send_user "TEST: su to user1 with the user1 password expired.\n"
-
-spawn /bin/su -l root -c "passwd -e $USER1"
-expect {
- "Password:" {
- send "$PASSWD\r"
- expect {
- "Password expiry information changed."
- }
- }
-}
-
-set i_am_correct 0
-spawn /bin/su -l $USER1 -c whoami
-expect {
- "Password:" {
- send "$USER1_PASSWORD\r"
- expect {
- -re "current.*password|Old Password" {
- send "wrong_$USER1_PASSWORD\r"
- expect {
- -re "current.*password|Old Password" {
- send "wrong_$USER1_PASSWORD\r"
- expect {
- "su: incorrect password" { set i_am_correct 1 }
- "su: Authentication failure" { set i_am_correct 1 }
- "su: Authentication token manipulation error" { set i_am_correct 1 }
- }
- }
- "su: incorrect password" { set i_am_correct 1 }
- "su: Authentication failure" { set i_am_correct 1 }
- "su: Authentication token manipulation error" { set i_am_correct 1 }
- }
- }
- }
- }
-}
-
-# capture result code
-set codes [wait]
-set pid [lindex $codes 0]
-set exit_code [lindex $codes 3]
-if { ($i_am_correct==1) && ($exit_code!=0) && ($pid>0) } {
- send_user "/bin/su -l $USER1 with expired correct password ( PASSED )\n"
-} else {
- send_user "/bin/su -l $USER1 with expired correct password ( FAILED )\n"
- set script_exit_code 1
-}
-
-
-#Become root and set $USER1 password back to previous value
-spawn /bin/su -l root -c "passwd $USER1"
-expect {
- "Password: " {
- send "$PASSWD\r"
- expect {
- "Enter new password: " {
- send "$USER1_NEW_PASSWORD\r"
- expect {
- "Re-type new password: " {
- send "$USER1_NEW_PASSWORD\r"
- expect {
- "Password changed" {}
- }
- }
- }
- }
- }
- }
-}
-
-} else {
-
- send_user "TEST: su to user1 with the user1 password expired. (FAILED),see more next line.\n"
- send_user "This test cannot be run because the first test to su as root failed\n"
-
-}
-# If RH let the tester know why only 6 tests were run.
-} else {
- send_user "TEST 7 skipped if running on Red Hat; -e not supported \n"
-}
-exit $script_exit_code
diff --git a/testcases/commands/su/su_set_passwd b/testcases/commands/su/su_set_passwd
deleted file mode 100755
index e8f0d2f50..000000000
--- a/testcases/commands/su/su_set_passwd
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# Set Password for a specific new user
-# This script should be run as 'root'
-#
-# Example:
-# ./su_set_passwd USER ENCRYPTED_PASSWD
-#
-
-USER=$1
-ENCRYPTED_PASSWD=$2
-
-usermod -p $ENCRYPTED_PASSWD $USER
-exit $?
diff --git a/testcases/kernel/fs/acls/.gitignore b/testcases/kernel/fs/acls/.gitignore
deleted file mode 100644
index 5fa2fc654..000000000
--- a/testcases/kernel/fs/acls/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/acl_file_test
-/acl_link_test
diff --git a/testcases/kernel/fs/acls/Makefile b/testcases/kernel/fs/acls/Makefile
deleted file mode 100644
index 4f1564377..000000000
--- a/testcases/kernel/fs/acls/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# kernel/fs/acls testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-check_header = $(shell \
- if echo "\#include <$(1)>" | $(CC) -E - > /dev/null 2>&1 ; \
- then echo yes ; \
- else echo no ; fi)
-
-INSTALL_TARGETS := acl_test01
-
-RESULT := $(call check_header,sys/xattr.h)
-
-ifneq ($(RESULT),yes)
-MAKE_TARGETS :=
-endif
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/acls/acl_file_test.c b/testcases/kernel/fs/acls/acl_file_test.c
deleted file mode 100644
index eb30d28ef..000000000
--- a/testcases/kernel/fs/acls/acl_file_test.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <sys/syscall.h>
-#include <fcntl.h>
-#include <sys/xattr.h>
-#include <string.h>
-
-int main(int argc, char *argv[])
-{
- ssize_t s;
- char *tok;
- char value[1024];
- char list[1024];
- int rc = 0;
- char *file;
- int fd;
-
- if (argc < 2) {
- printf("Please enter a file name as argument.\n");
- return -1;
- }
-
- file = argv[1];
-
- fd = open(file, O_RDONLY);
- if (fd < 0) {
- printf("Unable to open file %s !", file);
- return -1;
- }
-
- if (-1 == (s = flistxattr(fd, list, 1024))) {
- perror("flistxattr");
- return 1;
- }
- if (s == 0) {
- printf("No xattrs defined for %s, further testcase useless\n",
- file);
- return 1;
- }
- tok = strtok(list, "\0");
- s = fgetxattr(fd, tok, (void *)value, 1024);
- if (s == -1) {
- perror("fgetxattr");
- return 1;
- }
- s = fsetxattr(fd, tok, (void *)value, s, 0);
-
- if (s == -1) {
- printf
- ("User unable to change extended attributes on file %s !\n",
- argv[1]);
- printf("errno = %i\n", errno);
- rc = 1;
- }
- //s = syscall(237, fd,tok); //fremovexattr
-#ifdef __NR_fremovexattr
- s = syscall(__NR_fremovexattr, fd, tok); //fremovexattr
-#else
- s = -1;
- errno = ENOSYS;
-#endif
- if (s == -1) {
- printf("User unable to remove extended attributes file %s !\n",
- argv[1]);
- printf("errno = %i\n", errno);
- rc = 1;
- }
-
- close(fd);
- return rc;
-}
diff --git a/testcases/kernel/fs/acls/acl_link_test.c b/testcases/kernel/fs/acls/acl_link_test.c
deleted file mode 100644
index 312f686a1..000000000
--- a/testcases/kernel/fs/acls/acl_link_test.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <sys/syscall.h>
-#include <string.h>
-#include <sys/xattr.h>
-
-int main(int argc, char *argv[])
-{
- ssize_t s;
- char *tok;
- char value[1024];
- char list[1024];
- int rc = 0;
-
- if (argc < 2) {
- printf("Please enter a file name as argument.\n");
- return -1;
- }
-
- if (-1 == (s = listxattr(argv[1], list, 1024))) {
- perror("listxattr");
- return 1;
- }
- if (s == 0) {
- printf("No xattrs defined for %s, further testcase useless\n",
- argv[1]);
- return 1;
- }
- tok = strtok(list, "\0");
- s = getxattr(argv[1], tok, (void *)value, 1024);
- if (-1 == s) {
- perror("getxattr");
- return -1;
- }
-
- s = lsetxattr(argv[1], tok, (void *)value, s, 0);
-
- if (s == -1) {
- printf("User unable to change extended attributes %s !\n",
- argv[1]);
- printf("errno = %i\n", errno);
- rc = 1;
- }
-
- s = lremovexattr(argv[1], tok);
- if (s == -1) {
- printf("User unable to remove extended attributes %s !\n",
- argv[1]);
- printf("errno = %i\n", errno);
- rc = 1;
- }
-
- return rc;
-}
diff --git a/testcases/kernel/fs/acls/acl_test01 b/testcases/kernel/fs/acls/acl_test01
deleted file mode 100755
index 4fbd72f75..000000000
--- a/testcases/kernel/fs/acls/acl_test01
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/bin/sh
-#*********************************************************************
-# Copyright (c) International Business Machines Corp., 2003
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#
-#
-# FILE : acls
-#
-# PURPOSE: Tests extended acls
-#
-# HISTORY:
-# 03/03 Jerone Young (jyoung5@us.ibm.com)
-# 09/08 Jacky Malcles changing the setup to have this TC started by runltp
-#*********************************************************************
-#
-################################################################
-#
-# Make sure that uid=root is running this script.
-# Make sure that loop device is built into the kernel
-# Make sure that ACL(Access Control List) and Extended Attribute are
-# built into the kernel
-#
-#
-################################################################
-
-export TCID=acltest01
-export TST_TOTAL=5
-export TST_COUNT=1
-
-. test.sh
-
-TMP=${TMP:=/tmp}
-
-TEST_USER1="acltest1"
-TEST_USER1_GROUP="users"
-TEST_USER1_PASSWD="ltp_test_pass1"
-TEST_USER1_HOMEDIR="$TMP/tacl/mount-ext3/$TEST_USER1"
-
-FILE_ACL="$TMP/tacl/mount-ext3/test_file"
-FILE_ACL_LINK="$TMP/tacl/mount-ext3/test_file_link"
-TCbin=`pwd`
-
-COMMAND=$(command -v "getenforce" "setenforce" |wc -l)
-if [ $COMMAND -eq 2 ]; then
- SELINUX=$(getenforce)
-else
- SELINUX=""
-fi
-
-do_setup()
-{
- tst_require_root
- tst_test_cmds setfacl
-
- if ! ( test -d $TMP/tacl || mkdir -m 777 $TMP/tacl) ; then
- tst_brkm TBROK "Failed to create $TMP/tacl directory."
- fi
-
- dd if=/dev/zero of=$TMP/tacl/blkext3 bs=1k count=10240 && chmod 777 $TMP/tacl/blkext3
- if [ $? -ne 0 ] ; then
- tst_brkm TBROK "Failed to create $TMP/tacl/blkext3"
- fi
-
- if ! LOOP_DEV=$(losetup -f) || [ "x$LOOP_DEV" = x ]; then
- tst_brkm TCONF "[ losetup.1 ] Failed to find an available loopback device -- is the required support compiled in your kernel?"
- fi
-
- if ! losetup $LOOP_DEV $TMP/tacl/blkext3 > /dev/null 2>&1; then
- echo ""
- tst_brkm TCONF "[ losetup.2 ] Failed to setup the device."
- fi
-
- mount | grep ext2
- if [ $? -ne 0 ]; then
- mkfs -t ext3 $LOOP_DEV #> /dev/null 2>&1
- mkdir -m 777 $TMP/tacl/mount-ext3
- mount -t ext3 -o defaults,acl,user_xattr $LOOP_DEV $TMP/tacl/mount-ext3
- if [ $? -ne 0 ]; then
- tst_resm TCONF "[ mount ] Make sure that ACL (Access Control List)"
- tst_resm TCONF "\t and Extended Attribute are built into the kernel\n"
- tst_brkm TCONF "\t Can not mount ext3 file system with acl and user_xattr options\n"
- fi
- else
- mkfs -t ext2 $LOOP_DEV
- mkdir -m 777 $TMP/tacl/mount-ext3
- mount -t ext2 -o defaults,acl,user_xattr $LOOP_DEV $TMP/tacl/mount-ext3
- if [ $? -ne 0 ]; then
- tst_resm TCONF "FAILED: [ mount ] Make sure that ACL (Access Control List)"
- tst_resm TCONF "\t and Extended Attribute are built into the kernel\n"
- tst_brkm TCONF "\t Can not mount ext2 file system with acl and user_xattr options\n"
- fi
- fi
-
- # We couldn't consider whether the SElinux is Disable or Permissive.
- # We only set it to Permissive when it it Enforcing.
- if [ "$SELINUX" = "Enforcing" ]; then
- echo "set the SElinux to Permissive."
- setenforce 0
- fi
-
- userdel $TEST_USER1 > /dev/null 2>&1
- useradd -d $TEST_USER1_HOMEDIR -m -g $TEST_USER1_GROUP $TEST_USER1 -s /bin/sh
- if [ $? -ne 0 ]; then
- tst_brkm TBROK "Could not add test user $TEST_USER1."
- fi
-}
-
-do_cleanup()
-{
- userdel $TEST_USER1 > /dev/null 2>&1
- rm -f $FILE_ACL > /dev/null 2>&1
- rm -f $FILE_ACL_LINK > /dev/null 2>&1
- mount | grep -q "$TMP/tacl/mount-ext3" && umount -d $TMP/tacl/mount-ext3
- rm -rf $TMP/tacl
-
- # We set it back to Enforcing.
- if [ "$SELINUX" = "Enforcing" ]; then
- echo "set the SElinux back to Enforcing."
- setenforce 1
- fi
-}
-
-do_setup
-TST_CLEANUP=do_cleanup
-
-tst_resm TINFO "Testing ACL for root"
-
-touch $FILE_ACL
-touch $FILE_ACL_LINK
-
-#setup files for extended attributes
-setfacl -mu:root:r $FILE_ACL_LINK
-setfacl -mu:root:r $FILE_ACL
-
-acl_file_test $FILE_ACL
-if [ $? -ne 0 ]; then
- tst_resm TFAIL "Extended acls for files."
-else
- tst_resm TPASS "Extended acls for files."
-fi
-
-acl_link_test $FILE_ACL_LINK
-if [ $? -ne 0 ]; then
- tst_resm TFAIL "Extended acls for links."
-else
- tst_resm TPASS "Extended acls for links."
-fi
-
-chown $TEST_USER1 $FILE_ACL
-chown $TEST_USER1 $FILE_ACL_LINK
-
-tst_resm TINFO "Testing ACL for $TEST_USER1"
-
-#setup files for extended attributes
-setfacl -m u:$TEST_USER1:r $FILE_ACL_LINK
-setfacl -m u:$TEST_USER1:r $FILE_ACL
-
-tst_su $TEST_USER1 "acl_file_test $FILE_ACL"
-if [ $? -ne 0 ]; then
- tst_resm TFAIL "Extended acls for files."
-else
- tst_resm TPASS "Extended acls for files."
-fi
-
-tst_su $TEST_USER1 "acl_link_test $FILE_ACL_LINK"
-if [ $? -ne 0 ]; then
- tst_resm TFAIL "Extended acls for links."
-else
- tst_resm TPASS "Extended acls for links."
-fi
-
-tst_exit
--
2.19.0
More information about the ltp
mailing list