s3:tests: Add a test which checks that the smbclient session setup works
authorAndreas Schneider <asn@samba.org>
Tue, 6 Jun 2017 15:54:18 +0000 (17:54 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 7 Jun 2017 03:15:16 +0000 (05:15 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12824

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/script/tests/test_smbclient_s3.sh

index 0ae85e8e6474b52d230b7df4fadf61d6adfe8e57..1359ed2b7bd10d81c586d22f3b0504bd95dca4d2 100755 (executable)
@@ -1212,6 +1212,36 @@ EOF
     fi
 }
 
+test_server_os_message()
+{
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+    cat > $tmpfile <<EOF
+ls
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+    rm -f $tmpfile
+
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo "failed to connect error $ret"
+       false
+       return
+    fi
+
+    echo "$out" | grep 'Domain=\[SAMBA.*\] OS=\[Windows [0-9]\.[0-9]\] Server=\[Samba'
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo "failed - should get: Domain=[SAMBA-TEST] OS=[Windows 6.1] Server=..."
+       false
+       return
+    fi
+}
+
 LOGDIR_PREFIX=test_smbclient_s3
 
 # possibly remove old logdirs:
@@ -1315,6 +1345,10 @@ testit "follow symlinks = no" \
     test_nosymlinks || \
     failed=`expr $failed + 1`
 
+testit "server os message" \
+    test_server_os_message || \
+    failed=`expr $failed + 1`
+
 testit "rm -rf $LOGDIR" \
     rm -rf $LOGDIR || \
     failed=`expr $failed + 1`