Skip to content

Commit

Permalink
FTP test failures on centos6
Browse files Browse the repository at this point in the history
Apparently centos6 is stuck on curl version 7.19, just before
--ssl-reqd turned up in 7.20.  Wow!

Check curl version and select --ssl-reqd for version 7.20+.
  • Loading branch information
tlhackque committed Mar 25, 2024
1 parent cdfc7a9 commit 22e7fa1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions getssl
Original file line number Diff line number Diff line change
Expand Up @@ -1115,14 +1115,14 @@ copy_file_to_location() { # copies a file, using scp, sftp or ftp if required.
SFTP_PORT=":990"
fi
# shellcheck disable=SC2086
debug curl ${_NOMETER} $FTPS_OPTIONS --ssl-reqd -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftps://${ftphost}${SFTP_PORT}/${ftpdirn}/"
debug curl ${_NOMETER} $FTPS_OPTIONS "${_CURL_SSL_REQD}" -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftps://${ftphost}${SFTP_PORT}/${ftpdirn}/"
# shellcheck disable=SC2086
curl ${_NOMETER} $FTPS_OPTIONS --ssl-reqd -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftps://${ftphost}${SFTP_PORT}/${ftpdirn}/"
curl ${_NOMETER} $FTPS_OPTIONS "${_CURL_SSL_REQD}" -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftps://${ftphost}${SFTP_PORT}/${ftpdirn}/"
else
# shellcheck disable=SC2086
debug curl ${_NOMETER} $FTPS_OPTIONS --ssl-reqd -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftp://${ftphost}${SFTP_PORT}/${ftpdirn}/"
debug curl ${_NOMETER} $FTPS_OPTIONS "${_CURL_SSL_REQD}" -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftp://${ftphost}${SFTP_PORT}/${ftpdirn}/"
# shellcheck disable=SC2086
curl ${_NOMETER} $FTPS_OPTIONS --ssl-reqd -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftp://${ftphost}${SFTP_PORT}/${ftpdirn}/"
curl ${_NOMETER} $FTPS_OPTIONS "${_CURL_SSL_REQD}" -u "${ftpuser}:${ftppass}" -T "${fromdir}/${fromfile}" "ftp://${ftphost}${SFTP_PORT}/${ftpdirn}/"
fi
else
if ! mkdir -p "$(dirname "$to")" ; then
Expand Down Expand Up @@ -1620,10 +1620,10 @@ for d in "${alldomains[@]}"; do
if [[ "${to:0:5}" == "ftps:" ]] ; then
[ -z "$FTP_PORT" ] && SFTP_PORT=":990"
# shellcheck disable=SC2086
curl ${_NOMETER} $FTPS_OPTIONS --ssl-reqd -u "${ftpuser}:${ftppass}" --silent -Q "DELE /${ftplocn}/${token:?}}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/"
curl ${_NOMETER} $FTPS_OPTIONS "${_CURL_SSL_REQD}" -u "${ftpuser}:${ftppass}" --silent -Q "DELE /${ftplocn}/${token:?}}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/"
else
# shellcheck disable=SC2086
curl ${_NOMETER} $FTPS_OPTIONS --ssl-reqd -u "${ftpuser}:${ftppass}" --silent -Q "DELE /${ftplocn}/${token:?}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/"
curl ${_NOMETER} $FTPS_OPTIONS "${_CURL_SSL_REQD}" -u "${ftpuser}:${ftppass}" --silent -Q "DELE /${ftplocn}/${token:?}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/"
fi
else
rm -f "${t_loc:?}/${token:?}"
Expand Down Expand Up @@ -3077,6 +3077,12 @@ if check_version "${_CURL_VERSION}" "7.67" ; then
_NOMETER="--no-progress-meter"
fi

if check_version "${_CURL_VERSION}" "7.20" ; then
_CURL_SSL_REQD="--ssl-reqd"
else
_CURL_SSL_REQD="--ftp-ssl-reqd"
fi

# Make sure mktemp works before going too far
MKDIR_TEST_FILE="$(mktemp 2>/dev/null || mktemp -t getssl.XXXXXX)"
if [ "$MKDIR_TEST_FILE" == "" ]; then
Expand Down

0 comments on commit 22e7fa1

Please sign in to comment.