Commit 42363261 authored by Christian Mollekopf's avatar Christian Mollekopf
Browse files

IMAP-Resource: Allow to override the encryption mode.

Some ssl servers advertise an ssl version they don't actually support.
This config-only option allows to override the used encryption mode, and
supports all available options, so the auto-negotiation can be skipped.

BUG: 328625
parent 94424520
......@@ -20,6 +20,9 @@
<label>Defines the encryption type to use</label>
<default>SSL</default>
</entry>
<entry name="OverrideEncryption" type="String">
<label>Override configured encryption mode</label>
</entry>
<entry name="Authentication" type="Int">
<label>Defines the authentication type to use</label>
<default>1</default>
......
......@@ -271,11 +271,35 @@ void Settings::loadAccount( ImapAccount *account ) const
if ( encryption == QLatin1String("SSL") ) {
account->setEncryptionMode( KIMAP::LoginJob::AnySslVersion );
} else if ( encryption == QLatin1String("STARTTLS") ) {
//KIMAP confused TLS and STARTTLS, TlsV1 really means "use STARTTLS"
account->setEncryptionMode( KIMAP::LoginJob::TlsV1 );
} else {
account->setEncryptionMode( KIMAP::LoginJob::Unencrypted );
}
//Some SSL Server fail to advertise an ssl version they support (AnySslVersion),
//we therefore allow overriding this in the config
//(so we don't have to make the UI unnecessarily complex for properly working servers).
const QString overrideEncryptionMode = overrideEncryption();
if (!overrideEncryptionMode.isEmpty()) {
kWarning() << "Overriding encryption mode with: " << overrideEncryptionMode;
if ( overrideEncryptionMode == QLatin1String("SSLV2") ) {
account->setEncryptionMode( KIMAP::LoginJob::SslV2 );
} else if ( overrideEncryptionMode == QLatin1String("SSLV3") ) {
account->setEncryptionMode( KIMAP::LoginJob::SslV3 );
} else if ( overrideEncryptionMode == QLatin1String("TLSV1") ) {
account->setEncryptionMode( KIMAP::LoginJob::SslV3_1 );
} else if ( overrideEncryptionMode == QLatin1String("SSL") ) {
account->setEncryptionMode( KIMAP::LoginJob::AnySslVersion );
} else if ( overrideEncryptionMode == QLatin1String("STARTTLS") ) {
account->setEncryptionMode( KIMAP::LoginJob::TlsV1 );
} else if ( overrideEncryptionMode == QLatin1String("UNENCRYPTED") ) {
account->setEncryptionMode( KIMAP::LoginJob::Unencrypted );
} else {
kWarning() << "Tried to force invalid encryption mode: " << overrideEncryptionMode;
}
}
account->setAuthenticationMode(
mapTransportAuthToKimap(
(MailTransport::TransportBase::EnumAuthenticationType::type) authentication()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment