Skip to content

Commit

Permalink
Minor error message improvements and comments (NFC)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Mar 4, 2022
1 parent 388c46e commit 0bbc026
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions easytls
Original file line number Diff line number Diff line change
Expand Up @@ -1506,15 +1506,16 @@ easytls_auto_check ()
[ -n "${AUTO_CHECK_DISABLED}" ] && \
easytls_verbose "auto-check disabled" && return 0

easytls_verbose "auto-check"
auto_check=1
# ALL status failures MUST be FATAL in future

# If inline-index does not exist then do not auto-check
[ -f "${EASYTLS_INLINE_INDEX}" ] || return 0
index_size="$("${EASYTLS_GREP}" -c '^.*$' "${EASYTLS_INLINE_INDEX}")"
[ "${index_size}" -gt 50 ] && \
warn "EasyTLS: 50+ .inline files found, use --disable-auto-check"

auto_check=1
# ALL status failures MUST be FATAL in future

# Check for revoked EasyRSA certs
# which still have an inline file
status invalid || die "inline_auto_check: status invalid error"
Expand Down Expand Up @@ -1637,10 +1638,13 @@ validate_hash ()
return 1
}

#if [ $EASYTLS_TEST ]; then

#validate_hash_block="$(( validate_hash_block + 1 ))"
#if [ -z "${auto_check}" ]; then
# easytls_verbose "General use - validate_hash (${validate_hash_block})"
# [ "${validate_hash_block}" -lt 2 ] || {
# # less than three is simplest
# [ "${validate_hash_block}" -lt 3 ] || {
# error_msg "validate_hash must only run twice"
# return 1
# }
Expand All @@ -1649,6 +1653,8 @@ validate_hash ()
# #validate_hash_block="$(( validate_hash_block - 1 ))"
#fi

#fi

#test_hash="${1}"
#test_length="${#test_hash}"

Expand Down Expand Up @@ -4108,7 +4114,8 @@ inline_tls_auth ()
"${EASYTLS_CAT}" "${tlskey_file}"
"${EASYTLS_PRINTF}" "%s\n\n" "</tls-auth>"

inline_share_fingerprint || die "inline_share_fingerprint"
inline_share_fingerprint || \
die "inline_tls_auth - inline_share_fingerprint"
} > "${inline_temp}" || die "Failed to create inline file: ${inline_temp}"

# Use cat for its intended purpose
Expand Down Expand Up @@ -4192,7 +4199,8 @@ inline_tls_crypt_v1 ()
"${EASYTLS_CAT}" "${tlskey_file}"
"${EASYTLS_PRINTF}" "%s\n\n" "</tls-crypt>"

inline_share_fingerprint || die "inline_share_fingerprint"
inline_share_fingerprint || \
die "inline_tls_crypt_v1 - inline_share_fingerprint"
} > "${inline_temp}" || die "Failed to create inline file: ${inline_temp}"

# Use cat for its intended purpose
Expand Down Expand Up @@ -4795,6 +4803,7 @@ inline_tls_cv2_group_client ()
inline_share_fingerprint ()
{
# Only supported by No-CA mode
# Normal CA mode ignores this step when building inline files
[ -n "${EASYTLS_NO_CA}" ] || return 0

# When first creating this inline add FP <tags> and return
Expand Down Expand Up @@ -6289,7 +6298,8 @@ build_self_sign ()
"${EASYTLS_CAT}" "${key_file}"
"${EASYTLS_PRINTF}" '%s\n\n' "<\key>"

inline_share_fingerprint || die "inline_share_fingerprint"
inline_share_fingerprint || \
die "build_self_sign - inline_share_fingerprint"
} > "${inline_file}" || die "Failed to create Inline file for ${cert_name}"
inline_share_fingerprint "${cert_name}" || \
die "inline_share_fingerprint - build_self_sign"
Expand Down

0 comments on commit 0bbc026

Please sign in to comment.