selftest/Samba4: make use of get_cmd_env_vars() to setup all relevant env variables
[samba.git] / source3 / script / tests / test_smbclient_basic.sh
1 #!/bin/sh
2
3 # this runs the file serving tests that are expected to pass with samba3 against shares with various options
4
5 if [ $# -lt 5 ]; then
6         cat <<EOF
7 Usage: test_smbclient_basic.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD SMBCLIENT <smbclient arguments>
8 EOF
9         exit 1
10 fi
11
12 SERVER="$1"
13 SERVER_IP="$2"
14 USERNAME="$3"
15 PASSWORD="$4"
16 smbclient="$5"
17 CONFIGURATION="$6"
18 shift 6
19 ADDARGS="$@"
20
21 incdir=$(dirname $0)/../../../testprogs/blackbox
22 . $incdir/subunit.sh
23 . $incdir/common_test_fns.inc
24
25 # TEST using \ as the separator (default)
26 test_smbclient "smbclient as $DOMAIN\\$USERNAME" 'ls' "//$SERVER/tmp" -U$DOMAIN\\$USERNAME%$PASSWORD $ADDARGS || failed=$(expr $failed + 1)
27 # TEST using / as the separator (default)
28 test_smbclient "smbclient as $DOMAIN/$USERNAME" 'ls' "//$SERVER/tmp" -U$DOMAIN/$USERNAME%$PASSWORD $ADDARGS || failed=$(expr $failed + 1)
29
30 # TEST using 'winbind separator = +'
31 test_smbclient "smbclient as $DOMAIN+$USERNAME" 'ls' "//$SERVER/tmp" -U$DOMAIN+$USERNAME%$PASSWORD $ADDARGS --option=winbindseparator=+ || failed=$(expr $failed + 1)
32
33 # TEST using 'winbind separator = +' set in a config file
34 smbclient_config="$PREFIX/tmpsmbconf"
35 cat >$smbclient_config <<EOF
36 [global]
37     include = $(echo $CONFIGURATION | cut -d= -f2)
38     winbind separator = +
39 EOF
40
41 SAVE_CONFIGURATION="$CONFIGURATION"
42 CONFIGURATION="--configfile=$smbclient_config"
43 test_smbclient "smbclient as $DOMAIN+$USERNAME" 'ls' "//$SERVER/tmp" -U$DOMAIN+$USERNAME%$PASSWORD $ADDARGS || failed=$(expr $failed + 1)
44 CONFIGURATION="$SAVE_CONFIGURATION"
45 rm -rf $smbclient_config
46
47 exit $failed