From 02489e6813575a5f2c9ce3d1af04ca63db7666f8 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 8 Jan 2019 01:59:45 -0700 Subject: [PATCH] added check for absolute path to supplied paths --- .vscode/numbered-bookmarks.json | 2 +- setup.sh | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index fe866c3..ea7bab8 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -6,7 +6,7 @@ -1, 19, 54, - 758, + 774, 68, -1, -1, diff --git a/setup.sh b/setup.sh index a9af728..1e10a56 100755 --- a/setup.sh +++ b/setup.sh @@ -320,7 +320,7 @@ if [ "${useSSL}" -eq 1 ] && [ "${useCertbot}" -eq 0 ]; then echo -e "\n${cyan}---exiting---\n${norm}" exit 1 ;; - *) + /*) # validate path if [ -f "${inputCertPath}" ]; then CertPath="${inputCertPath}" @@ -346,6 +346,10 @@ if [ "${useSSL}" -eq 1 ] && [ "${useCertbot}" -eq 0 ]; then fi fi ;; + *) + # path must be absolute and start with a slash + echo -e "\n${err}Path must be absolute not relative. Please re-enter starting with '/'${norm}" + ;; esac done @@ -360,7 +364,7 @@ if [ "${useSSL}" -eq 1 ] && [ "${useCertbot}" -eq 0 ]; then echo -e "\n${cyan}---exiting---\n${norm}" exit 1 ;; - *) + /*) # validate path if [ -f "${inputKeyPath}" ]; then KeyPath="${inputKeyPath}" @@ -386,6 +390,10 @@ if [ "${useSSL}" -eq 1 ] && [ "${useCertbot}" -eq 0 ]; then fi fi ;; + *) + # path must be absolute and start with a slash + echo -e "\n${err}Path must be absolute not relative. Please re-enter starting with '/'${norm}" + ;; esac done @@ -409,7 +417,7 @@ if [ "${useSSL}" -eq 1 ] && [ "${useCertbot}" -eq 0 ]; then echo -e "\n${cyan}---exiting---\n${norm}" exit 1 ;; - *) + /*) # validate path if [ -f "${inputCAChainPath}" ]; then CAChainPath="${inputCAChainPath}" @@ -435,6 +443,10 @@ if [ "${useSSL}" -eq 1 ] && [ "${useCertbot}" -eq 0 ]; then fi fi ;; + *) + # path must be absolute and start with a slash + echo -e "\n${err}Path must be absolute not relative. Please re-enter starting with '/'${norm}" + ;; esac done fi @@ -488,7 +500,7 @@ while true; do generateDH=1 break ;; - *) + /*) # validate path if [ -f "${inputDHPath}" ]; then DHPath="${inputDHPath}" @@ -514,6 +526,10 @@ while true; do fi fi ;; + *) + # path must be absolute and start with a slash + echo -e "\n${err}Path must be absolute not relative. Please re-enter starting with '/'${norm}" + ;; esac done fi