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