summaryrefslogtreecommitdiffstats
path: root/source3/script/tests/test_forceuser_validusers.sh
blob: 11c1a5b31b976972f3a996e783a6f4d6669a0abc (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
#!/bin/sh
#
# Blackbox test for share with force user settings
#

if [ $# -lt 6 ]; then
	cat <<EOF
Usage: test_forceuser_validusers.sh SERVER DOMAIN USERNAME PASSWORD LOCAL_PATH SMBCLIENT <smbclient arguments>
EOF
	exit 1
fi

SERVER="$1"
DOMAIN="$2"
USERNAME="force_user"
PASSWORD="$4"
LOCAL_PATH="$5"
SMBCLIENT="$6"
SMBCLIENT="$VALGRIND ${SMBCLIENT}"
shift 6
ADDARGS="$*"
failed=0

incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh

cd $SELFTEST_TMPDIR || exit 1

run_cmd_nooutput()
{
	CMD="$1"

	out=$(eval ${CMD} >TESTOUT 2>&1)
	if [ $? != 0 ]; then
		cat TESTOUT
		rm -f TESTOUT
		echo "command failed"
		false
		return
	fi

	rm -f TESTOUT
	true
	return
}

test_force_user_valid_users()
{
	SMB_SHARE="force_user_valid_users"
	run_cmd_nooutput "${SMBCLIENT} //${SERVER}/${SMB_SHARE} -U$USERNAME%$PASSWORD -c 'ls'"
}

# Test
testit "force user not works when combined with valid users" \
	test_force_user_valid_users || failed=$(expr $failed + 1)

# Cleanup

# Results
testok $0 $failed