From 15e4073572f2142be513511571b1eb3c2538bc67 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Tue, 29 Jan 2008 21:35:15 +0100 Subject: [PATCH] added test OPENSSLEOF --- CHANGES | 3 +++ test.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 70cf165..88aca29 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,9 @@ corrections: corrected some bugs and typos in doc/socat.yo, EXAMPLES, C comments +further changes: + added test OPENSSLEOF for OpenSSL half close + ####################### V 1.6.0.0: new features: diff --git a/test.sh b/test.sh index 260ce2d..6a1dd33 100755 --- a/test.sh +++ b/test.sh @@ -1,6 +1,6 @@ #! /bin/bash # source: test.sh -# Copyright Gerhard Rieger 2001-2007 +# Copyright Gerhard Rieger 2001-2008 # Published under the GNU General Public License V.2, see file COPYING # perform lots of tests on socat @@ -3477,6 +3477,52 @@ esac PORT=$((PORT+1)) N=$((N+1)) +# does our OpenSSL implementation support halfclose? +NAME=OPENSSLEOF +case "$TESTS" in +*%functions%*|*%openssl%*|*%tcp%*|*%tcp4%*|*%ip4%*|*%$NAME%*) +TEST="$NAME: openssl half close" +# have an SSL server that executes "$OD_C" and see if EOF on the SSL client +# brings the result of od to the client +if ! testaddrs openssl >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}OPENSSL not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) +elif ! testaddrs listen tcp ip4 >/dev/null || ! runsip4 >/dev/null; then + $PRINTF "test $F_n $TEST... ${YELLOW}TCP/IPv4 not available${NORMAL}\n" $N + numCANT=$((numCANT+1)) +else +gentestcert testsrv +tf="$td/test$N.stdout" +te="$td/test$N.stderr" +tdiff="$td/test$N.diff" +da=$(date) +CMD2="$SOCAT $opts OPENSSL-LISTEN:$PORT,pf=ip4,reuseaddr,$SOCAT_EGD,cert=testsrv.crt,key=testsrv.key,verify=0 exec:'$OD_C'" +CMD="$SOCAT $opts - openssl:$LOCALHOST:$PORT,verify=0,$SOCAT_EGD" +printf "test $F_n $TEST... " $N +eval "$CMD2 2>\"${te}1\" &" +pid=$! # background process id +waittcp4port $PORT +echo "$da" |$CMD >$tf 2>"${te}2" +if ! echo "$da" |$OD_C |diff - "$tf" >"$tdiff"; then + $PRINTF "$FAILED: $SOCAT:\n" + echo "$CMD2 &" + echo "$CMD" + cat "${te}1" + cat "${te}2" + cat "$tdiff" + numFAIL=$((numFAIL+1)) +else + $PRINTF "$OK\n" + if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi + numOK=$((numOK+1)) +fi +kill $pid 2>/dev/null +wait +fi +esac +PORT=$((PORT+1)) +N=$((N+1)) + NAME=OPENSSL_SERVERAUTH case "$TESTS" in