[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim
From:       Volker Krause <vkrause () kde ! org>
Date:       2008-03-06 18:00:46
Message-ID: 1204826446.572283.596.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 782973 by vkrause:

Merged revisions 782647-782963,782965-782968 via svnmerge from 
https://vkrause@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim

........
  r782647 | vkrause | 2008-03-05 17:02:02 +0100 (Wed, 05 Mar 2008) | 3 lines
  
  Fix literal size parsing for standard conform servers as well as older
  Cyrus servers.
........
  r782672 | vkrause | 2008-03-05 18:44:38 +0100 (Wed, 05 Mar 2008) | 6 lines
  
  Be compatible with servers that automatically send their capabilities
  after STARTTLS (as the standard mandates) as well as those that need an
  extra request to do so (such as older Cyrus versions).
  
  Kolab issue 2443 
........
  r782968 | vkrause | 2008-03-06 18:46:40 +0100 (Thu, 06 Mar 2008) | 2 lines
  
  Merge error handling fixes/improvements from 3.5 branch.
........


 _M            . (directory)  
 M  +27 -4     kioslaves/sieve/sieve.cpp  
 M  +5 -0      kioslaves/sieve/sieve.h  


** branches/KDE/3.5/kdepim #property svnmerge-integrated
   - /branches/kdepim/enterprise/kdepim:1-767022,767033,767233-767554,767556,767558-76 \
7946,767948-769318,769320-769354,769356-771105,771107-771251,771253-772311,772313-7723 \
16,772318-775194,775196-775202,775204,775207-775211,775213-778001,778003-778004,778007 \
,778010-778011,778013-778029,778031-778727,778729-779448,779450-779482,779484-779505,779507-779852,779854-779994
  + /branches/kdepim/enterprise/kdepim:1-767022,767033,767233-767554,767556,767558-767 \
946,767948-769318,769320-769354,769356-771105,771107-771251,771253-772311,772313-77231 \
6,772318-775194,775196-775202,775204,775207-775211,775213-778001,778003-778004,778007, \
778010-778011,778013-778029,778031-778727,778729-779448,779450-779482,779484-779505,779507-779852,779854-779994,782647-782963,782965-782968
                
--- branches/KDE/3.5/kdepim/kioslaves/sieve/sieve.cpp #782972:782973
@@ -17,7 +17,7 @@
 /**
  * Portions adapted from the SMTP ioslave.
  * Copyright (c) 2000, 2001 Alex Zepeda <jazepeda@pacbell.net>
- * Copyright (c) 2001 Michael Häckel <Michael@Haeckel.Net>
+ * Copyright (c) 2001 Michael Häckel <Michael@Haeckel.Net>
  * All rights reserved.
  *
  * Policy: the function where the error occurs calls error(). A result of
@@ -41,6 +41,7 @@
 #include <kglobal.h>
 
 #include <qcstring.h>
+#include <qregexp.h>
 
 #include <cstdlib>
 using std::exit;
@@ -252,6 +253,7 @@
 				ksDebug() << "Connected to Sieve server: " << r.getVal() << endl;
 				ret = true;
 				setMetaData("implementation", r.getVal());
+				m_implementation = r.getVal();
 			}
 
 		} else if (r.getKey() == "SASL") {
@@ -357,7 +359,7 @@
 			if (retval == 1) {
 				ksDebug() << "TLS enabled successfully." << endl;
 				// reparse capabilities:
-				parseCapabilities(false);
+				parseCapabilities( requestCapabilitiesAfterStartTLS() );
 			} else {
 				ksDebug() << "TLS initiation failed, code " << retval << endl;
 				disconnect(true);
@@ -393,7 +395,7 @@
 	if (!forcibly) {
 		sendData("LOGOUT");
 
-		// This crashes under certain conditions as described in 
+		// This crashes under certain conditions as described in
 		// http://intevation.de/roundup/kolab/issue2442
 		// Fixing KIO::TCPSlaveBase::atEnd() for !fd would also work but 3.x is on life \
support.  //if (!operationSuccessful())
@@ -1191,7 +1193,10 @@
 		  {
 			// expecting {quantity}
 			start = 0;
-			end = interpret.find('}', start + 1)-1;
+			end = interpret.find("+}", start + 1);
+			// some older versions of Cyrus enclose the literal size just in { } instead of { \
+} +			if ( end == -1 )
+				end = interpret.find('}', start + 1);
 
 			bool ok = false;
 			r.setQuantity(interpret.mid(start + 1, end - start - 1).toUInt( &ok ));
@@ -1273,3 +1278,21 @@
 
 	return OTHER;
 }
+
+bool kio_sieveProtocol::requestCapabilitiesAfterStartTLS() const
+{
+  // Cyrus didn't send CAPABILITIES after STARTTLS until 2.3.11, which is
+  // not standard conform, but we need to support that anyway.
+  // m_implementation looks like this 'Cyrus timsieved v2.2.12' for Cyrus btw.
+  QRegExp regExp( "Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)", false );
+  if ( regExp.search( m_implementation ) >= 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 || (major == 3 && patch < 11))) ) {
+      ksDebug() << k_funcinfo << "Enabling compat mode for Cyrus < 2.3.11" << endl;
+      return true;
+    }
+  }
+  return false;
+}
--- branches/KDE/3.5/kdepim/kioslaves/sieve/sieve.h #782972:782973
@@ -122,6 +122,11 @@
 	QString				m_sPass;
 	QString				m_sAuth;
 	bool				m_shouldBeConnected;
+
+private:
+	bool requestCapabilitiesAfterStartTLS() const;
+
+	QString m_implementation;
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic