summaryrefslogtreecommitdiffstats
path: root/lib/libfetch/ftp.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2006-01-19 08:31:47 +0000
committerdes <des@FreeBSD.org>2006-01-19 08:31:47 +0000
commitfe60356e678d0d180f0fd520fa02776f76af65fd (patch)
treea75e9e9dbe881a3eda17cd3b452b88504ed63aab /lib/libfetch/ftp.c
parent46342446289b9f9b89fad476871dd100b76e7e12 (diff)
downloadFreeBSD-src-fe60356e678d0d180f0fd520fa02776f76af65fd.zip
FreeBSD-src-fe60356e678d0d180f0fd520fa02776f76af65fd.tar.gz
In order to maintain interoperability with certain broken FTP servers,
ignore a MODE failure if and only if the mode we attempted to set was S (which is supposed to be the default). PR: bin/91973
Diffstat (limited to 'lib/libfetch/ftp.c')
-rw-r--r--lib/libfetch/ftp.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index c504cbe..cd8ff0d 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -322,8 +322,24 @@ _ftp_mode_type(conn_t *conn, int mode, int type)
default:
return (FTP_PROTOCOL_ERROR);
}
- if ((e = _ftp_cmd(conn, "MODE %c", mode)) != FTP_OK)
- return (e);
+ if ((e = _ftp_cmd(conn, "MODE %c", mode)) != FTP_OK) {
+ if (mode == 'S') {
+ /*
+ * Stream mode is supposed to be the default - so
+ * much so that some servers not only do not
+ * support any other mode, but do not support the
+ * MODE command at all.
+ *
+ * If "MODE S" fails, it is unlikely that we
+ * previously succeeded in setting a different
+ * mode. Therefore, we simply hope that the
+ * server is already in the correct mode, and
+ * silently ignore the failure.
+ */
+ } else {
+ return (e);
+ }
+ }
switch (type) {
case 0:
OpenPOWER on IntegriCloud