Fix one missing STAT -> LSTAT with POSIX pathnames in vfs_xattr_tdb.c. Caught by...
[ira/wip.git] / source3 / script / tests / test_smbclient_s3.sh
index 1d55087c88527a74a6e4342fe85731affd0f60f8..f10bfeac3946bac03ccb9fafb4c91deb0d5dfb19 100755 (executable)
@@ -17,8 +17,10 @@ SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION"
 shift 4
 ADDARGS="$*"
 
+test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
 incdir=`dirname $0`
 . $incdir/test_functions.sh
+}
 
 failed=0
 
@@ -84,6 +86,46 @@ EOF
     fi
 }
 
+# Test creating a bad symlink and deleting it.
+test_bad_symlink()
+{
+    prompt="posix_unlink deleted file /newname"
+    tmpfile=/tmp/smbclient.in.$$
+
+    cat > $tmpfile <<EOF
+posix
+posix_unlink newname
+symlink badname newname
+posix_unlink newname
+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 create then delete bad symlink"
+       false
+       return
+    fi
+
+    echo "$out" | grep $prompt >/dev/null 2>&1
+
+    if [ $? = 0 ] ; then
+       # got the correct prompt .. succeed
+       true
+    else
+       echo "$out"
+       echo failed create then delete bad symlink
+       false
+    fi
+}
+
+
 testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
 testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
 
@@ -103,4 +145,8 @@ testit "interactive smbclient -l prompts on stdout" \
    test_interactive_prompt_stdout -l /tmp || \
     failed=`expr $failed + 1`
 
+testit "creating a bad symlink and deleting it" \
+   test_bad_symlink || \
+   failed=`expr $failed + 1`
+
 testok $0 $failed