summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/selftest.sh18
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh74
2 files changed, 92 insertions, 0 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index a13877ddc9..2248ecf5b0 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -190,6 +190,20 @@ mkdir -p $RO_SHRDIR
chmod 755 $RO_SHRDIR
touch $RO_SHRDIR/unreadable_file
chmod 600 $RO_SHRDIR/unreadable_file
+##
+## Create an MS-DFS root share.
+##
+MSDFS_SHRDIR=`echo $SHRDIR | sed -e 's:/[^/]*$::'`
+MSDFS_SHRDIR=$MSDFS_SHRDIR/msdfsshare
+mkdir -p $MSDFS_SHRDIR
+chmod 777 $MSDFS_SHRDIR
+mkdir -p $MSDFS_SHRDIR/deeppath
+chmod 777 $MSDFS_SHRDIR/deeppath
+## Create something visible in the target.
+touch $RO_SHRDIR/msdfs-target
+chmod 666 $RO_SHRDIR/msdfs-target
+ln -s msdfs:$SERVER_IP\\ro-tmp $MSDFS_SHRDIR/msdfs-src1
+ln -s msdfs:$SERVER_IP\\ro-tmp $MSDFS_SHRDIR/deeppath/msdfs-src2
##
## Create the common config include file with the basic settings
@@ -325,6 +339,10 @@ cat >$SERVERCONFFILE<<EOF
[ro-tmp]
path = $RO_SHRDIR
guest ok = yes
+[msdfs-share]
+ path = $MSDFS_SHRDIR
+ msdfs root = yes
+ guest ok = yes
[hideunread]
copy = tmp
hide unreadable = yes
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index dc9853d690..965e275a3b 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -291,6 +291,76 @@ EOF
fi
}
+# Test accessing an msdfs path.
+test_msdfs_link()
+{
+ tmpfile=/tmp/smbclient.in.$$
+ prompt=" msdfs-target "
+
+ cat > $tmpfile <<EOF
+ls
+cd \\msdfs-src1
+ls msdfs-target
+quit
+EOF
+
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/msdfs-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 \\msdfs-src1 link with error $ret"
+ false
+ return
+ fi
+
+ echo "$out" | grep "$prompt" >/dev/null 2>&1
+
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\msdfs-src1 - grep failed with $ret"
+ false
+ fi
+
+ cat > $tmpfile <<EOF
+ls
+cd \\deeppath\\msdfs-src2
+ls msdfs-target
+quit
+EOF
+
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/msdfs-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 \\deeppath\\msdfs-src2 link with error $ret"
+ false
+ return
+ fi
+
+ echo "$out" | grep "$prompt" >/dev/null 2>&1
+
+ ret=$?
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed listing \\deeppath\\msdfs-src2 - grep failed with $ret"
+ false
+ return
+ else
+ true
+ return
+ fi
+}
+
+
testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
@@ -326,4 +396,8 @@ testit "Reading a owner-only file fails" \
test_owner_only_file || \
failed=`expr $failed + 1`
+testit "Accessing an MS-DFS link" \
+ test_msdfs_link || \
+ failed=`expr $failed + 1`
+
testok $0 $failed