From a060e72ea0342646f0427b77952501aac9e9d057 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 8 May 2021 03:50:58 -0600 Subject: [PATCH] fix: confirm creds exist if using default location --- cfddns.posix.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cfddns.posix.sh b/cfddns.posix.sh index 9153f89..c0a646c 100644 --- a/cfddns.posix.sh +++ b/cfddns.posix.sh @@ -277,6 +277,10 @@ if ! command -v jq >/dev/null; then exit 2 fi [ -z "$dnsRecords" ] && badParam errMsg "You must specify at least one DNS record to update. Exiting." +# verify credentials file exists and is not empty (default check) +if [ ! -f "$accountFile" ] || [ ! -s "$accountFile" ]; then + badParam errMsg "Cannot find CloudFlare credentials file (${accountFile}). Exiting." +fi # turn off log file colourization if parameter is set if [ "$colourizeLogFile" -eq 0 ]; then bold=""