mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-22 14:23:41 +01:00
remove crude_grep in favor of a simple =~ substring match.
The crude_grep function served only to perform a simple substring check against the output of openssl -help. So, instead of running the command each time, iterating its output line by line, and checking for the substring within it, this simply caches the -help output at startup and uses $help =~ substring to produce the same result in a single pass.
This commit is contained in:
parent
f0142c323a
commit
9a0e055628
13
cipherscan
13
cipherscan
@ -19,6 +19,7 @@ if [[ "$(uname -s)" == "Darwin" ]]; then
|
|||||||
else
|
else
|
||||||
OPENSSLBIN="${REALPATH}/openssl"
|
OPENSSLBIN="${REALPATH}/openssl"
|
||||||
fi
|
fi
|
||||||
|
OPENSSLBINHELP="$($OPENSSLBIN s_client -help 2>&1)"
|
||||||
|
|
||||||
# cipherscan requires bash4, which doesn't come by default in OSX
|
# cipherscan requires bash4, which doesn't come by default in OSX
|
||||||
if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then
|
if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then
|
||||||
@ -295,18 +296,8 @@ c_hash() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
crude_grep() {
|
|
||||||
while read line; do
|
|
||||||
if [[ $line =~ $1 ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
check_option_support() {
|
check_option_support() {
|
||||||
$OPENSSLBIN s_client -help 2>&1 | crude_grep "$1"
|
[[ $OPENSSLBINHELP =~ "$1" ]]
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_openssl_output() {
|
parse_openssl_output() {
|
||||||
|
Loading…
Reference in New Issue
Block a user