Allow more characters as part of 'lynis configure settings' command

This commit is contained in:
Michael Boelen 2024-12-03 12:34:21 +00:00
parent 562b1f1bae
commit 2a540ddf75
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04
1 changed files with 4 additions and 4 deletions

View File

@ -3052,11 +3052,11 @@
SafeInput() {
exitcode=1
# By default remove only control characters
# By default remove only special or undefined characters
if [ $# -eq 1 ]; then
input="$1"
# cleaned=$(echo ${input} | tr -d '[:cntrl:]')
cleaned=$(echo "$input" | sed 's/[^a-zA-Z0-9_-]//g')
# Allow only a common set of characters in first parameter
cleaned=$(echo "$input" | sed 's/[^a-zA-Z0-9\._:=-]//g')
# If know what to test against, then see if input matches the specified class
elif [ $# -eq 2 ]; then
input="$1"
@ -3065,7 +3065,7 @@
else
ExitFatal "No argument or too many arguments provided to SafeInput()"
fi
# Test if the cleaned string is the same as the original input
if [ "${cleaned}" = "${input}" ]; then
exitcode=0
fi