summaryrefslogtreecommitdiffstats
path: root/source3/script
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2014-08-27 13:15:29 -0700
committerDavid Disseldorp <ddiss@samba.org>2014-09-16 04:21:49 +0200
commitdf800ea6fb307abae785d3a5da60f4db70e9bc68 (patch)
tree37fc3a6ed0f9bf0e46e7f07dd169b429149a6909 /source3/script
parent6d03aed15e1be4c126c2de4708d0b1cd112ba901 (diff)
downloadsamba-df800ea6fb307abae785d3a5da60f4db70e9bc68.tar.gz
samba-df800ea6fb307abae785d3a5da60f4db70e9bc68.tar.xz
samba-df800ea6fb307abae785d3a5da60f4db70e9bc68.zip
Add test suite for iconv conversion fail of bad names over SMB1/SMB3.
Bug 10775 - smbd crashes when accessing garbage filenames https://bugzilla.samba.org/show_bug.cgi?id=10775 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Tue Sep 16 04:21:49 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh144
1 files changed, 144 insertions, 0 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 596cd425ff..67ac94a0d8 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -722,6 +722,146 @@ EOF
fi
}
+# Test accessing an share with bad names (won't convert).
+test_bad_names()
+{
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -c ls 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed accessing badname-tmp (SMB1) with error $ret"
+ false
+ return
+ fi
+
+ echo "$out" | wc -l 2>&1 | grep 6
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep of number of lines (1) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep 'Domain=.*OS=.*Server='
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep (1) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ \. *D'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep (2) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ \.\. *D'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep (3) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ blank.txt *N'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep (4) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ *$'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep (5) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep 'blocks of size.*blocks available'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - grep (6) failed with $ret"
+ false
+ fi
+
+ # Now check again with -mSMB3
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP -mSMB3 $ADDARGS -c ls 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed accessing badname-tmp (SMB3) with error $ret"
+ false
+ return
+ fi
+
+ echo "$out" | wc -l 2>&1 | grep 6
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep of number of lines (1) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep 'Domain=.*OS=.*Server='
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep (1) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ \. *D'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep (2) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ \.\. *D'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep (3) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ blank.txt *N'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep (4) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep '^ *$'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep (5) failed with $ret"
+ false
+ fi
+
+ echo "$out" | grep 'blocks of size.*blocks available'
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\badname-tmp - SMB3 grep (6) failed with $ret"
+ false
+ fi
+}
LOGDIR_PREFIX=test_smbclient_s3
@@ -798,6 +938,10 @@ testit "list with backup privilege" \
test_backup_privilege_list || \
failed=`expr $failed + 1`
+testit "list a share with bad names (won't convert)" \
+ test_bad_names || \
+ failed=`expr $failed + 1`
+
testit "rm -rf $LOGDIR" \
rm -rf $LOGDIR || \
failed=`expr $failed + 1`