summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2015-05-01 21:08:21 -0700
committerKarolin Seeger <kseeger@samba.org>2015-05-20 14:10:34 +0200
commit691a8875d7db5f0e55c1b70a467f7c20e4541d1b (patch)
tree83aa7876cf46fad8df75d8504735fa0f1cff8f27
parent80db4488051102e49430affb343735228d93d0d1 (diff)
downloadsamba-691a8875d7db5f0e55c1b70a467f7c20e4541d1b.tar.gz
s3: torture: Add regression test for bug #11249.
Bug 11249 - Mangled names do not work with acl_xattr BUG: https://bugzilla.samba.org/show_bug.cgi?id=11249 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue May 5 16:37:18 CEST 2015 on sn-devel-104 (cherry picked from commit 9928d9832cccb11c4a605c5ce31be3af961c141f)
-rwxr-xr-xselftest/target/Samba3.pm13
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh38
2 files changed, 51 insertions, 0 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index d8eb58c06e1..09e6e2cd4b8 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -882,6 +882,9 @@ sub provision($$$$$$)
my $lease2_shrdir="$shrdir/SMB3_00";
push(@dirs,$lease2_shrdir);
+ my $manglenames_shrdir="$shrdir/manglenames";
+ push(@dirs,$manglenames_shrdir);
+
# this gets autocreated by winbindd
my $wbsockdir="$prefix_abs/winbindd";
my $wbsockprivdir="$lockdir/winbindd_privileged";
@@ -964,6 +967,12 @@ sub provision($$$$$$)
close(BADNAME_TARGET);
chmod 0666, $badname_target;
+ ##
+ ## create mangleable directory names in $manglenames_shrdir
+ ##
+ my $manglename_target = "$manglenames_shrdir/foo:bar";
+ mkdir($manglename_target, 0777);
+
my $conffile="$libdir/server.conf";
my $nss_wrapper_pl = "$ENV{PERL} $self->{srcdir}/lib/nss_wrapper/nss_wrapper.pl";
@@ -1232,6 +1241,10 @@ sub provision($$$$$$)
path = $badnames_shrdir
guest ok = yes
+[manglenames_share]
+ path = $manglenames_shrdir
+ guest ok = yes
+
[dynamic_share]
path = $shrdir/%R
guest ok = yes
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index f6f370588cf..e79228fc4e9 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -863,6 +863,40 @@ test_bad_names()
fi
}
+# Test accessing an share with a name that must be mangled - with acl_xattrs.
+# We know foo:bar gets mangled to FF4GBY~Q with the default name-mangling algorithm (hash2).
+test_mangled_names()
+{
+ tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+ cat > $tmpfile <<EOF
+ls
+cd FF4GBY~Q
+ls
+quit
+EOF
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/manglenames_share -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 accessing manglenames_share with error $ret"
+ false
+ return
+ fi
+
+ echo "$out" | grep 'NT_STATUS'
+ ret=$?
+ if [ $ret == 0 ] ; then
+ echo "$out"
+ echo "failed - NT_STATUS_XXXX listing \\manglenames_share\\FF4GBY~Q"
+ false
+ fi
+}
+
+
LOGDIR_PREFIX=test_smbclient_s3
# possibly remove old logdirs:
@@ -942,6 +976,10 @@ testit "list a share with bad names (won't convert)" \
test_bad_names || \
failed=`expr $failed + 1`
+testit "list a share with a mangled name + acl_xattr object" \
+ test_mangled_names || \
+ failed=`expr $failed + 1`
+
testit "rm -rf $LOGDIR" \
rm -rf $LOGDIR || \
failed=`expr $failed + 1`