diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2020-11-09 12:36:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 12:36:37 +0300 |
commit | f0b7f9159d2eaf114deed058cbe531041f236e01 (patch) | |
tree | 061ec11b5eac40108404865698ede6f8d7369440 | |
parent | 7bfbbb5184f0c44c6c4c690f36828632fffd8902 (diff) | |
parent | 3e3589291f7a9ca2ccb36e178fdc6521373fa2b6 (diff) |
Merge pull request #1069 from Varbin/1065-opensolaris-invalid-characters
Use `od` only for displaying invalid characters
-rw-r--r-- | include/profiles | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/profiles b/include/profiles index e7b9557a..e7a25670 100644 --- a/include/profiles +++ b/include/profiles @@ -35,7 +35,7 @@ # Show deprecation message for old config entries such as 'config:' and 'apache:' FOUND=0 - DATA=$(grep -E "^[a-z-]{1,}:" ${PROFILE} | od -An -ta | sed 's/ /!space!/g') # od -An (no file offset), -ta (named character, to be on safe side) + DATA=$(grep -E "^[a-z-]{1,}:" ${PROFILE}) if ! IsEmpty "${DATA}"; then FOUND=1; fi if [ ${FOUND} -eq 1 ]; then @@ -56,12 +56,11 @@ fi # Security check for unexpected and possibly harmful escape characters (hyphen should be listed as first or last character) - DATA=$(grep -Ev '^$|^ |^#|^config:' "${PROFILE}" | tr -d '[:alnum:]/\[\]\(\)_\|,\.:;= \n\r-' | od -An -ta | sed 's/ /!space!/g') + DATA=$(grep -Ev '^$|^ |^#|^config:' "${PROFILE}" | tr -d '[:alnum:]/\[\]\(\)_\|,\.:;= \n\r-') if ! IsEmpty "${DATA}"; then DisplayWarning "Your profile '${PROFILE}' contains unexpected characters. See the log file for more information." LogText "Found unexpected or possibly harmful characters in profile '${PROFILE}'. See which characters matched in the output below and compare them with your profile." - for I in ${DATA}; do - I=$(echo ${I} | sed 's/!space!/ /g') + for I in $(printf ${DATA} | od -An -ta); do LogText "Output: ${I}" done LogText "Suggestion: comment incorrect lines with a '#' and try again. Open a GitHub issue if valid characters are blocked" |