mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Adds option to force SSLv3 usage for Subsonic, as mentioned in
enhancement 1930.
This commit is contained in:
parent
064249deeb
commit
25d92f5083
@ -151,6 +151,7 @@ void SubsonicService::ReloadSettings() {
|
||||
server_ = s.value("server").toString();
|
||||
username_ = s.value("username").toString();
|
||||
password_ = s.value("password").toString();
|
||||
usesslv3_ = s.value("usesslv3").toBool();
|
||||
|
||||
Login();
|
||||
}
|
||||
@ -162,7 +163,9 @@ bool SubsonicService::IsConfigured() const {
|
||||
}
|
||||
|
||||
void SubsonicService::Login() {
|
||||
// Forget session ID
|
||||
// Recreate fresh network state, otherwise old HTTPS settings seem to get reused
|
||||
// This might leave stale idle connections around in background, but this shouldn't get called regularly
|
||||
network_ = new QNetworkAccessManager(this);
|
||||
network_->setCookieJar(new QNetworkCookieJar(network_));
|
||||
// Forget login state whilst waiting
|
||||
login_state_ = LoginState_Unknown;
|
||||
@ -174,10 +177,11 @@ void SubsonicService::Login() {
|
||||
}
|
||||
|
||||
void SubsonicService::Login(
|
||||
const QString& server, const QString& username, const QString& password) {
|
||||
const QString& server, const QString& username, const QString& password, const bool& usesslv3) {
|
||||
server_ = server;
|
||||
username_ = username;
|
||||
password_ = password;
|
||||
usesslv3_ = usesslv3;
|
||||
Login();
|
||||
}
|
||||
|
||||
@ -203,6 +207,9 @@ QNetworkReply* SubsonicService::Send(const QUrl& url) {
|
||||
// certainly be self-signed.
|
||||
QSslConfiguration sslconfig = QSslConfiguration::defaultConfiguration();
|
||||
sslconfig.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
if (usesslv3_) {
|
||||
sslconfig.setProtocol(QSsl::SslV3);
|
||||
}
|
||||
request.setSslConfiguration(sslconfig);
|
||||
QNetworkReply *reply = network_->get(request);
|
||||
return reply;
|
||||
|
@ -68,7 +68,7 @@ class SubsonicService : public InternetService
|
||||
|
||||
void Login();
|
||||
void Login(
|
||||
const QString &server, const QString &username, const QString &password);
|
||||
const QString &server, const QString &username, const QString &password, const bool &usesslv3);
|
||||
LoginState login_state() const { return login_state_; }
|
||||
|
||||
// Subsonic API methods
|
||||
@ -111,6 +111,7 @@ class SubsonicService : public InternetService
|
||||
QString server_;
|
||||
QString username_;
|
||||
QString password_;
|
||||
bool usesslv3_;
|
||||
|
||||
LoginState login_state_;
|
||||
|
||||
|
@ -23,6 +23,7 @@ SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *dialog)
|
||||
ui_->login_state->AddCredentialField(ui_->server);
|
||||
ui_->login_state->AddCredentialField(ui_->username);
|
||||
ui_->login_state->AddCredentialField(ui_->password);
|
||||
ui_->login_state->AddCredentialField(ui_->usesslv3);
|
||||
ui_->login_state->AddCredentialGroup(ui_->server_group);
|
||||
|
||||
ui_->login_state->SetAccountTypeText(tr(
|
||||
@ -43,6 +44,7 @@ void SubsonicSettingsPage::Load()
|
||||
ui_->server->setText(s.value("server").toString());
|
||||
ui_->username->setText(s.value("username").toString());
|
||||
ui_->password->setText(s.value("password").toString());
|
||||
ui_->usesslv3->setChecked(s.value("usesslv3").toBool());
|
||||
|
||||
// If the settings are complete, SubsonicService will have used them already and
|
||||
// we can tell the user if they worked
|
||||
@ -59,6 +61,7 @@ void SubsonicSettingsPage::Save()
|
||||
s.setValue("server", ui_->server->text());
|
||||
s.setValue("username", ui_->username->text());
|
||||
s.setValue("password", ui_->password->text());
|
||||
s.setValue("usesslv3", ui_->usesslv3->isChecked());
|
||||
}
|
||||
|
||||
void SubsonicSettingsPage::LoginStateChanged(SubsonicService::LoginState newstate)
|
||||
@ -128,7 +131,7 @@ void SubsonicSettingsPage::ServerEditingFinished() {
|
||||
void SubsonicSettingsPage::Login()
|
||||
{
|
||||
ui_->login_state->SetLoggedIn(LoginStateWidget::LoginInProgress);
|
||||
service_->Login(ui_->server->text(), ui_->username->text(), ui_->password->text());
|
||||
service_->Login(ui_->server->text(), ui_->username->text(), ui_->password->text(), ui_->usesslv3->isChecked());
|
||||
}
|
||||
|
||||
void SubsonicSettingsPage::Logout()
|
||||
|
@ -57,6 +57,13 @@
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="server"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="usesslv3">
|
||||
<property name="text">
|
||||
<string>Use SSLv3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="login">
|
||||
<property name="text">
|
||||
@ -94,6 +101,7 @@
|
||||
<tabstop>server</tabstop>
|
||||
<tabstop>username</tabstop>
|
||||
<tabstop>password</tabstop>
|
||||
<tabstop>usesslv3</tabstop>
|
||||
<tabstop>login</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user