s3: smbd: Add regression test for non-wide symlinks to directories fail over SMB3.
authorJeremy Allison <jra@samba.org>
Fri, 23 Jun 2017 18:12:22 +0000 (11:12 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 26 Jun 2017 21:16:13 +0000 (23:16 +0200)
Mark as knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12860

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
selftest/knownfail.d/samba3.blackbox.smbclient_s3.follow_local_symlinks [new file with mode: 0644]
selftest/target/Samba3.pm
source3/script/tests/test_smbclient_s3.sh

diff --git a/selftest/knownfail.d/samba3.blackbox.smbclient_s3.follow_local_symlinks b/selftest/knownfail.d/samba3.blackbox.smbclient_s3.follow_local_symlinks
new file mode 100644 (file)
index 0000000..7be44c1
--- /dev/null
@@ -0,0 +1 @@
+^samba3.blackbox.smbclient_s3.*follow local symlinks.*
index d93d98e3af3a9ed9064f648ef50fa0ae933f70b3..6854d7c0ecd1c0f8aa6324f227ec1c45e7ed9997 100755 (executable)
@@ -1355,6 +1355,9 @@ sub provision($$$$$$$$$)
        my $nosymlinks_shrdir="$shrdir/nosymlinks";
        push(@dirs,$nosymlinks_shrdir);
 
+       my $local_symlinks_shrdir="$shrdir/local_symlinks";
+       push(@dirs,$local_symlinks_shrdir);
+
        # this gets autocreated by winbindd
        my $wbsockdir="$prefix_abs/winbindd";
 
@@ -1976,6 +1979,11 @@ sub provision($$$$$$$$$)
        path = $nosymlinks_shrdir
        follow symlinks = no
 
+[local_symlinks]
+       copy = tmp
+       path = $local_symlinks_shrdir
+       follow symlinks = yes
+
 [kernel_oplocks]
        copy = tmp
        kernel oplocks = yes
index 050dd81623ed04ad5c74124baa7c3795f7325505..1c5a13d110f08455ca0c7da676e0a1b16178f031 100755 (executable)
@@ -1215,6 +1215,57 @@ EOF
     fi
 }
 
+# Test we can follow normal symlinks.
+# Bug: https://bugzilla.samba.org/show_bug.cgi?id=12860
+# Note - this needs to be tested over SMB3, not SMB1.
+
+test_local_symlinks()
+{
+# Setup test dirs.
+    LOCAL_RAWARGS="${CONFIGURATION} -mSMB3"
+    LOCAL_ADDARGS="${LOCAL_RAWARGS} $*"
+
+    test_dir="$LOCAL_PATH/local_symlinks/test"
+
+    slink_name="$test_dir/sym_name"
+    slink_target_dir="$test_dir/dir1"
+
+    rm -rf $test_dir
+
+    mkdir -p $test_dir
+    mkdir $slink_target_dir
+    ln -s $slink_target_dir $slink_name
+
+# Can we cd into the symlink name and ls ?
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+    cat > $tmpfile <<EOF
+cd test\\sym_name
+ls
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/local_symlinks -I $SERVER_IP $LOCAL_ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+    rm -f $tmpfile
+
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo "failed accessing local_symlinks with error $ret"
+       false
+       return
+    fi
+
+    echo "$out" | grep 'NT_STATUS_'
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "$out"
+       echo "failed - got an NT_STATUS error"
+       false
+       return
+    fi
+}
+
 test_server_os_message()
 {
     tmpfile=$PREFIX/smbclient_interactive_prompt_commands
@@ -1348,6 +1399,10 @@ testit "follow symlinks = no" \
     test_nosymlinks || \
     failed=`expr $failed + 1`
 
+testit "follow local symlinks" \
+    test_local_symlinks || \
+    failed=`expr $failed + 1`
+
 testit "server os message" \
     test_server_os_message || \
     failed=`expr $failed + 1`