From d46e09428058bbd5eb48be1b03fed9d637fd416e Mon Sep 17 00:00:00 2001 From: Casper Date: Tue, 21 Dec 2021 17:01:40 +0100 Subject: [PATCH] Remove quotes to meet style guidelines (#2330) Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> --- .github/workflows/scripts/docs/update-versions-json.sh | 2 +- docs/content/contributing/coding-style.md | 2 +- target/bin/addmailuser | 2 +- target/bin/delquota | 2 +- target/bin/fail2ban | 2 +- target/bin/listmailuser | 2 +- target/bin/setquota | 2 +- target/scripts/helper-functions.sh | 2 +- target/scripts/startup/setup-stack.sh | 4 ++-- test/mail_fail2ban.bats | 2 +- test/mail_postscreen.bats | 2 +- test/security_tls_cipherlists.bats | 4 ++-- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/scripts/docs/update-versions-json.sh b/.github/workflows/scripts/docs/update-versions-json.sh index 5bdd7141..64473bf8 100755 --- a/.github/workflows/scripts/docs/update-versions-json.sh +++ b/.github/workflows/scripts/docs/update-versions-json.sh @@ -33,7 +33,7 @@ function _update_versions_json local VERSION_EXISTS VERSION_EXISTS=$(jq --arg version "${MAJOR_MINOR}" '[.[].version == $version] | any' "${VERSIONS_JSON}") - if [[ "${VERSION_EXISTS}" == "true" ]] + if [[ ${VERSION_EXISTS} == "true" ]] then echo "${MAJOR_MINOR} docs are already supported. Nothing to change, exiting.." exit 1 diff --git a/docs/content/contributing/coding-style.md b/docs/content/contributing/coding-style.md index cad6048a..202344e9 100644 --- a/docs/content/contributing/coding-style.md +++ b/docs/content/contributing/coding-style.md @@ -139,7 +139,7 @@ function _setup_postfix_aliases DOMAIN=$(echo "${FROM}" | cut -d @ -f2) # if they are equal it means the line looks like: "user1 other@example.com" - [[ "${UNAME}" != "${DOMAIN}" ]] && echo "${DOMAIN}" >> /tmp/vhost.tmp + [[ ${UNAME} != "${DOMAIN}" ]] && echo "${DOMAIN}" >> /tmp/vhost.tmp done < <(grep -v "^\s*$\|^\s*\#" /tmp/docker-mailserver/postfix-virtual.cf || true) else _notify 'inf' "Warning '/tmp/docker-mailserver/postfix-virtual.cf' is not provided. No mail alias/forward created." diff --git a/target/bin/addmailuser b/target/bin/addmailuser index 1d5355bd..949cee6f 100755 --- a/target/bin/addmailuser +++ b/target/bin/addmailuser @@ -40,7 +40,7 @@ shift PASSWD="${*}" [[ -z ${FULL_EMAIL} ]] && { __usage ; errex 'No username specified' ; } -[[ "${FULL_EMAIL}" =~ .*\@.* ]] || { __usage ; errex 'Username must include the domain' ; } +[[ ${FULL_EMAIL} =~ .*\@.* ]] || { __usage ; errex 'Username must include the domain' ; } touch "${DATABASE}" create_lock # Protect config file with lock to avoid race conditions diff --git a/target/bin/delquota b/target/bin/delquota index 1d773133..913facf7 100755 --- a/target/bin/delquota +++ b/target/bin/delquota @@ -13,7 +13,7 @@ function __usage { echo "Usage: delquota " ; } USER="${1}" [[ -z ${USER} ]] && { __usage ; errex "No username specified" ; } -[[ "${USER}" =~ .*\@.* ]] || { __usage ; errex "Username must include the domain"; } +[[ ${USER} =~ .*\@.* ]] || { __usage ; errex "Username must include the domain"; } if ! grep -qE "^${USER}\|" "${USER_DATABASE}" then diff --git a/target/bin/fail2ban b/target/bin/fail2ban index 4ce4a3ae..6c594f48 100755 --- a/target/bin/fail2ban +++ b/target/bin/fail2ban @@ -64,7 +64,7 @@ else do RESULT="$(fail2ban-client set "${JAIL}" unbanip "${@}" 2>&1)" - [[ "${RESULT}" != *"is not banned"* ]] && [[ "${RESULT}" != *"NOK"* ]] && echo -e "Unbanned IP from ${JAIL}: ${RESULT}" + [[ ${RESULT} != *"is not banned"* ]] && [[ ${RESULT} != *"NOK"* ]] && echo -e "Unbanned IP from ${JAIL}: ${RESULT}" done else diff --git a/target/bin/listmailuser b/target/bin/listmailuser index d9ab0b9e..6f52ab9b 100755 --- a/target/bin/listmailuser +++ b/target/bin/listmailuser @@ -26,7 +26,7 @@ while read -r LINE do USER=$(echo "${LINE}" | cut -d'|' -f1) - if [[ "${ENABLE_QUOTAS}" -eq 1 ]] + if [[ ${ENABLE_QUOTAS} -eq 1 ]] then # ${QUOTA[0]} => current size # ${QUOTA[1]} => configured size limit diff --git a/target/bin/setquota b/target/bin/setquota index ddf0c42d..1b461da8 100755 --- a/target/bin/setquota +++ b/target/bin/setquota @@ -18,7 +18,7 @@ QUOTA="${*}" function usage { echo "Usage: setquota []" ; } [[ -z ${USER} ]] && { usage ; errex "no username specified" ; } -[[ "${USER}" =~ .*\@.* ]] || { usage ; errex "username must include the domain" ; } +[[ ${USER} =~ .*\@.* ]] || { usage ; errex "username must include the domain" ; } if ! grep -qE "^${USER}\|" "${USER_DATABASE}" then diff --git a/target/scripts/helper-functions.sh b/target/scripts/helper-functions.sh index 1233ea98..b5b2ebe3 100755 --- a/target/scripts/helper-functions.sh +++ b/target/scripts/helper-functions.sh @@ -189,7 +189,7 @@ export -f _extract_certs_from_acme # Remove the `*.` prefix if it exists, else returns the input value function _strip_wildcard_prefix { - [[ "${1}" == "*."* ]] && echo "${1:2}" || echo "${1}" + [[ ${1} == "*."* ]] && echo "${1:2}" || echo "${1}" } # ? --------------------------------------------- Notifications diff --git a/target/scripts/startup/setup-stack.sh b/target/scripts/startup/setup-stack.sh index 870bd733..5ac1263a 100644 --- a/target/scripts/startup/setup-stack.sh +++ b/target/scripts/startup/setup-stack.sh @@ -383,7 +383,7 @@ function _setup_ldap # Add protocol to DOVECOT_URIS so that we can use dovecot's "uris" option: # https://doc.dovecot.org/configuration_manual/authentication/ldap/ - if [[ "${DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]}" != *'://'* ]] + if [[ ${DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]} != *'://'* ]] then DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]="ldap://${DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]}" fi @@ -562,7 +562,7 @@ function _setup_saslauthd [[ -z ${SASLAUTHD_LDAP_PASSWORD} ]] && SASLAUTHD_LDAP_PASSWORD="${LDAP_BIND_PW}" [[ -z ${SASLAUTHD_LDAP_SEARCH_BASE} ]] && SASLAUTHD_LDAP_SEARCH_BASE="${LDAP_SEARCH_BASE}" - if [[ "${SASLAUTHD_LDAP_SERVER}" != *'://'* ]] + if [[ ${SASLAUTHD_LDAP_SERVER} != *'://'* ]] then SASLAUTHD_LDAP_SERVER="ldap://${SASLAUTHD_LDAP_SERVER}" fi diff --git a/test/mail_fail2ban.bats b/test/mail_fail2ban.bats index e27fddf1..615e5f29 100644 --- a/test/mail_fail2ban.bats +++ b/test/mail_fail2ban.bats @@ -96,7 +96,7 @@ function teardown_file() { 'exec 3<>/dev/tcp/${MAIL_FAIL2BAN_IP}/25 && \ while IFS= read -r cmd; do \ head -1 <&3; \ - [[ "${cmd}" == "EHLO"* ]] && sleep 6; \ + [[ ${cmd} == "EHLO"* ]] && sleep 6; \ echo ${cmd} >&3; \ done < "/tmp/docker-mailserver-test/auth/smtp-auth-login-wrong.txt"' done diff --git a/test/mail_postscreen.bats b/test/mail_postscreen.bats index bb39270b..c006b812 100644 --- a/test/mail_postscreen.bats +++ b/test/mail_postscreen.bats @@ -51,7 +51,7 @@ teardown_file() { 'exec 3<>/dev/tcp/'"${MAIL_POSTSCREEN_IP}"'/25 && \ while IFS= read -r cmd; do \ head -1 <&3; \ - [[ "${cmd}" == "EHLO"* ]] && sleep 6; \ + [[ ${cmd} == "EHLO"* ]] && sleep 6; \ echo ${cmd} >&3; \ done < "/tmp/docker-mailserver-test/auth/smtp-auth-login.txt"' done diff --git a/test/security_tls_cipherlists.bats b/test/security_tls_cipherlists.bats index ecb89de1..dd8495fd 100644 --- a/test/security_tls_cipherlists.bats +++ b/test/security_tls_cipherlists.bats @@ -171,7 +171,7 @@ function check_cipherlists() { local p25=$2 # optional suffix # TLS_LEVEL `modern` doesn't have TLS v1.0 or v1.1 cipher suites. Sets TLS v1.2 as minimum. - if [[ "${TLS_LEVEL}" == "intermediate" ]] + if [[ ${TLS_LEVEL} == "intermediate" ]] then compare_cipherlist "cipherorder_TLSv1" "${RESULTS_FILE}" "$(get_cipherlist "TLSv1${p25}")" compare_cipherlist "cipherorder_TLSv1_1" "${RESULTS_FILE}" "$(get_cipherlist "TLSv1_1${p25}")" @@ -187,7 +187,7 @@ function check_cipherlists() { function get_cipherlist() { local TLS_VERSION=$1 - if [[ "${TLS_VERSION}" == "TLSv1_3" ]] + if [[ ${TLS_VERSION} == "TLSv1_3" ]] then # TLS v1.3 cipher suites are not user defineable and not unique to the available certificate(s). # They do not support server enforced order either.