]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
add test and fix bug with upper-case domains (fixes #176)
authorLukas Schauer <lukas@schauer.so>
Wed, 30 Mar 2016 15:37:44 +0000 (17:37 +0200)
committerLukas Schauer <lukas@schauer.so>
Wed, 30 Mar 2016 15:51:47 +0000 (17:51 +0200)
letsencrypt.sh
test.sh

index 3b527b33ee4302098e8916341c38b4c7af91b1a7..6606ac322db369eed41ae06fbb46e96a256156a9 100755 (executable)
@@ -572,7 +572,7 @@ command_sign_domains() {
   # Generate certificates for all domains found in domains.txt. Check if existing certificate are about to expire
   ORIGIFS="${IFS}"
   IFS=$'\n'
-  for line in $(<"${DOMAINS_TXT}" tr -d '\r' | _sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' -e 's/[[:space:]]+/ /g' | (grep -vE '^(#|$)' || true)); do
+  for line in $(<"${DOMAINS_TXT}" tr -d '\r' | tr '[:upper:]' '[:lower:]' | _sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' -e 's/[[:space:]]+/ /g' | (grep -vE '^(#|$)' || true)); do
     IFS="${ORIGIFS}"
     domain="$(printf '%s\n' "${line}" | cut -d' ' -f1)"
     morenames="$(printf '%s\n' "${line}" | cut -s -d' ' -f2-)"
diff --git a/test.sh b/test.sh
index dcb3d78515b2ea00265d773ff657c5d72a909a61..2e633c9b627cb2c62e7ce262978c96060a380935 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -148,9 +148,12 @@ _CHECK_LOG "Creating fullchain.pem"
 _CHECK_LOG "Done!"
 _CHECK_ERRORLOG
 
-# Add domain to domains.txt and run in cron mode again (should find a non-expiring certificate and do nothing)
+# Prepare domains.txt
+# Modify TMP3_URL to be uppercase to check for upper-lower-case mismatch bugs
+echo "${TMP_URL} ${TMP2_URL} $(tr 'a-z' 'A-Z' <<<"${TMP3_URL}")" >> domains.txt
+
+# Run in cron mode again (should find a non-expiring certificate and do nothing)
 _TEST "Run in cron mode again, this time with domain in domains.txt, should find non-expiring certificate"
-echo "${TMP_URL} ${TMP2_URL} ${TMP3_URL}" >> domains.txt
 ./letsencrypt.sh --cron > tmplog 2> errorlog || _FAIL "Script execution failed"
 _CHECK_LOG "Checking domain name(s) of existing cert... unchanged."
 _CHECK_LOG "Skipping renew"