diff --git a/testssl.sh b/testssl.sh index 7d3ff0d..c35df6c 100755 --- a/testssl.sh +++ b/testssl.sh @@ -14489,6 +14489,7 @@ find_openssl_binary() { local s_client_has=$TEMPDIR/s_client_has.txt local s_client_starttls_has=$TEMPDIR/s_client_starttls_has.txt local openssl_location cwd="" + local ossl_wo_dev_info # 0. check environment variable whether it's executable if [[ -n "$OPENSSL" ]] && [[ ! -x "$OPENSSL" ]]; then @@ -14516,9 +14517,11 @@ find_openssl_binary() { # http://www.openssl.org/news/openssl-notes.html OSSL_NAME=$($OPENSSL version 2>/dev/null | awk '{ print $1 }') OSSL_VER=$($OPENSSL version 2>/dev/null | awk -F' ' '{ print $2 }') - OSSL_VER_MAJOR=$(sed 's/\..*$//' <<< "$OSSL_VER") - OSSL_VER_MINOR=$(sed -e 's/^.\.//' <<< "$OSSL_VER" | tr -d '[a-zA-Z]-') - OSSL_VER_APPENDIX=$(tr -d '0-9.' <<< "$OSSL_VER") + OSSL_VER_MAJOR="${OSSL_VER%%\.*}" + ossl_wo_dev_info="${OSSL_VER%%-*}" + OSSL_VER_MINOR="${ossl_wo_dev_info#$OSSL_VER_MAJOR\.}" + OSSL_VER_MINOR="${OSSL_VER_MINOR%%[a-zA-Z]*}" + OSSL_VER_APPENDIX="${ossl_wo_dev_info#$OSSL_VER_MAJOR\.$OSSL_VER_MINOR}" OSSL_VER_PLATFORM=$($OPENSSL version -p 2>/dev/null | sed 's/^platform: //') OSSL_BUILD_DATE=$($OPENSSL version -a 2>/dev/null | grep '^built' | sed -e 's/built on//' -e 's/: ... //' -e 's/: //' -e 's/ UTC//' -e 's/ +0000//' -e 's/.000000000//')