summaryrefslogtreecommitdiffstats
path: root/kioslaves
diff options
context:
space:
mode:
Diffstat (limited to 'kioslaves')
-rw-r--r--kioslaves/imap4/imap4.cc21
-rw-r--r--kioslaves/sieve/sieve.cpp58
-rw-r--r--kioslaves/sieve/sieve.h1
-rw-r--r--kioslaves/sieve/sieve.protocol3
4 files changed, 70 insertions, 13 deletions
diff --git a/kioslaves/imap4/imap4.cc b/kioslaves/imap4/imap4.cc
index 1cfd56027..2290c6787 100644
--- a/kioslaves/imap4/imap4.cc
+++ b/kioslaves/imap4/imap4.cc
@@ -1780,14 +1780,15 @@ IMAP4Protocol::rename (const KURL & src, const KURL & dest, bool overwrite)
completeQueue.removeRef(cmd);
if (!ok)
{
- error(ERR_CANNOT_RENAME, i18n("Unable to close mailbox."));
+ kdWarning(7116) << "Unable to close mailbox!" << endl;
+ error(ERR_CANNOT_RENAME, src.path());
return;
}
setState(ISTATE_LOGIN);
}
imapCommand *cmd = doCommand (imapCommand::clientRename (sBox, dBox));
if (cmd->result () != "OK") {
- error (ERR_CANNOT_RENAME, cmd->result ());
+ error (ERR_CANNOT_RENAME, src.path());
completeQueue.removeRef (cmd);
return;
}
@@ -1798,13 +1799,13 @@ IMAP4Protocol::rename (const KURL & src, const KURL & dest, bool overwrite)
case ITYPE_MSG:
case ITYPE_ATTACH:
case ITYPE_UNKNOWN:
- error (ERR_CANNOT_RENAME, src.prettyURL());
+ error (ERR_CANNOT_RENAME, src.path());
break;
}
}
else
{
- error (ERR_CANNOT_RENAME, src.prettyURL());
+ error (ERR_CANNOT_RENAME, src.path());
return;
}
finished ();
@@ -2111,6 +2112,18 @@ bool IMAP4Protocol::makeLogin ()
removeCapability( "ANNOTATEMORE" );
}
+ // starting from Cyrus IMAP 2.3.9, shared seen flags are available
+ TQRegExp regExp( "Cyrus\\sIMAP[4]{0,1}\\sv(\\d+)\\.(\\d+)\\.(\\d+)", false );
+ if ( regExp.search( greeting ) >= 0 ) {
+ const int major = regExp.cap( 1 ).toInt();
+ const int minor = regExp.cap( 2 ).toInt();
+ const int patch = regExp.cap( 3 ).toInt();
+ if ( major > 2 || (major == 2 && (minor > 3 || (minor == 3 && patch > 9))) ) {
+ kdDebug(7116) << k_funcinfo << "Cyrus IMAP >= 2.3.9 detected, enabling shared seen flag support" << endl;
+ imapCapabilities.append( "x-kmail-sharedseen" );
+ }
+ }
+
kdDebug(7116) << "IMAP4::makeLogin - attempting login" << endl;
KIO::AuthInfo authInfo;
diff --git a/kioslaves/sieve/sieve.cpp b/kioslaves/sieve/sieve.cpp
index 9f3b547a2..bc7811662 100644
--- a/kioslaves/sieve/sieve.cpp
+++ b/kioslaves/sieve/sieve.cpp
@@ -39,6 +39,7 @@ extern "C" {
#include <kurl.h>
#include <kmdcodec.h>
#include <kglobal.h>
+#include <kmessagebox.h>
#include <tqcstring.h>
#include <tqregexp.h>
@@ -46,6 +47,7 @@ extern "C" {
#include <cstdlib>
using std::exit;
#include <sys/stat.h>
+#include <cassert>
#include <kdepimmacros.h>
@@ -193,6 +195,7 @@ kio_sieveProtocol::kio_sieveProtocol(const TQCString &pool_socket, const TQCStri
, m_connMode(NORMAL)
, m_supportsTLS(false)
, m_shouldBeConnected(false)
+ , m_allowUnencrypted(false)
{
}
@@ -274,7 +277,7 @@ bool kio_sieveProtocol::parseCapabilities(bool requestCapabilities/* = false*/)
setMetaData("tlsSupported", "true");
} else {
- ksDebug() << "Unrecognised key " << r.getKey() << endl;
+ ksDebug() << "Unrecognised key." << endl;
}
}
@@ -288,7 +291,7 @@ bool kio_sieveProtocol::parseCapabilities(bool requestCapabilities/* = false*/)
/* ---------------------------------------------------------------------------------- */
/**
- * Checks if connection parameters (currently - auth method) have changed.
+ * Checks if connection parameters have changed.
* If it it, close the current connection
*/
void kio_sieveProtocol::changeCheck( const KURL &url )
@@ -316,6 +319,14 @@ void kio_sieveProtocol::changeCheck( const KURL &url )
if ( isConnectionValid() )
disconnect();
}
+
+ // For TLS, only disconnect if we are unencrypted and are
+ // no longer allowed (otherwise, it's still fine):
+ const bool allowUnencryptedNow = url.queryItem("x-allow-unencrypted") == "true" ;
+ if ( m_allowUnencrypted && !allowUnencryptedNow )
+ if ( isConnectionValid() )
+ disconnect();
+ m_allowUnencrypted = allowUnencryptedNow;
}
/* ---------------------------------------------------------------------------------- */
@@ -349,8 +360,25 @@ bool kio_sieveProtocol::connect(bool useTLSIfAvailable)
}
// Attempt to start TLS
+ if ( !m_allowUnencrypted && !canUseTLS() ) {
+ error( ERR_SLAVE_DEFINED, i18n("Can not use TLS. Please enable TLS in the KDE cryptography setting.") );
+ disconnect();
+ return false;
+ }
+
+ if ( !m_allowUnencrypted && useTLSIfAvailable && canUseTLS() && !m_supportsTLS &&
+ messageBox( WarningContinueCancel,
+ i18n("TLS encryption was requested, but your Sieve server does not advertise TLS in its capabilities.\n"
+ "You can choose to try to initiate TLS negotiations nonetheless, or cancel the operation."),
+ i18n("Server Does Not Advertise TLS"), i18n("&Start TLS nonetheless"), i18n("&Cancel") ) != KMessageBox::Continue )
+ {
+ error( ERR_USER_CANCELED, i18n("TLS encryption requested, but not supported by server.") );
+ disconnect();
+ return false;
+ }
+
// FIXME find a test server and test that this works
- if (useTLSIfAvailable && m_supportsTLS && canUseTLS()) {
+ if (useTLSIfAvailable && canUseTLS()) {
sendData("STARTTLS");
if (operationSuccessful()) {
ksDebug() << "TLS has been accepted. Starting TLS..." << endl
@@ -362,15 +390,31 @@ bool kio_sieveProtocol::connect(bool useTLSIfAvailable)
parseCapabilities( requestCapabilitiesAfterStartTLS() );
} else {
ksDebug() << "TLS initiation failed, code " << retval << endl;
- disconnect(true);
- return connect(false);
- // error(ERR_INTERNAL, i18n("TLS initiation failed."));
+ if ( m_allowUnencrypted ) {
+ disconnect(true);
+ return connect(false);
+ }
+ if ( retval != -3 )
+ messageBox( Information,
+ i18n("Your Sieve server claims to support TLS, "
+ "but negotiation was unsuccessful."),
+ i18n("Connection Failed") );
+ disconnect(true);
+ return false;
}
+ } else if ( !m_allowUnencrypted ) {
+ ksDebug() << "Server incapable of TLS." << endl;
+ disconnect();
+ error( ERR_SLAVE_DEFINED, i18n("The server does not seem to support TLS. "
+ "Disable TLS if you want to connect without encryption.") );
+ return false;
} else
ksDebug() << "Server incapable of TLS. Transmitted documents will be unencrypted." << endl;
} else
ksDebug() << "We are incapable of TLS. Transmitted documents will be unencrypted." << endl;
+ assert( m_allowUnencrypted || usingTLS() );
+
infoMessage(i18n("Authenticating user..."));
if (!authenticate()) {
disconnect();
@@ -637,7 +681,7 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
i18n("The script did not upload successfully.\n"
"This is probably due to errors in the script.\n"
"The server responded:\n%1").arg(r.getKey()));
- } else
+ } else
error(ERR_INTERNAL_SERVER,
i18n("The script did not upload successfully.\n"
"The script may contain errors."));
diff --git a/kioslaves/sieve/sieve.h b/kioslaves/sieve/sieve.h
index f8749f013..0fc3bbd68 100644
--- a/kioslaves/sieve/sieve.h
+++ b/kioslaves/sieve/sieve.h
@@ -122,6 +122,7 @@ protected:
QString m_sPass;
QString m_sAuth;
bool m_shouldBeConnected;
+ bool m_allowUnencrypted;
private:
bool requestCapabilitiesAfterStartTLS() const;
diff --git a/kioslaves/sieve/sieve.protocol b/kioslaves/sieve/sieve.protocol
index 3bd00e25e..484d48da0 100644
--- a/kioslaves/sieve/sieve.protocol
+++ b/kioslaves/sieve/sieve.protocol
@@ -23,14 +23,13 @@ Description[et]=Sieve e-kirjade filtreerimise protokolli IO-moodul
Description[eu]=Sieve posta iragazketa protokoloarentztko irteerako/sarrerako mendeko bat
Description[fa]=یک ioslave برای قرارداد پالایش نامۀ Sieve
Description[fi]=Siirräntätyöskentelijä Sieve-sähköpostiensuodatusyhteyskäytännölle
-Description[fr]=Un module d'entrées / sorties pour le protocole de filtrage de messagerie Sieve
+Description[fr]=Un ioslave pour le protocole de filtrage de messagerie Sieve
Description[fy]=In ioslave foar it Sieve-mailfilterprotokol
Description[gl]=Un esclavo io para o protocolo de filtraxe de correo Sieve
Description[hu]=KDE-protokoll a Sieve levélszűrő protokollhoz
Description[is]=Ioslave fyrir Sieve tölvupóstsíu samskiptaregluna
Description[it]=Un ioslave per il protocollo di filtraggio posta Sieve
Description[ja]=Sieve メールフィルタプロトコル用 ioslave
-Description[ka]=Sieve ფოსტის ფილტრის შეტანა-გამოტანის განაწესი
Description[kk]=Sieve поштаны сүзгілеу протоколының ioslave модулі
Description[km]=ioslave សម្រាប់​ពិធីការ​ត្រង​សំបុត្រ Sieve
Description[ms]=Hamba io untuk protokol tapisan mel saringan