diff options
author | Jeremy Allison <jra@samba.org> | 2010-03-10 14:40:20 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-03-10 14:40:20 -0800 |
commit | 20d85d5d546ade003d70ca727c012785ba9f9b4b (patch) | |
tree | 890edf079fa0e035c18c4bfded4315614def6bd5 /source3 | |
parent | 01801f3f94f76b86a92c5ffec7399b39977572f7 (diff) | |
download | samba-20d85d5d546ade003d70ca727c012785ba9f9b4b.tar.gz samba-20d85d5d546ade003d70ca727c012785ba9f9b4b.tar.xz samba-20d85d5d546ade003d70ca727c012785ba9f9b4b.zip |
Added regression test for bug #7234 - Symlink delete fails but incorrectly reports success.
Ensure we can delete a symlink by path.
Jeremy.
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/script/tests/test_smbclient_s3.sh | 48 | ||||
-rwxr-xr-x | source3/script/tests/tests_all.sh | 4 |
2 files changed, 47 insertions, 5 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 1ee829e2fca..7896b2821fc 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -2,9 +2,9 @@ # this runs the file serving tests that are expected to pass with samba3 -if [ $# -lt 5 ]; then +if [ $# -lt 6 ]; then cat <<EOF -Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID +Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH EOF exit 1; fi @@ -14,8 +14,9 @@ SERVER_IP="$2" USERNAME="$3" PASSWORD="$4" USERID="$5" +LOCAL_PATH="$6" SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION" -shift 5 +shift 6 ADDARGS="$*" test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { @@ -127,6 +128,43 @@ EOF fi } +# Test creating a good symlink and deleting it by path. +test_good_symlink() +{ + tmpfile=/tmp/smbclient.in.$$ + + touch "$LOCAL_PATH/foo" + ln -s "$LOCAL_PATH/foo" "$LOCAL_PATH/bar" + cat > $tmpfile <<EOF +del bar +quit +EOF + + cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' + eval echo "$cmd" + out=`eval $cmd` + ret=$? + rm -f $tmpfile + + if [ $ret != 0 ] ; then + echo "$out" + echo "failed delete good symlink with error $ret" + false + return + fi + + if [ -e "$LOCAL_PATH/bar" ] ; then + echo "failed delete good symlink - symlink still exists" + rm "$LOCAL_PATH/bar" + rm "$LOCAL_PATH/foo" + false + else + # got the correct prompt .. succeed + rm "$LOCAL_PATH/foo" + true + fi +} + # Test writing into a read-only directory (logon as guest) fails. test_read_only_dir() { @@ -264,6 +302,10 @@ testit "creating a bad symlink and deleting it" \ test_bad_symlink || \ failed=`expr $failed + 1` +testit "creating a good symlink and deleting it by path" \ + test_good_symlink || \ + failed=`expr $failed + 1` + testit "writing into a read-only directory fails" \ test_read_only_dir || \ failed=`expr $failed + 1` diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 153f8ea0d5f..cd0c6eb4566 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -20,13 +20,13 @@ smbtorture_s3_encrypted() { smbclient_s3() { echo "RUNNING TESTS smbclient_s3" - $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID \ + $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID "$PREFIX_ABS"/tmp \ || failed=`expr $failed + $?` } smbclient_s3_encrypted() { echo "RUNNING TESTS smbclient_s3_encrypted" - $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID "-e" \ + $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID "$PREFIX_ABS"/tmp "-e" \ || failed=`expr $failed + $?` } |