V8.13.400.2025.11.08
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m11s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-11-09 17:03:23 +01:00
parent 7f342bfe8e
commit 1e5b1e7ede
3 changed files with 22 additions and 11 deletions

View File

@@ -95,17 +95,27 @@ normalize_ssh_key_file() {
var_tmp_file="${var_key_file}.noCR.$$"
### Remove only '\r', keep everything else as-is.
tr -d '\r' < "${var_key_file}" > "${var_tmp_file}" || {
echo "ERROR: Failed to normalize CRLF in ${var_key_file}" >&2
rm -f "${var_tmp_file}"
return 1
}
if ! tr -d '\r' < "${var_key_file}" >| "${var_tmp_file}"; then
mv "${var_tmp_file}" "${var_key_file}" || {
echo "ERROR: Failed to replace normalized file ${var_key_file}" >&2
printf "\e[91m++++ ++++ ++++ ++++ ++++ ++++ ++ ❌ Failed to normalize CRLF: [%s] \e[0m\n" "${var_key_file}"
rm -f "${var_tmp_file}"
return 1
}
return "${ERR_SANITIZING}"
fi
mv "${var_tmp_file}" "${var_key_file}"
if command -v ssh-keygen >/dev/null 2>&1; then
if ! ssh-keygen -lf "${var_key_file}" >/dev/null; then
printf "\e[91m++++ ++++ ++++ ++++ ++++ ++++ ++ ❌ Failed check ssh-keygen -lf: [%s] \e[0m\n" "${var_key_file}"
return "${ERR_SANITIZING}"
fi
fi
fi
return 0