Merge pull request #1445 from drwetter/alternative_temppath

Try temp file creation in a different location
This commit is contained in:
Dirk Wetter 2020-01-15 09:59:12 +01:00 committed by GitHub
commit 2a87f7505d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -17195,7 +17195,15 @@ EOF
}
maketempf() {
TEMPDIR=$(mktemp -d /tmp/testssl.XXXXXX) || exit $ERR_FCREATE
TEMPDIR=$(mktemp -d /tmp/testssl.XXXXXX)
if [[ $? -ne 0 ]]; then
# For e.g. devices where we can't write to /tmp we chose $PWD but we can't
# allow every char as we haven't quoted all strings depending on it, see #1445
if [[ $PWD =~ [^A-Za-z0-9\.,/_-] ]]; then
fatal "\$PWD contains illegal chars: \"$BASH_REMATCH\"" $ERR_FCREATE
fi
TEMPDIR=$(mktemp -d "$PWD/testssl.XXXXXX") || exit $ERR_FCREATE
fi
TMPFILE=$TEMPDIR/tempfile.txt || exit $ERR_FCREATE
if [[ "$DEBUG" -eq 0 ]]; then
ERRFILE="/dev/null"
@ -19995,8 +20003,8 @@ lets_roll() {
initialize_globals
check_base_requirements # needs to come after $do_html is defined
parse_cmd_line "$@"
# CMDLINE_PARSED has been set now. Don't put a now function after this which calls fatal(). Rather
# put it after csv_header below
# CMDLINE_PARSED has been set now. Don't put a function immediately after this which calls fatal().
# Rather put it after csv_header below.
# html_header() needs to be called early! Otherwise if html_out() is called before html_header() and the
# command line contains --htmlfile <htmlfile> or --html, it'll make problems with html output, see #692.
# json_header and csv_header could be called later but for context reasons we'll leave it here