Skip to content

Commit

Permalink
Make file deletion with ftp use the correct port.
Browse files Browse the repository at this point in the history
Score 1 for the tests.
  • Loading branch information
tlhackque committed Mar 25, 2024
1 parent e80fc38 commit 68b5f42
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions getssl
Original file line number Diff line number Diff line change
Expand Up @@ -1608,22 +1608,21 @@ for d in "${alldomains[@]}"; do
# shellcheck disable=SC2086
curl ${_NOMETER} -u "${davsuser}:${davspass}" -X "DELETE" "https://${davshost}:${davsport}${davsdirn}${davsfile}"
elif [[ "${t_loc:0:6}" == "ftpes:" ]] || [[ "${t_loc:0:5}" == "ftps:" ]] ; then
if [ -n "$FTP_PORT" ]; then SFTP_PORT=":${FTP_PORT}"; fi
# FTPES (FTP over explicit TLS/SSL, port 21) and FTPS (FTP over implicit TLS/SSL, port 990).
debug "using ftp to delete the file from $from"
ftpuser=$(echo "${t_loc}"| awk -F: '{print $2}')
ftppass=$(echo "${t_loc}"| awk -F: '{print $3}')
ftphost=$(echo "${t_loc}"| awk -F: '{print $4}')
ftplocn=$(echo "${t_loc}"| awk -F: '{print $5}')
SFTP_PORT=""
if [ -z "$FTP_PORT" ]; then
SFTP_PORT=":990"
fi

if [ -n "$FTP_PORT" ]; then SFTP_PORT=":${FTP_PORT}"; else SFTP_PORT=""; fi
debug "ftp user=$ftpuser - pass=$ftppass - host=$ftphost file=${ftplocn}/${token:?}"
if [[ "${to:0:5}" == "ftps:" ]] ; then
# shellcheck disable=SC2086
[ -z "$FTP_PORT" ] && SFTP_PORT=":990"
# shellcheck disable=SC2086
curl ${_NOMETER} $FTPS_OPTIONS --ftp-ssl --ftp-ssl-reqd -u "${ftpuser}:${ftppass}" --silent -Q "DELE ${token:?}}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/"
else
# shellcheck disable=SC2086
# shellcheck disable=SC2086
curl ${_NOMETER} $FTPS_OPTIONS --ftp-ssl --ftp-ssl-reqd -u "${ftpuser}:${ftppass}" --silent -Q "DELE ${token:?}" "ftp://${ftphost}${SFTP_PORT}/${ftplocn}/"
fi
else
Expand Down

0 comments on commit 68b5f42

Please sign in to comment.