Revert "Update su tests"

This reverts commit cf8101aaae.
This commit is contained in:
Serge Hallyn 2020-08-28 15:15:47 -05:00
parent ec98f190c1
commit c32743808d
10 changed files with 9 additions and 321 deletions

View File

@ -90,28 +90,22 @@ run_test ./su/02/env_special_root-options_-p_bash
run_test ./su/02/env_special_root-options_ run_test ./su/02/env_special_root-options_
run_test ./su/02/env_special_root-options__bash run_test ./su/02/env_special_root-options__bash
run_test ./su/03/su_run_command01.test run_test ./su/03/su_run_command01.test
#run_test ./su/03/su_run_command02.test run_test ./su/03/su_run_command02.test
#run_test ./su/03/su_run_command03.test run_test ./su/03/su_run_command03.test
run_test ./su/03/su_run_command04.test run_test ./su/03/su_run_command04.test
#run_test ./su/03/su_run_command05.test run_test ./su/03/su_run_command05.test
run_test ./su/03/su_run_command06.test run_test ./su/03/su_run_command06.test
run_test ./su/03/su_run_command07.test run_test ./su/03/su_run_command07.test
#run_test ./su/03/su_run_command08.test run_test ./su/03/su_run_command08.test
#run_test ./su/03/su_run_command09.test run_test ./su/03/su_run_command09.test
run_test ./su/03/su_run_command10.test run_test ./su/03/su_run_command10.test
#run_test ./su/03/su_run_command11.test run_test ./su/03/su_run_command11.test
#run_test ./su/03/su_run_command12.test run_test ./su/03/su_run_command12.test
#run_test ./su/03/su_run_command13.test run_test ./su/03/su_run_command13.test
run_test ./su/03/su_run_command14.test run_test ./su/03/su_run_command14.test
run_test ./su/03/su_run_command15.test run_test ./su/03/su_run_command15.test
run_test ./su/03/su_run_command16.test run_test ./su/03/su_run_command16.test
#run_test ./su/03/su_run_command17.test run_test ./su/03/su_run_command17.test
run_test ./su/03/su_run_command18.test
run_test ./su/03/su_run_command19.test
run_test ./su/03/su_run_command20.test
run_test ./su/03/su_run_command21.test
run_test ./su/03/su_run_command22.test
run_test ./su/03/su_run_command23.test
run_test ./su/04/su_wrong_user.test run_test ./su/04/su_wrong_user.test
run_test ./su/04/su_user_wrong_passwd.test run_test ./su/04/su_user_wrong_passwd.test
run_test ./su/04/su_user_wrong_passwd_syslog.test run_test ./su/04/su_user_wrong_passwd_syslog.test

View File

@ -1,2 +0,0 @@
root
args: first second third

View File

@ -1,2 +0,0 @@
myuser
args: first second third

View File

@ -7,8 +7,6 @@ cd $(dirname $0)
. ../../common/config.sh . ../../common/config.sh
. ../../common/log.sh . ../../common/log.sh
# FIXME
# su: ignoring --preserve-environment, it's mutually exclusive with --login
log_start "$0" "Running commands (check working directory): su -c pwd - myuser -p" log_start "$0" "Running commands (check working directory): su -c pwd - myuser -p"

View File

@ -1,50 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
cat > /tmp/shadow_test_wrap << "EOF"
#!/bin/sh
whoami
echo args: "$@"
EOF
chmod 755 /tmp/shadow_test_wrap
log_start "$0" "Running commands: su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' testsuite -- first second third"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo "/bin/su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' testsuite -- first second third > tmp/out 2> tmp/err"
/bin/su -c '/tmp/shadow_test_wrap $1 $2 $3' testsuite -- first second third > tmp/out 2> tmp/err
echo "su reported:"
echo "=== stdout ==="
cat tmp/out
echo "=== stderr ==="
cat tmp/err
echo "=============="
echo -n "Checking tmp/out..."
diff -au data/tsuser.out tmp/out
rm -f tmp/out
echo "OK"
echo -n "Checking tmp/err..."
[ "$(wc -c tmp/err)" = "0 tmp/err" ] || false
rm -f tmp/err
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -1,50 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
cat > /tmp/shadow_test_wrap << "EOF"
#!/bin/sh
whoami
echo args: "$@"
EOF
chmod 755 /tmp/shadow_test_wrap
log_start "$0" "Running commands: su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' testsuite first second third"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo "/bin/su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' testsuite first second third > tmp/out 2> tmp/err"
/bin/su -c '/tmp/shadow_test_wrap $1 $2 $3' testsuite first second third > tmp/out 2> tmp/err
echo "su reported:"
echo "=== stdout ==="
cat tmp/out
echo "=== stderr ==="
cat tmp/err
echo "=============="
echo -n "Checking tmp/out..."
diff -au data/tsuser.out tmp/out
rm -f tmp/out
echo "OK"
echo -n "Checking tmp/err..."
[ "$(wc -c tmp/err)" = "0 tmp/err" ] || false
rm -f tmp/err
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -1,50 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
cat > /tmp/shadow_test_wrap << "EOF"
#!/bin/sh
whoami
echo args: "$@"
EOF
chmod 755 /tmp/shadow_test_wrap
log_start "$0" "Running commands: su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' - testsuite first second third"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo "/bin/su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' - testsuite first second third > tmp/out 2> tmp/err"
/bin/su -c '/tmp/shadow_test_wrap $1 $2 $3' - testsuite first second third > tmp/out 2> tmp/err
echo "su reported:"
echo "=== stdout ==="
cat tmp/out
echo "=== stderr ==="
cat tmp/err
echo "=============="
echo -n "Checking tmp/out..."
diff -au data/tsuser.out tmp/out
rm -f tmp/out
echo "OK"
echo -n "Checking tmp/err..."
[ "$(wc -c tmp/err)" = "0 tmp/err" ] || false
rm -f tmp/err
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -1,50 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
cat > /tmp/shadow_test_wrap << "EOF"
#!/bin/sh
whoami
echo args: "$@"
EOF
chmod 755 /tmp/shadow_test_wrap
log_start "$0" "Running commands: su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' - testsuite -- first second third"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo "/bin/su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' - testsuite -- first second third > tmp/out 2> tmp/err"
/bin/su -c '/tmp/shadow_test_wrap $1 $2 $3' - testsuite -- first second third > tmp/out 2> tmp/err
echo "su reported:"
echo "=== stdout ==="
cat tmp/out
echo "=== stderr ==="
cat tmp/err
echo "=============="
echo -n "Checking tmp/out..."
diff -au data/tsuser.out tmp/out
rm -f tmp/out
echo "OK"
echo -n "Checking tmp/err..."
[ "$(wc -c tmp/err)" = "0 tmp/err" ] || false
rm -f tmp/err
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -1,50 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
cat > /tmp/shadow_test_wrap << "EOF"
#!/bin/sh
whoami
echo args: "$@"
EOF
chmod 755 /tmp/shadow_test_wrap
log_start "$0" "Running commands: su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' - -- first second third"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo "/bin/su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' - -- first second third > tmp/out 2> tmp/err"
/bin/su -c '/tmp/shadow_test_wrap $1 $2 $3' - -- first second third > tmp/out 2> tmp/err
echo "su reported:"
echo "=== stdout ==="
cat tmp/out
echo "=== stderr ==="
cat tmp/err
echo "=============="
echo -n "Checking tmp/out..."
diff -au data/rootuser.out tmp/out
rm -f tmp/out
echo "OK"
echo -n "Checking tmp/err..."
[ "$(wc -c tmp/err)" = "0 tmp/err" ] || false
rm -f tmp/err
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0

View File

@ -1,50 +0,0 @@
#!/bin/sh
set -e
cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
cat > /tmp/shadow_test_wrap << "EOF"
#!/bin/sh
whoami
echo args: "$@"
EOF
chmod 755 /tmp/shadow_test_wrap
log_start "$0" "Running commands: su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' -- first second third"
save_config
# restore the files on exit
trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
echo "/bin/su -c '/tmp/shadow_test_wrap \$1 \$2 \$3' -- first second third > tmp/out 2> tmp/err"
/bin/su -c '/tmp/shadow_test_wrap $1 $2 $3' -- first second third > tmp/out 2> tmp/err
echo "su reported:"
echo "=== stdout ==="
cat tmp/out
echo "=== stderr ==="
cat tmp/err
echo "=============="
echo -n "Checking tmp/out..."
diff -au data/rootuser.out tmp/out
rm -f tmp/out
echo "OK"
echo -n "Checking tmp/err..."
[ "$(wc -c tmp/err)" = "0 tmp/err" ] || false
rm -f tmp/err
echo "OK"
log_status "$0" "SUCCESS"
restore_config
trap '' 0