Skip to content

Commit a385339

Browse files
authored
Merge pull request #2102 from drwetter/fix_2100_3.0
Fix locale error message when en_US.UTF-8 isn't available (3.0)
2 parents 8b2fae0 + f872bd5 commit a385339

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

testssl.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ declare -r UA_SNEAKY="Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Fi
270270

271271
########### Initialization part, further global vars just being declared here
272272
#
273-
LC_COLLATE=en_US.UTF-8 # ensures certain regex patterns work as expected and aren't localized, see #1860
273+
LC_COLLATE="" # ensures certain regex patterns work as expected and aren't localized, see setup_lc_collate()
274274
PRINTF="" # which external printf to use. Empty presets the internal one, see #1130
275275
IKNOW_FNAME=false
276276
FIRST_FINDING=true # is this the first finding we are outputting to file?
@@ -5036,7 +5036,7 @@ run_protocols() {
50365036
add_tls_offered ssl2 yes
50375037
;;
50385038
7) prln_local_problem "$OPENSSL doesn't support \"s_client -ssl2\""
5039-
fileout "$jsonID" "INFO" "not tested due to lack of local support"
5039+
fileout "$jsonID" "WARN" "not tested due to lack of local support"
50405040
((ret++))
50415041
;;
50425042
esac
@@ -17273,6 +17273,29 @@ check_bsd_mount() {
1727317273
fi
1727417274
}
1727517275

17276+
# It's important to avoid certain locales as the impact bash's pattern matching, see #1860
17277+
# and comment in #2100
17278+
#
17279+
setup_lc_collate() {
17280+
local l=""
17281+
local msg='locale(1) support for any of "C, POSIX, C.UTF-8, en_US.UTF-8, en_GB.UTF-8" missing'
17282+
local found=false
17283+
17284+
for l in C POSIX C.UTF-8 en_US.UTF-8 en_GB.UTF-8; do
17285+
locale -a | grep -q $l
17286+
[[ $? -ne 0 ]] && continue
17287+
export LC_COLLATE=$l
17288+
found=true
17289+
break
17290+
done
17291+
if ! "$found"; then
17292+
prln_local_problem "$msg\n"
17293+
fileout "$jsonID" "WARN" "$msg"
17294+
return 1
17295+
fi
17296+
return 0
17297+
}
17298+
1727617299
# This sets the PRINTF command for writing into TCP sockets. It is needed because
1727717300
# The shell builtin printf flushes the write buffer at every \n, ("\x0a") which
1727817301
# in turn means a new TCP fragment. That causes a slight performance penalty and
@@ -20307,7 +20330,7 @@ lets_roll() {
2030720330
check_proxy
2030820331
check4openssl_oldfarts
2030920332
check_bsd_mount
20310-
20333+
setup_lc_collate
2031120334

2031220335
if "$do_display_only"; then
2031320336
prettyprint_local "$PATTERN2SHOW"

0 commit comments

Comments
 (0)