summaryrefslogtreecommitdiff
path: root/source3/script/tests/test_smbclient_s3.sh
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-10 14:40:20 -0800
committerJeremy Allison <jra@samba.org>2010-03-10 14:40:20 -0800
commit20d85d5d546ade003d70ca727c012785ba9f9b4b (patch)
tree890edf079fa0e035c18c4bfded4315614def6bd5 /source3/script/tests/test_smbclient_s3.sh
parent01801f3f94f76b86a92c5ffec7399b39977572f7 (diff)
downloadsamba-20d85d5d546ade003d70ca727c012785ba9f9b4b.tar.gz
samba-20d85d5d546ade003d70ca727c012785ba9f9b4b.tar.bz2
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/script/tests/test_smbclient_s3.sh')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh48
1 files changed, 45 insertions, 3 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 1ee829e2fc..7896b2821f 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`