1
0
forked from extern/SSH-Snake

Empty key location is also not allowed.

This commit is contained in:
Joshua Rogers 2024-01-12 01:19:09 +07:00
parent d803989131
commit 940a0a9152
2 changed files with 3 additions and 0 deletions

View File

@ -592,6 +592,7 @@ local unresolved_key_file
local key_file local key_file
local ignored_key_file local ignored_key_file
unresolved_key_file="$1" unresolved_key_file="$1"
[[ -z "$unresolved_key_file" ]] && return 1
[[ -v 'priv_keys_files["$unresolved_key_file"]' || ${#priv_keys_files["$unresolved_key_file"]} -gt 0 ]] && return 0 [[ -v 'priv_keys_files["$unresolved_key_file"]' || ${#priv_keys_files["$unresolved_key_file"]} -gt 0 ]] && return 0
[[ -v 'key_files["$unresolved_key_file"]' || ${#key_files["$unresolved_key_file"]} -gt 0 ]] && return 1 [[ -v 'key_files["$unresolved_key_file"]' || ${#key_files["$unresolved_key_file"]} -gt 0 ]] && return 1
key_file="$(${s} readlink -f -- "$unresolved_key_file" 2>/dev/null)" key_file="$(${s} readlink -f -- "$unresolved_key_file" 2>/dev/null)"

View File

@ -1012,6 +1012,8 @@ check_and_populate_keys() {
unresolved_key_file="$1" unresolved_key_file="$1"
[[ -z "$unresolved_key_file" ]] && return 1
# Avoid the readlink call if the path is already absolute. # Avoid the readlink call if the path is already absolute.
[[ -v 'priv_keys_files["$unresolved_key_file"]' || ${#priv_keys_files["$unresolved_key_file"]} -gt 0 ]] && return 0 [[ -v 'priv_keys_files["$unresolved_key_file"]' || ${#priv_keys_files["$unresolved_key_file"]} -gt 0 ]] && return 0
[[ -v 'key_files["$unresolved_key_file"]' || ${#key_files["$unresolved_key_file"]} -gt 0 ]] && return 1 [[ -v 'key_files["$unresolved_key_file"]' || ${#key_files["$unresolved_key_file"]} -gt 0 ]] && return 1