diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/script/tests/test_smbclient_s3.sh | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/script/tests/test_smbclient_s3.sh')
-rwxr-xr-x | source3/script/tests/test_smbclient_s3.sh | 106 |
1 files changed, 98 insertions, 8 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 0395f3e12c..8937c97bbe 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -4,22 +4,23 @@ if [ $# -lt 7 ]; then cat <<EOF -Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH PREFIX SMBCLIENT +Usage: test_smbclient_s3.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD USERID LOCAL_PATH PREFIX SMBCLIENT EOF exit 1; fi SERVER="$1" SERVER_IP="$2" -USERNAME="$3" -PASSWORD="$4" -USERID="$5" -LOCAL_PATH="$6" -PREFIX="$7" -SMBCLIENT="$8" +DOMAIN="$3" +USERNAME="$4" +PASSWORD="$5" +USERID="$6" +LOCAL_PATH="$7" +PREFIX="$8" +SMBCLIENT="$9" SMBCLIENT="$VALGRIND ${SMBCLIENT}" WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo}" -shift 8 +shift 9 ADDARGS="$*" incdir=`dirname $0`/../../../testprogs/blackbox @@ -218,6 +219,7 @@ EOF if [ $ret != 0 ] ; then echo "$out" echo "failed writing into read-only directory with error $ret" + false return fi @@ -235,6 +237,49 @@ EOF fi } + +# Test sending a message +test_message() +{ + tmpfile=$PREFIX/message_in.$$ + + cat > $tmpfile <<EOF +Test message from pid $$ +EOF + + cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD -M $SERVER -p 139 $ADDARGS -n msgtest < $tmpfile 2>&1' + eval echo "$cmd" + out=`eval $cmd` + ret=$? + + if [ $ret != 0 ] ; then + echo "$out" + echo "failed sending message to $SERVER with error $ret" + false + rm -f $tmpfile + return + fi + + cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmpguest -p 139 $ADDARGS -c "get message.msgtest $PREFIX/message_out.$$" 2>&1' + eval echo "$cmd" + out=`eval $cmd` + ret=$? + + if [ $ret != 0 ] ; then + echo "$out" + echo "failed getting sent message from $SERVER with error $ret" + false + return + fi + + if [ cmp $PREFIX/message_out.$$ $tmpfile != 0 ] ; then + echo "failed comparison of message from $SERVER" + false + return + fi + true +} + # Test reading an owner-only file (logon as guest) fails. test_owner_only_file() { @@ -389,6 +434,43 @@ test_ccache_access() $WBINFO --logoff } +# Test authenticating using the winbind ccache +test_auth_file() +{ + tmpfile=$PREFIX/smbclient.in.$$ + cat > $tmpfile <<EOF +username=${USERNAME} +password=${PASSWORD} +domain=${DOMAIN} +EOF + $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile \ + -c quit 2>&1 + ret=$? + rm $tmpfile + + if [ $ret != 0 ] ; then + echo "smbclient failed to use auth file" + false + return + fi + + cat > $tmpfile <<EOF +username=${USERNAME} +password=xxxx +domain=${DOMAIN} +EOF + $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile\ + -c quit 2>&1 + ret=$? + rm $tmpfile + + if [ $ret -eq 0 ] ; then + echo "smbclient succeeded with wrong auth file credentials" + false + return + fi +} + LOGDIR_PREFIX=test_smbclient_s3 # possibly remove old logdirs: @@ -444,6 +526,14 @@ testit "ccache access works for smbclient" \ test_ccache_access || \ failed=`expr $failed + 1` +testit "sending a message to the remote server" \ + test_message || \ + failed=`expr $failed + 1` + +testit "using an authentication file" \ + test_auth_file || \ + failed=`expr $failed + 1` + testit "rm -rf $LOGDIR" \ rm -rf $LOGDIR || \ failed=`expr $failed + 1` |