diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-09 21:27:29 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-09 21:27:30 +0100 |
commit | 9bee6712fc7fd4c8083b4c2c9b1eb0c54d4725dd (patch) | |
tree | 91c2306fc1c8b90fe81f678bbf3618084641c9e3 /src/network/access | |
parent | 50deb8cf70f61e21fb0c35182341477af11adbc1 (diff) | |
parent | a5ad605dfec2ab4e921d5c5843b23916ed5ae3bf (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I840849c072075a69819eb185b20bc42c3de0f825
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qftp.cpp | 12 |
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)); } |