aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2018-08-09 10:02:26 -0700
committerKarolin Seeger <kseeger@samba.org>2018-08-23 10:38:26 +0200
commit9e3bc4e5a68adb2fe527680d6f7e5522bd87087f (patch)
tree25d7b1453a205e65eb76dc08f25662cdf76fedac
parent694c8908b0c595ee4550b05ab6c6c1f51b9e45cf (diff)
downloadsamba-9e3bc4e5a68adb2fe527680d6f7e5522bd87087f.tar.gz
samba-9e3bc4e5a68adb2fe527680d6f7e5522bd87087f.tar.xz
samba-9e3bc4e5a68adb2fe527680d6f7e5522bd87087f.zip
s3: tests: smbclient. Regression test to ensure we get NT_STATUS_DIRECTORY_NOT_EMPTY on rmdir.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13204 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): Fri Aug 10 21:08:14 CEST 2018 on sn-devel-144 (cherry picked from commit bca400847f2fcc3dd1398e166c1964cb88822071)
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 264f483ff34..b178670296f 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -1699,6 +1699,44 @@ EOF
fi
}
+# Test smbclient non-empty rmdir command
+test_del_nedir()
+{
+ tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+ del_nedir="$LOCAL_PATH/del_nedir"
+
+ rm -rf $del_nedir
+ mkdir $del_nedir
+ touch $del_nedir/afile
+ cat > $tmpfile <<EOF
+rmdir del_nedir
+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=$?
+ rm -rf $del_nedir
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed test_del_nedir test with output $ret"
+ false
+ return
+ fi
+
+# Should get NT_STATUS_DIRECTORY_NOT_EMPTY error from rmdir
+ echo "$out" | grep 'NT_STATUS_DIRECTORY_NOT_EMPTY'
+ ret=$?
+ if [ $ret -ne 0 ] ; then
+ echo "$out"
+ echo "test_del_nedir failed - should get an NT_STATUS_DIRECTORY_NOT_EMPTY error"
+ false
+ return
+ fi
+}
+
+#
#
LOGDIR_PREFIX=test_smbclient_s3
@@ -1843,4 +1881,8 @@ testit "rm -rf $LOGDIR" \
rm -rf $LOGDIR || \
failed=`expr $failed + 1`
+testit "delete a non empty directory" \
+ test_del_nedir || \
+ failed=`expr $failed + 1`
+
testok $0 $failed