blob: 7e85834d9328351807deb90cc4e1d0381bd5cb44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#!/bin/sh
#
# Blackbox test for SMB2 case insensitivity
#
if [ $# -lt 6 ]; then
cat <<EOF
Usage: test_smb2_not_casesensitive SERVER SERVER_IP USERNAME PASSWORD LOCAL_PATH SMBCLIENT
EOF
exit 1
fi
SERVER=${1}
SERVER_IP=${2}
USERNAME=${3}
PASSWORD=${4}
LOCAL_PATH=${5}
SMBCLIENT=${6}
incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh
failed=0
# Test a file with different case works over SMB2 and later
test_access_with_different_case()
{
tmpfile=$LOCAL_PATH/testfile.txt
echo "foobar" >$tmpfile
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -mSMB3 -U$USERNAME%$PASSWORD "$SERVER" -I $SERVER_IP -c "ls TeStFiLe.TxT" 2>&1'
out=$(eval $cmd)
ret=$?
rm -f $tmpfile
if [ $ret = 0 ]; then
return 0
else
echo "$out"
echo "failed to get file with different case"
return 1
fi
}
# Test that a rename causes a conflict works when target name exists in
# different case
test_rename()
{
set -x
tmpfile=$LOCAL_PATH/torename.txt
echo "foobar" >$tmpfile
targetfile=$LOCAL_PATH/target.txt
touch $targetfile
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -mSMB3 -U$USERNAME%$PASSWORD "$SERVER" -I $SERVER_IP -c "rename ToReNaMe.TxT TaRgEt.txt" 2>&1'
out=$(eval $cmd)
ret=$?
rm -f $tmpfile
rm -f $targetfile
rm -f $LOCAL_PATH/TaRgEt.txt
if [ $ret = 1 -a -z "${out##*COLLISION*}" ]; then
return 0
else
echo "$out"
echo "failed to get file with different case"
return 1
fi
}
testit "accessing a file with different case succeeds" \
test_access_with_different_case ||
failed=$(expr $failed + 1)
testit "renaming a file with different case succeeds" \
test_rename ||
failed=$(expr $failed + 1)
exit $failed
|