]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
Replace \s with [[:space:]] for compatibility
authorJarkko Oranen <oranenj@iki.fi>
Mon, 7 Sep 2020 17:47:30 +0000 (20:47 +0300)
committerLukas Schauer <lukas@schauer.so>
Wed, 30 Sep 2020 09:32:23 +0000 (11:32 +0200)
dehydrated

index 6c59db5dd7174291d074d72388dc2da46034313b..a5f1adb80a3ecfcae410d370e0f5049369ca317c 100755 (executable)
@@ -43,27 +43,27 @@ json_path() {
 # Get string value from json dictionary
 get_json_string_value() {
   local filter
-  filter="$(printf 's/.*\[%s\]\s*"\([^"]*\)"/\\1/p' "$(json_path "${1:-}" "${2:-}")")"
+  filter="$(printf 's/.*\[%s\][[:space:]]*"\([^"]*\)"/\\1/p' "$(json_path "${1:-}" "${2:-}")")"
   sed -n "${filter}"
 }
 
 # Get array values from json dictionary
 get_json_array_values() {
-  grep -E '^\['"$(json_path "${1:-}" "${2:-}")"',[0-9]*\]' | sed -e 's/\[[^\]*\]\s*//g' -e 's/^"//' -e 's/"$//'
+  grep -E '^\['"$(json_path "${1:-}" "${2:-}")"',[0-9]*\]' | sed -e 's/\[[^\]*\][[:space:]]*//g' -e 's/^"//' -e 's/"$//'
 }
 
 # Get sub-dictionary from json
 get_json_dict_value() {
   local filter
        echo "$(json_path "${1:-}" "${2:-}")"
-  filter="$(printf 's/.*\[%s\]\s*\(.*\)/\\1/p' "$(json_path "${1:-}" "${2:-}")")"
+  filter="$(printf 's/.*\[%s\][[:space:]]*\(.*\)/\\1/p' "$(json_path "${1:-}" "${2:-}")")"
   sed -n "${filter}" | jsonsh
 }
 
 # Get integer value from json
 get_json_int_value() {
   local filter
-  filter="$(printf 's/.*\[%s\]\s*\([^"]*\)/\\1/p' "$(json_path "${1:-}" "${2:-}")")"
+  filter="$(printf 's/.*\[%s\][[:space:]]*\([^"]*\)/\\1/p' "$(json_path "${1:-}" "${2:-}")")"
   sed -n "${filter}"
 }
 
@@ -1004,10 +1004,10 @@ sign_csr() {
     fi
 
     # Find challenge in authorization
-    challengeindex="$(echo "${response}" | grep -E '^\["challenges",[0-9]+,"type"\]\s+"'"${CHALLENGETYPE}"'"' | cut -d',' -f2 || true)"
+    challengeindex="$(echo "${response}" | grep -E '^\["challenges",[0-9]+,"type"\][[:space:]]+"'"${CHALLENGETYPE}"'"' | cut -d',' -f2 || true)"
 
     if [ -z "${challengeindex}" ]; then
-      allowed_validations="$(echo "${response}" | grep -E '^\["challenges",[0-9]+,"type"\]' | sed -e 's/\[[^\]*\]\s*//g' -e 's/^"//' -e 's/"$//' | tr '\n' ' ')"
+      allowed_validations="$(echo "${response}" | grep -E '^\["challenges",[0-9]+,"type"\]' | sed -e 's/\[[^\]*\][[:space:]]*//g' -e 's/^"//' -e 's/"$//' | tr '\n' ' ')"
       _exiterr "Validating this certificate is not possible using ${CHALLENGETYPE}. Possible validation methods are: ${allowed_validations}"
     fi
     challenge="$(echo "${response}" | get_json_dict_value -p '"challenges",'"${challengeindex}")"