3 # this runs the file serving tests that are expected to pass with samba3
7 Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD
16 SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION"
20 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
22 . $incdir/test_functions.sh
27 # Test that a noninteractive smbclient does not prompt
28 test_noninteractive_no_prompt()
32 cmd='echo du | $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS 2>&1'
43 echo "$out" | grep $prompt >/dev/null 2>&1
46 # got a prompt .. fail
47 echo matched interactive prompt in non-interactive mode
54 # Test that an interactive smbclient prompts to stdout
55 test_interactive_prompt_stdout()
58 tmpfile=/tmp/smbclient.in.$$
65 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
71 if [ $ret != 0 ] ; then
78 echo "$out" | grep $prompt >/dev/null 2>&1
81 # got a prompt .. succeed
84 echo failed to match interactive prompt on stdout
89 # Test creating a bad symlink and deleting it.
92 prompt="posix_unlink deleted file /newname"
93 tmpfile=/tmp/smbclient.in.$$
98 symlink badname newname
103 cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
109 if [ $ret != 0 ] ; then
111 echo "failed create then delete bad symlink with error $ret"
116 echo "$out" | grep "$prompt" >/dev/null 2>&1
119 if [ $ret = 0 ] ; then
120 # got the correct prompt .. succeed
124 echo "failed create then delete bad symlink - grep failed with $ret"
130 testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
131 testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
133 testit "noninteractive smbclient does not prompt" \
134 test_noninteractive_no_prompt || \
135 failed=`expr $failed + 1`
137 testit "noninteractive smbclient -l does not prompt" \
138 test_noninteractive_no_prompt -l /tmp || \
139 failed=`expr $failed + 1`
141 testit "interactive smbclient prompts on stdout" \
142 test_interactive_prompt_stdout || \
143 failed=`expr $failed + 1`
145 testit "interactive smbclient -l prompts on stdout" \
146 test_interactive_prompt_stdout -l /tmp || \
147 failed=`expr $failed + 1`
149 testit "creating a bad symlink and deleting it" \
150 test_bad_symlink || \
151 failed=`expr $failed + 1`