summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-10-23 15:40:04 -0700
committerJeremy Allison <jra@samba.org>2017-10-24 23:32:58 +0200
commit7abe56ccfa4aba75c5e166a7bd0bb8141c3f258b (patch)
tree3c27a83a4ee5e96da4cef555a23c92e8e1f21a22 /source3/script
parentf81c34c296f87127c6d1e4dd6ea74aa75660885d (diff)
downloadsamba-7abe56ccfa4aba75c5e166a7bd0bb8141c3f258b.tar.gz
s3: smbclient: Test we can rename with a name containing.
Samba always allowed this anyway, but it's a good place to ensure we don't regress. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13093 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Oct 24 23:32:58 CEST 2017 on sn-devel-144
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 191f3941fb7..45005776cf8 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1481,6 +1481,51 @@ EOF
fi
}
+# Test smbclient renames with pathnames containing '..'
+test_rename_dotdot()
+{
+ tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+
+ cat > $tmpfile <<EOF
+deltree dotdot_test
+mkdir dotdot_test
+cd dotdot_test
+mkdir dir1
+mkdir dir2
+cd dir1
+put ${SMBCLIENT} README
+rename README ..\\dir2\\README
+cd ..
+cd dir2
+allinfo README
+cd \\
+deltree dotdot_test
+quit
+EOF
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed rename_dotdot test with output $ret"
+ false
+ return
+ fi
+
+ # We are allowed to get NT_STATUS_NO_SUCH_FILE listing \dotdot_test
+ # as the top level directory should not exist, but no other errors.
+
+ error_str=`echo $out | grep NT_STATUS | grep -v "NT_STATUS_NO_SUCH_FILE listing .dotdot_test"`
+ if [ "$error_str" != "" ]; then
+ echo "failed - unexpected NT_STATUS error in $out"
+ false
+ return
+ fi
+}
+
+
test_server_os_message()
{
@@ -1635,6 +1680,10 @@ testit "utimes" \
test_utimes || \
failed=`expr $failed + 1`
+testit "rename_dotdot" \
+ test_rename_dotdot || \
+ failed=`expr $failed + 1`
+
testit "rm -rf $LOGDIR" \
rm -rf $LOGDIR || \
failed=`expr $failed + 1`