Bug 115419 - MSN does not connect (error 17)
Summary: MSN does not connect (error 17)
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 115378 115444 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-31 13:14 UTC by kde
Modified: 2005-11-02 02:04 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2005-10-31 13:14:51 UTC
Version:           0.10.93 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc-3.4.4 (x86_64) 
OS:                Linux

Kopete will not connect to MSN, when running kopete in a konsole the connection attempt ends with:

kopete (msn - raw protocol): [virtual void MSNSocket::slotReadyWrite()] Sending command: USR 3 TWN S
kopete (msn): WARNING: [void MSNSocket::slotSocketError(int)] Error: 17 (remote host closed connection)
kopete (msn): [void MSNSocket::slotSocketClosed()] Socket closed.
kopete (msn): [void MSNAccount::slotNotifySocketClosed()]
kopete (msn): [virtual MSNNotifySocket::~MSNNotifySocket()]

I haven't included more of the output as I am unsure which parts are 'sensitive'. I will provide more of the output if needed.
Comment 1 Olivier Goffart 2005-10-31 13:38:49 UTC
Can you try this pacth, and paste the debug again ?

http://lists.kde.org/?l=kopete-devel&m=113041520008522&w=2
Comment 2 kde 2005-10-31 14:23:34 UTC
With the patch I get the following output:

kopete (msn): [void MSNSecureLoginHandler::slotTweenerReceived(KIO::Job*)] 
HTTP headers: HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 1152
Content-Type: text/html; charset=iso-8859-1
Expires: Mon, 31 Oct 2005 13:19:59 GMT
Server: Microsoft-IIS/6.0
PPServer: PPV: 30 H: BAYPPLOG3B03 V: 0
P3P: CP="DSP CUR OTPi IND OTRi ONL FIN"
Set-Cookie: MSPRequ=lt=1130764859&co=1&id=10
Set-Cookie: MSPBack=1130764858; domain=.passport.com;path=/;version=1
Date: Mon, 31 Oct 2005 13:20:58 GMT
Connection: close
kopete (msn): [void MSNSecureLoginHandler::slotTweenerReceived(KIO::Job*)] 
Received ticket:
kopete (msn - raw protocol): [virtual void MSNSocket::slotReadyWrite()] 
Sending command: USR 3 TWN S
kopete (msn): WARNING: [void MSNSocket::slotSocketError(int)] Error: 17 
(remote host closed connection)
Comment 3 Mark 2005-10-31 15:05:42 UTC
I can confirm this. I didn't apply the debug patch, but I also can't connect to MSN and my regular debug output is the same.
Comment 4 Duncan Mac-Vicar Prett 2005-10-31 15:15:21 UTC
Confirmed here also. Seems to be related to kdelibs revision and not Kopete.
Comment 5 Thomas Beinicke 2005-10-31 18:20:49 UTC
Yes, I am sure it is related to kdelibs or maybe the http kioslave?
At least it wasn't code changed in kopete that broke it.
Comment 6 Thiago Macieira 2005-10-31 23:36:07 UTC
Duncan confirmed it.
Comment 7 Thiago Macieira 2005-10-31 23:36:15 UTC
*** Bug 115378 has been marked as a duplicate of this bug. ***
Comment 8 Thiago Macieira 2005-10-31 23:36:21 UTC
*** Bug 115444 has been marked as a duplicate of this bug. ***
Comment 9 Thiago Macieira 2005-11-01 01:52:10 UTC
It's SVN commit 474301 that broke MSN. Excerpt:

=================
SVN commit 474301 by adawit:

Sanitize custom HTTP headers for safety sake.

 M  +38 -12    http.cc  
--- branches/KDE/3.5/kdelibs/kioslave/http/http.cc #474300:474301
@@ -158,7 +158,33 @@
   return true;
 }
 
+/*
+  Eliminates any custom header that could potentically alter the request
+*/
+static QString sanitizeCustomHTTPHeader(const QString& _header)
+{
+  QString sanitizedHeaders;
+  QStringList headers = QStringList::split("\r\n", _header);
 
+  for(QStringList::Iterator it = headers.begin(); it != headers.end(); ++it)
+  {
+    QString header = (*it).lower();
+    // Do not allow Request line to be specified and ignore
+    // the other HTTP headers.
+    if (header.find(':') == -1 || header.startsWith("host") ||
+        header.startsWith("authorization") ||
+        header.startsWith("proxy-authorization") ||
+        header.startsWith("via"))
+      continue;
=================

This broke the MSN support because it has to support the non-standard Passport authentication. From kopete/protocols/msn/msnsecureloginhandler.cpp:

QString authRequest = "Authorization: Passport1.4 "
                      "OrgVerb=GET,"
                      "OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,"
                      "sign-in=" + KURL::encode_string(m_accountId) +
                      ",pwd=" + KURL::encode_string( m_password ) +
                      "," + m_authentification + "\r\n";

Dawit, how can we restore the old behaviour?
Comment 10 Dawit Alemayehu 2005-11-01 02:36:18 UTC
SVN commit 476277 by adawit:

- Unfortunately the authorization sanity check seems to 
  prevent Kopete from connecting to MSN.

CCBUG:115419


 M  +0 -1      http.cc  


--- branches/KDE/3.5/kdelibs/kioslave/http/http.cc #476276:476277
@@ -172,7 +172,6 @@
     // Do not allow Request line to be specified and ignore
     // the other HTTP headers.
     if (header.find(':') == -1 || header.startsWith("host") ||
-        header.startsWith("authorization") ||
         header.startsWith("proxy-authorization") ||
         header.startsWith("via"))
       continue;
Comment 11 Thiago Macieira 2005-11-01 03:35:53 UTC
That fixes the bug. Are you thinking of a better solution? Or can we close the bug?
Comment 12 Dawit Alemayehu 2005-11-01 04:32:23 UTC
On Monday 31 October 2005 21:35, Thiago Macieira wrote:
> That fixes the bug. Are you thinking of a better solution? Or can we close
> the bug?


It can be closed. I just did not want to do it without actually testing it. 
Now that you did, I will close it. Thanks.
Comment 13 kde 2005-11-02 00:40:07 UTC
Confirmed fixed with latest kdelibs from subversion 3.5 branch.

Thanks!
Comment 14 Thomas Beinicke 2005-11-02 02:04:32 UTC
Yep, fixed. Cheers.
And I was right about the kioslave and no one believed me at first :P