summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUri Simchoni <uri@samba.org>2016-08-23 14:29:39 +0300
committerKarolin Seeger <kseeger@samba.org>2016-09-20 10:10:18 +0200
commit2a4de134c8753cf10626faa121848f3709198b3d (patch)
treeefc9b5e8dbaa12532c7676eeab4c71e356d99fa6
parentdcf7d8585aa7510a31a47545d410ec2a4dd58791 (diff)
downloadsamba-2a4de134c8753cf10626faa121848f3709198b3d.tar.gz
selftest: test listing directories inside snapshots
Verify that directories are also listable. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12172 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 22c3982100a1d6bf67979a0659604942ef6f11f0)
-rw-r--r--selftest/knownfail2
-rwxr-xr-xsource3/script/tests/test_shadow_copy.sh40
2 files changed, 36 insertions, 6 deletions
diff --git a/selftest/knownfail b/selftest/knownfail
index 40ac69657b4..68bd08201b0 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -344,3 +344,5 @@
^samba4.smb2.read.access
#ntvfs server blocks copychunk with execute access on read handle
^samba4.smb2.ioctl.copy_chunk_bad_access
+#new snapshot dir listing test fails on SMB1
+^samba3.blackbox.shadow_copy2(?!.*wide links).*- list directory
diff --git a/source3/script/tests/test_shadow_copy.sh b/source3/script/tests/test_shadow_copy.sh
index 8b7e4c754b4..6760ba3f80f 100755
--- a/source3/script/tests/test_shadow_copy.sh
+++ b/source3/script/tests/test_shadow_copy.sh
@@ -134,6 +134,7 @@ test_count_versions()
local tstamps
local tstamp
local content
+ local is_dir
share=$1
path=$2
@@ -145,13 +146,28 @@ test_count_versions()
return 1
fi
+ is_dir=0
+ $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | grep "^attributes:.*D" && is_dir=1
+ if [ $is_dir = 1 ] ; then
+ skip_content=1
+ fi
+
#readable snapshots
tstamps=`$SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | awk '/^@GMT-/ {snapshot=$1} /^create_time:/ {printf "%s\n", snapshot}'`
for tstamp in $tstamps ; do
- if ! $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "get $tstamp\\$path $WORKDIR/foo" ; then
- echo "Failed getting \\\\$SERVER\\$share\\$tstamp\\$path"
- return 1
+ if [ $is_dir = 0 ] ;
+ then
+ if ! $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "get $tstamp\\$path $WORKDIR/foo" ; then
+ echo "Failed getting \\\\$SERVER\\$share\\$tstamp\\$path"
+ return 1
+ fi
+ else
+ if ! $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "ls $tstamp\\$path\\*" ; then
+ echo "Failed listing \\\\$SERVER\\$share\\$tstamp\\$path"
+ return 1
+ fi
fi
+
#also check the content, but not for wide links
if [ "x$skip_content" != "x1" ] ; then
content=`cat $WORKDIR/foo`
@@ -166,9 +182,17 @@ test_count_versions()
tstamps=`$SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "allinfo $path" | \
awk '/^@GMT-/ {if (snapshot!=""){printf "%s\n", snapshot} ; snapshot=$1} /^create_time:/ {snapshot=""} END {if (snapshot!=""){printf "%s\n", snapshot}}'`
for tstamp in $tstamps ; do
- if $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "get $tstamp\\$path $WORKDIR/foo" ; then
- echo "Unexpected success getting \\\\$SERVER\\$share\\$tstamp\\$path"
- return 1
+ if [ $is_dir = 0 ] ;
+ then
+ if $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "get $tstamp\\$path $WORKDIR/foo" ; then
+ echo "Unexpected success getting \\\\$SERVER\\$share\\$tstamp\\$path"
+ return 1
+ fi
+ else
+ if $SMBCLIENT -U$USERNAME%$PASSWORD "//$SERVER/$share" -I $SERVER_IP -c "ls $tstamp\\$path\\*" ; then
+ echo "Unexpected success listing \\\\$SERVER\\$share\\$tstamp\\$path"
+ return 1
+ fi
fi
done
}
@@ -232,6 +256,10 @@ test_shadow_copy_fixed()
testit "$msg - rel symlink outside" \
test_count_versions $share bar/loutside $ncopies_blocked 1 || \
failed=`expr $failed + 1`
+
+ testit "$msg - list directory" \
+ test_count_versions $share bar $ncopies_allowed || \
+ failed=`expr $failed + 1`
}
test_shadow_copy_everywhere()