summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-12 08:00:04 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-01-12 08:00:04 +0000
commitc81966c39ebafebc6ceb2b0a8f8a39b9a08d1c14 (patch)
tree84c542c2aaf6d9670b1e46d2acdac865e98a33b1 /src/network
parente6c089ae288ffe729b0e4eaa968461e3d8b76c5a (diff)
parentf4d8cafc1b034f544ca84b849c23ab99bc1600e7 (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qftp.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index 762ef00225..719e3536b4 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -1702,8 +1702,16 @@ int QFtp::connectToHost(const QString &host, quint16 port)
int QFtp::login(const QString &user, const QString &password)
{
QStringList cmds;
- cmds << (QLatin1String("USER ") + (user.isNull() ? QLatin1String("anonymous") : user) + QLatin1String("\r\n"));
- cmds << (QLatin1String("PASS ") + (password.isNull() ? QLatin1String("anonymous@") : password) + QLatin1String("\r\n"));
+
+ if (user.isNull() || user.compare(QLatin1String("anonymous"), Qt::CaseInsensitive) == 0) {
+ cmds << (QLatin1String("USER ") + (user.isNull() ? QLatin1String("anonymous") : user) + QLatin1String("\r\n"));
+ cmds << (QLatin1String("PASS ") + (password.isNull() ? QLatin1String("anonymous@") : password) + QLatin1String("\r\n"));
+ } else {
+ cmds << (QLatin1String("USER ") + user + QLatin1String("\r\n"));
+ if (!password.isNull())
+ cmds << (QLatin1String("PASS ") + password + QLatin1String("\r\n"));
+ }
+
return d_func()->addCommand(new QFtpCommand(Login, cmds));
}