From 8f00ffb6b8b93e25794511336049bdaf53a33938 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 16 Dec 2019 13:50:59 +0000 Subject: [PATCH] Fix credentials short-circuits --- bin/credentials.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/credentials.sh b/bin/credentials.sh index c28ef80..5a675ec 100644 --- a/bin/credentials.sh +++ b/bin/credentials.sh @@ -57,12 +57,18 @@ get_from_flags() pass=$3 sfa=$4 - [ $user = yes ] && sekrit has services/"$service"/user || - err "Service \"$service\" has no user." - [ $pass = yes ] && sekrit has services/"$service"/pass || - err "Service \"$service\" has no pass." - [ $sfa = yes ] && sekrit has services/"$service"/2fa || - err "Service \"$service\" has no 2fa." + if [ $user = yes ]; then + sekrit has services/"$service"/user || + err "Service \"$service\" has no user." + fi + if [ $pass = yes ]; then + sekrit has services/"$service"/pass || + err "Service \"$service\" has no pass." + fi + if [ $sfa = yes ]; then + sekrit has services/"$service"/2fa || + err "Service \"$service\" has no 2fa." + fi [ $user = yes ] && get_user "$service" [ $pass = yes ] && get_pass "$service"