Skip to content

Commit b783fbc

Browse files
authored
Merge pull request #2826 from testssl/fix_2825
Fix not working --disable-rating switch
2 parents 8cb32a3 + 0b79356 commit b783fbc

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

testssl.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ f5_port_decode() {
11251125
# Sets the grade cap to ARG1
11261126
# arg1: A grade to set ("A", "B", "C", "D", "E", "F", "M", or "T")
11271127
# arg2: A reason why (e.g. "Vulnerable to CRIME")
1128+
#
11281129
set_grade_cap() {
11291130
"$do_rating" || return 0
11301131
GRADE_CAP_REASONS+=("Grade capped to $1. $2")
@@ -1141,6 +1142,7 @@ set_grade_cap() {
11411142

11421143
# Sets a grade warning, as specified by the grade specification
11431144
# arg1: A warning message
1145+
#
11441146
set_grade_warning() {
11451147
"$do_rating" || return 0
11461148
GRADE_WARNINGS+=("$1")
@@ -1150,6 +1152,7 @@ set_grade_warning() {
11501152
# Sets the score for Category 2 (Key Exchange Strength)
11511153
# arg1: Short key algorithm ("EC", "DH", "RSA", ...), or "DHE" for ephemeral key size
11521154
# arg2: key size (number of bits)
1155+
#
11531156
set_key_str_score() {
11541157
local type=$1
11551158
local size=$2
@@ -1187,6 +1190,7 @@ set_key_str_score() {
11871190
# Sets the best and worst bit size key, used to grade Category 3 (Cipher Strength)
11881191
# This function itself doesn't actually set a score; its just in the name to keep it logical (score == rating function)
11891192
# arg1: a bit size
1193+
#
11901194
set_ciph_str_score() {
11911195
local size=$1
11921196

@@ -23880,6 +23884,7 @@ run_rating() {
2388023884
# Rating needs a mix of certificate and vulnerabilities checks, in order to give out proper grades.
2388123885
# This function disables rating, if not all required checks are enabled
2388223886
# Returns "0" if rating is enabled, and "1" if rating is disabled
23887+
#
2388323888
set_rating_state() {
2388423889
local gbl
2388523890
local -i nr_enabled=0
@@ -23905,9 +23910,9 @@ set_rating_state() {
2390523910
return 0
2390623911
}
2390723912

23908-
2390923913
# This initializes boolean global do_* variables. They keep track of what to do
2391023914
# -- as the name insinuates
23915+
#
2391123916
initialize_globals() {
2391223917
do_allciphers=false
2391323918
do_vulnerabilities=false
@@ -23954,6 +23959,7 @@ initialize_globals() {
2395423959

2395523960

2395623961
# Set default scanning options for the boolean global do_* variables.
23962+
#
2395723963
set_scanning_defaults() {
2395823964
do_allciphers=false
2395923965
do_vulnerabilities=true
@@ -24321,9 +24327,9 @@ parse_cmd_line() {
2432124327
do_grease=true
2432224328
;;
2432324329
--disable-rating|--no-rating)
24324-
SKIP_TESTS+=("rating")
2432524330
# TODO: a generic thing would be --disable-* / --no-* ,
2432624331
# catch $1 and add it to the array ( #1502 )
24332+
SKIP_TESTS+=("rating")
2432724333
;;
2432824334
-9|--full)
2432924335
set_scanning_defaults
@@ -24736,9 +24742,11 @@ parse_cmd_line() {
2473624742
set_skip_tests
2473724743
[[ "$DEBUG" -ge 5 ]] && debug_globals
2473824744

24739-
# Unless explicit disabled, check if rating can be enabled
24740-
# Should be called after set_scanning_defaults
24741-
! "$do_rating" && set_rating_state
24745+
# Unless explicit disabled, check if rating can or should be enabled.
24746+
# Should be called after set_scanning_defaults() and set_skip_tests()
24747+
if [[ ! ${SKIP_TESTS[@]} =~ rating ]] ; then
24748+
set_rating_state
24749+
fi
2474224750

2474324751
CMDLINE_PARSED=true
2474424752
}

0 commit comments

Comments
 (0)