From 2a540ddf759e1ea677b433710336f57c88a97711 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Tue, 3 Dec 2024 12:34:21 +0000 Subject: [PATCH] Allow more characters as part of 'lynis configure settings' command --- include/functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/functions b/include/functions index 1c0bbdc7..db7f5359 100644 --- a/include/functions +++ b/include/functions @@ -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