From e095b67857f4bad35a366659d3d0f428f2747afb Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Fri, 10 May 2019 22:43:10 +0200 Subject: Don't treat error reply as a proper JDWP handshake As it turned out thanks to Yan Yang some ONAP services tend to return a propr JDWP handshake as a part of their error message. Let's filter out those services by checking number of lines returned by the server. We expect that proper JDWP handshake won't be longer than a single line. Issue-ID: SECCOM-231 Change-Id: I4b8950ebdf5fe118ec5f2dd5f4de583211784fb2 Signed-off-by: Krzysztof Opasiak --- test/security/check_for_jdwp.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/security/check_for_jdwp.sh b/test/security/check_for_jdwp.sh index 0facbff69..e79f712bf 100755 --- a/test/security/check_for_jdwp.sh +++ b/test/security/check_for_jdwp.sh @@ -49,7 +49,8 @@ do_jdwp_handshake() { # 10s timeout to avoid hangs when service doesn't answer at all local response=`nc -w 10 $ip $port <<<$jdwp_challenge | tr '\0' '\n'` - if [[ $response == *"$jdwp_response"* ]]; then + local n_response_lines=`echo "$response" | wc -l` + if [[ "$n_response_lines" -le 1 ]] && [[ $response == *"$jdwp_response"* ]]; then return 0 fi -- cgit 1.2.3-korg