1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-06 13:18:07 +03:00

s3: Test for CVE-2017-2619 regression with "follow symlinks = no" - part 2

Add tests for regular access.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Mar 28 17:05:27 CEST 2017 on sn-devel-144

(cherry picked from commit 4e734fcd1b)

Autobuild-User(v4-4-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-4-test): Wed Mar 29 13:57:56 CEST 2017 on sn-devel-144
This commit is contained in:
Jeremy Allison 2017-03-27 22:10:29 -07:00 committed by Karolin Seeger
parent ed694d0680
commit 0839f6c6f4

View File

@ -1078,14 +1078,22 @@ test_nosymlinks()
slink_name="$LOCAL_PATH/nosymlinks/source"
slink_target="$LOCAL_PATH/nosymlinks/target"
mkdir_target="$LOCAL_PATH/nosymlinks/a"
dir1="$LOCAL_PATH/nosymlinks/foo"
dir2="$LOCAL_PATH/nosymlinks/foo/bar"
get_target="$LOCAL_PATH/nosymlinks/foo/bar/testfile"
rm -f $slink_target
rm -f $slink_name
rm -rf $mkdir_target
rm -rf $dir1
touch $slink_target
ln -s $slink_target $slink_name
mkdir $dir1
mkdir $dir2
touch $get_target
# Getting a file through a symlink name should fail.
tmpfile=$PREFIX/smbclient_interactive_prompt_commands
cat > $tmpfile <<EOF
@ -1140,6 +1148,35 @@ EOF
echo "failed - NT_STATUS_XXXX doing mkdir a; mkdir a\\b on \\nosymlinks"
false
fi
# Ensure regular file/directory access also works.
cat > $tmpfile <<EOF
cd foo\\bar
ls
get testfile -
quit
EOF
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/nosymlinks -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
eval echo "$cmd"
out=`eval $cmd`
ret=$?
rm -f $tmpfile
if [ $ret -ne 0 ] ; then
echo "$out"
echo "failed accessing nosymlinks with error $ret"
false
return
fi
echo "$out" | grep 'NT_STATUS'
ret=$?
if [ $ret -eq 0 ] ; then
echo "$out"
echo "failed - NT_STATUS_XXXX doing cd foo\\bar; get testfile on \\nosymlinks"
false
return
fi
}
testit "smbclient -L $SERVER_IP" $SMBCLIENT -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`