From 1e965466e420902c02a338a68916dff500478cd8 Mon Sep 17 00:00:00 2001 From: Joshua Rogers Date: Fri, 12 Jan 2024 01:21:14 +0700 Subject: [PATCH] Empty resolved file is not allowed. --- Snake.nocomments.sh | 1 + Snake.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Snake.nocomments.sh b/Snake.nocomments.sh index 555ec20..23c73bc 100644 --- a/Snake.nocomments.sh +++ b/Snake.nocomments.sh @@ -596,6 +596,7 @@ unresolved_key_file="$1" [[ -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 key_file="$(${s} readlink -f -- "$unresolved_key_file" 2>/dev/null)" +[[ -z "$key_file" ]] && key_files["$unresolved_key_file"]=1 && return 1 [[ -v 'priv_keys_files["$key_file"]' || ${#priv_keys_files["$key_file"]} -gt 0 ]] && priv_keys_files["$unresolved_key_file"]=1 && return 0 [[ -v 'key_files["$key_file"]' || ${#key_files["$key_file"]} -gt 0 ]] && key_files["$unresolved_key_file"]=1 && return 1 key_files["$unresolved_key_file"]=1 diff --git a/Snake.sh b/Snake.sh index 8882917..ce12fff 100755 --- a/Snake.sh +++ b/Snake.sh @@ -1020,6 +1020,8 @@ check_and_populate_keys() { key_file="$(${s} readlink -f -- "$unresolved_key_file" 2>/dev/null)" # use sudo because it may be a symlink in a priviliged location, not that it would really matter (ssh will just use the symlink) + [[ -z "$key_file" ]] && key_files["$unresolved_key_file"]=1 && return 1 + [[ -v 'priv_keys_files["$key_file"]' || ${#priv_keys_files["$key_file"]} -gt 0 ]] && priv_keys_files["$unresolved_key_file"]=1 && return 0 [[ -v 'key_files["$key_file"]' || ${#key_files["$key_file"]} -gt 0 ]] && key_files["$unresolved_key_file"]=1 && return 1