diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2019-05-06 23:27:08 +0200 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2019-05-06 23:37:41 +0200 |
commit | 0a8566302dd0c9cce65497611c1808c82328959f (patch) | |
tree | 5b930ecb7f008356821247092d916966107da088 | |
parent | 30458f3452087c3c0ecaf0866de307728c8eaa73 (diff) |
Don't wait forever for jdwp response
Some of web services do not send any data when challenged with JDWP
challenge. This makes the script waiting forever for response.
To fix that let's introduce 10s timeout (experimental value) and
replace empty string with a new line to avoid bash warnings.
Issue-ID: SECCOM-231
Change-Id: I35546c001c5c54f298e8a4e346c2cf5d41e230ac
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
-rwxr-xr-x | test/security/check_for_jdwp.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/security/check_for_jdwp.sh b/test/security/check_for_jdwp.sh index 7bcbade64..0facbff69 100755 --- a/test/security/check_for_jdwp.sh +++ b/test/security/check_for_jdwp.sh @@ -47,7 +47,8 @@ do_jdwp_handshake() { local jdwp_challenge="JDWP-Handshake\n" local jdwp_response="JDWP-Handshake" - local response=`nc $ip $port <<<$jdwp_challenge` + # 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 return 0 fi |