mirror of
https://github.com/samba-team/samba.git
synced 2025-03-09 08:58:35 +03:00
Added regression test for bug #7234 - Symlink delete fails but incorrectly reports success.
Ensure we can delete a symlink by path. Jeremy.
This commit is contained in:
parent
01801f3f94
commit
20d85d5d54
@ -2,9 +2,9 @@
|
||||
|
||||
# this runs the file serving tests that are expected to pass with samba3
|
||||
|
||||
if [ $# -lt 5 ]; then
|
||||
if [ $# -lt 6 ]; then
|
||||
cat <<EOF
|
||||
Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID
|
||||
Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH
|
||||
EOF
|
||||
exit 1;
|
||||
fi
|
||||
@ -14,8 +14,9 @@ SERVER_IP="$2"
|
||||
USERNAME="$3"
|
||||
PASSWORD="$4"
|
||||
USERID="$5"
|
||||
LOCAL_PATH="$6"
|
||||
SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION"
|
||||
shift 5
|
||||
shift 6
|
||||
ADDARGS="$*"
|
||||
|
||||
test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
|
||||
@ -127,6 +128,43 @@ EOF
|
||||
fi
|
||||
}
|
||||
|
||||
# Test creating a good symlink and deleting it by path.
|
||||
test_good_symlink()
|
||||
{
|
||||
tmpfile=/tmp/smbclient.in.$$
|
||||
|
||||
touch "$LOCAL_PATH/foo"
|
||||
ln -s "$LOCAL_PATH/foo" "$LOCAL_PATH/bar"
|
||||
cat > $tmpfile <<EOF
|
||||
del bar
|
||||
quit
|
||||
EOF
|
||||
|
||||
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -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 delete good symlink with error $ret"
|
||||
false
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -e "$LOCAL_PATH/bar" ] ; then
|
||||
echo "failed delete good symlink - symlink still exists"
|
||||
rm "$LOCAL_PATH/bar"
|
||||
rm "$LOCAL_PATH/foo"
|
||||
false
|
||||
else
|
||||
# got the correct prompt .. succeed
|
||||
rm "$LOCAL_PATH/foo"
|
||||
true
|
||||
fi
|
||||
}
|
||||
|
||||
# Test writing into a read-only directory (logon as guest) fails.
|
||||
test_read_only_dir()
|
||||
{
|
||||
@ -264,6 +302,10 @@ testit "creating a bad symlink and deleting it" \
|
||||
test_bad_symlink || \
|
||||
failed=`expr $failed + 1`
|
||||
|
||||
testit "creating a good symlink and deleting it by path" \
|
||||
test_good_symlink || \
|
||||
failed=`expr $failed + 1`
|
||||
|
||||
testit "writing into a read-only directory fails" \
|
||||
test_read_only_dir || \
|
||||
failed=`expr $failed + 1`
|
||||
|
@ -20,13 +20,13 @@ smbtorture_s3_encrypted() {
|
||||
|
||||
smbclient_s3() {
|
||||
echo "RUNNING TESTS smbclient_s3"
|
||||
$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID \
|
||||
$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID "$PREFIX_ABS"/tmp \
|
||||
|| failed=`expr $failed + $?`
|
||||
}
|
||||
|
||||
smbclient_s3_encrypted() {
|
||||
echo "RUNNING TESTS smbclient_s3_encrypted"
|
||||
$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID "-e" \
|
||||
$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD $USERID "$PREFIX_ABS"/tmp "-e" \
|
||||
|| failed=`expr $failed + $?`
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user