Skip to content

Commit 2a540dd

Browse files
committed
Allow more characters as part of 'lynis configure settings' command
1 parent 562b1f1 commit 2a540dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/functions

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,11 +3052,11 @@
30523052

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

0 commit comments

Comments
 (0)