1 |
scarabeus 09/06/26 11:50:25 |
2 |
|
3 |
Added: 4.2.4-yahoo.patch |
4 |
Log: |
5 |
Revision bump. Fixes kopete and yahoo issues. Fixes bug #274751. |
6 |
(Portage version: 2.2_rc33/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 kde-base/kopete/files/4.2.4-yahoo.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/kde-base/kopete/files/4.2.4-yahoo.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/kde-base/kopete/files/4.2.4-yahoo.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: 4.2.4-yahoo.patch |
15 |
=================================================================== |
16 |
Index: branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.h |
17 |
=================================================================== |
18 |
--- branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.h (revision 986795) |
19 |
+++ branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.h (revision 986796) |
20 |
@@ -26,7 +26,13 @@ |
21 |
|
22 |
class QString; |
23 |
class YMSGTransfer; |
24 |
+class KJob; |
25 |
|
26 |
+namespace KIO |
27 |
+{ |
28 |
+ class Job; |
29 |
+} |
30 |
+ |
31 |
/** |
32 |
@author Duncan Mac-Vicar |
33 |
*/ |
34 |
@@ -58,6 +64,15 @@ |
35 |
void sendAuthResp_pre_0x0b(const QString &sn, const QString &seed); |
36 |
void handleAuthResp(YMSGTransfer *transfer); |
37 |
void parseCookies( YMSGTransfer *transfer ); |
38 |
+ void sendAuthSixteenStage1(const QString& sn, const QString& seed); |
39 |
+ void sendAuthSixteenStage2(const QString& token); |
40 |
+ void sendAuthSixteenStage3(const QString& cryptString); |
41 |
+protected Q_SLOTS: |
42 |
+ void handleAuthSixteenStage1Data(KIO::Job*, const QByteArray& data); |
43 |
+ void handleAuthSixteenStage1Result(KJob*); |
44 |
+ void handleAuthSixteenStage2Data(KIO::Job*, const QByteArray& data); |
45 |
+ void handleAuthSixteenStage2Result(KJob*); |
46 |
+ |
47 |
signals: |
48 |
void haveSessionID( uint ); |
49 |
void haveCookies(); |
50 |
@@ -71,6 +86,10 @@ |
51 |
QString m_cCookie; |
52 |
QString m_loginCookie; |
53 |
QString m_verificationWord; |
54 |
+ QString m_stage1Data; |
55 |
+ QString m_stage2Data; |
56 |
+ QString m_challengeString; |
57 |
+ uint m_sessionID; |
58 |
}; |
59 |
|
60 |
#endif |
61 |
Index: branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.cpp |
62 |
=================================================================== |
63 |
--- branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.cpp (revision 986795) |
64 |
+++ branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/libkyahoo/logintask.cpp (revision 986796) |
65 |
@@ -3,10 +3,10 @@ |
66 |
Handles logging into to the Yahoo service |
67 |
|
68 |
Copyright (c) 2004 Duncan Mac-Vicar P. <duncan@×××.org> |
69 |
- |
70 |
Copyright (c) 2005-2006 André Duffeck <duffeck@×××.org> |
71 |
+ Copyright 2009 Matt Rogers <mattr@×××.org> |
72 |
|
73 |
- Kopete (c) 2002-2006 by the Kopete developers <kopete-devel@×××.org> |
74 |
+ Kopete (c) 2002-2009 by the Kopete developers <kopete-devel@×××.org> |
75 |
|
76 |
************************************************************************* |
77 |
* * |
78 |
@@ -28,6 +28,10 @@ |
79 |
#include <qstring.h> |
80 |
#include <kdebug.h> |
81 |
#include <stdlib.h> |
82 |
+ |
83 |
+#include <QCryptographicHash> |
84 |
+#include <KDE/KJob> |
85 |
+#include <KDE/KIO/Job> |
86 |
extern "C" |
87 |
{ |
88 |
#include "libyahoo.h" |
89 |
@@ -177,52 +181,197 @@ |
90 |
|
91 |
QString sn = t->firstParam( 1 ); |
92 |
QString seed = t->firstParam( 94 ); |
93 |
+ m_challengeString = seed; |
94 |
QString version_s = t->firstParam( 13 ); |
95 |
- uint sessionID = t->id(); |
96 |
+ m_sessionID = t->id(); |
97 |
int version = version_s.toInt(); |
98 |
|
99 |
switch (version) |
100 |
{ |
101 |
case 0: |
102 |
- kDebug(YAHOO_RAW_DEBUG) << " Version pre 0x0b "<< version_s; |
103 |
- break; |
104 |
+ case 1: |
105 |
+ case 2: |
106 |
+ kDebug(YAHOO_RAW_DEBUG) << "Using version 16 authorization" << endl; |
107 |
+ sendAuthSixteenStage1(sn, seed); |
108 |
+ break; |
109 |
default: |
110 |
- kDebug(YAHOO_RAW_DEBUG) << " Version 0x0b "<< version_s; |
111 |
- sendAuthResp_0x0b(sn, seed, sessionID); |
112 |
+ kWarning(YAHOO_RAW_DEBUG) << "Unknown authentication method used!" |
113 |
+ << "Attempting current authentication anyways"; |
114 |
+ sendAuthSixteenStage1(sn, seed); |
115 |
break; |
116 |
} |
117 |
mState = SentAuthResp; |
118 |
|
119 |
- emit haveSessionID( sessionID ); |
120 |
+ emit haveSessionID( m_sessionID ); |
121 |
} |
122 |
|
123 |
-void LoginTask::sendAuthResp_0x0b(const QString &sn, const QString &seed, uint sessionID) |
124 |
+void LoginTask::sendAuthSixteenStage1(const QString& sn, const QString& seed) |
125 |
{ |
126 |
- kDebug(YAHOO_RAW_DEBUG) << " with seed " << seed; |
127 |
- char *resp_6 = (char *) malloc(100); |
128 |
- char *resp_96 = (char *) malloc(100); |
129 |
- authresp_0x0b(seed.toLatin1(), sn.toLatin1(), (client()->password()).toLatin1(), resp_6, resp_96); |
130 |
- kDebug(YAHOO_RAW_DEBUG) << "resp_6: " << resp_6 << " resp_69: " << resp_96; |
131 |
+ const QString YahooTokenUrl = "https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=&login=%1&passwd=%2&chal=%3"; |
132 |
+ kDebug(YAHOO_RAW_DEBUG) << "seed:" << seed; |
133 |
+ m_stage1Data.clear(); |
134 |
+ /* construct a URL from the seed and request tokens */ |
135 |
+ QByteArray encodedUrl; |
136 |
+ QString fullUrl = YahooTokenUrl.arg(sn, client()->password(), seed); |
137 |
+ KUrl tokenUrl(fullUrl); |
138 |
+ KIO::Job* job = KIO::get(tokenUrl, KIO::Reload, KIO::HideProgressInfo); |
139 |
+ connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), |
140 |
+ this, SLOT(handleAuthSixteenStage1Data(KIO::Job*, const QByteArray&))); |
141 |
+ connect(job, SIGNAL(result(KJob*)), |
142 |
+ this, SLOT(handleAuthSixteenStage1Result(KJob*))); |
143 |
+} |
144 |
+ |
145 |
+void LoginTask::handleAuthSixteenStage1Data(KIO::Job* job, const QByteArray& data) |
146 |
+{ |
147 |
+ kDebug(YAHOO_RAW_DEBUG) << "data:" << data; |
148 |
+ m_stage1Data.append(data); |
149 |
+} |
150 |
+ |
151 |
+void LoginTask::handleAuthSixteenStage1Result(KJob* job) |
152 |
+{ |
153 |
+ int responseNumber = -1; |
154 |
+ QString token; |
155 |
+ int error = job->error(); |
156 |
+ kDebug(YAHOO_RAW_DEBUG) << "error:" << error; |
157 |
+ if (error == 0) |
158 |
+ { |
159 |
+ QStringList responses = m_stage1Data.split("\r\n"); |
160 |
+ if (responses.count() >= 3) |
161 |
+ { |
162 |
+ responseNumber = responses[0].toInt(); |
163 |
+ token = responses[1]; |
164 |
+ token.remove("ymsgr="); |
165 |
+ kDebug(YAHOO_RAW_DEBUG) << "response is:" << responseNumber; |
166 |
+ kDebug(YAHOO_RAW_DEBUG) << "token is:" << token; |
167 |
+ } |
168 |
+ |
169 |
+ if (responseNumber != 0) |
170 |
+ { |
171 |
+ switch(responseNumber) |
172 |
+ { |
173 |
+ case -1: |
174 |
+ /* error in the received stream */ |
175 |
+ emit loginResponse(Yahoo::LoginSock, QString()); |
176 |
+ kDebug(YAHOO_RAW_DEBUG) << "unknown error logging in"; |
177 |
+ break; |
178 |
+ case 1212: |
179 |
+ /* password incorrect */ |
180 |
+ emit loginResponse(Yahoo::LoginPasswd, QString()); |
181 |
+ kDebug(YAHOO_RAW_DEBUG) << "password incorrect"; |
182 |
+ break; |
183 |
+ case 1213: |
184 |
+ /* security lock */ |
185 |
+ emit loginResponse(Yahoo::LoginLock, QString()); |
186 |
+ break; |
187 |
+ case 1235: |
188 |
+ /* username does not exist */ |
189 |
+ emit loginResponse(Yahoo::LoginUname, QString()); |
190 |
+ kDebug(YAHOO_RAW_DEBUG) << "user does not exist"; |
191 |
+ break; |
192 |
+ case 1214: |
193 |
+ case 1236: |
194 |
+ emit loginResponse(Yahoo::LoginVerify, QString()); |
195 |
+ break; |
196 |
+ case 100: /* username or password missing */ |
197 |
+ /*FIXME handle this */ |
198 |
+ break; |
199 |
+ default: |
200 |
+ /* FIXME unknown error. handle it! */ |
201 |
+ break; |
202 |
+ } |
203 |
+ } |
204 |
+ else |
205 |
+ { |
206 |
+ /* start stage 2 here */ |
207 |
+ sendAuthSixteenStage2(token); |
208 |
+ } |
209 |
+ } |
210 |
+} |
211 |
+ |
212 |
+void LoginTask::sendAuthSixteenStage2(const QString& token) |
213 |
+{ |
214 |
+ const QString YahooLoginUrl = "https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=&token=%1"; |
215 |
+ kDebug(YAHOO_RAW_DEBUG) << "token:" << token; |
216 |
+ m_stage2Data.clear(); |
217 |
+ QString fullUrl = YahooLoginUrl.arg(token); |
218 |
+ KUrl loginUrl(fullUrl); |
219 |
+ KIO::Job* job = KIO::get(loginUrl, KIO::Reload, KIO::HideProgressInfo); |
220 |
+ connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)), |
221 |
+ this, SLOT(handleAuthSixteenStage2Data(KIO::Job*, const QByteArray&))); |
222 |
+ connect(job, SIGNAL(result(KJob*)), |
223 |
+ this, SLOT(handleAuthSixteenStage2Result(KJob*))); |
224 |
+} |
225 |
+ |
226 |
+void LoginTask::handleAuthSixteenStage2Data(KIO::Job*, const QByteArray& data) |
227 |
+{ |
228 |
+ kDebug(YAHOO_RAW_DEBUG) << "data:" << data; |
229 |
+ m_stage2Data.append(data); |
230 |
+} |
231 |
+ |
232 |
+void LoginTask::handleAuthSixteenStage2Result(KJob* job) |
233 |
+{ |
234 |
+ QString crumb; |
235 |
+ int responseNumber = -1; |
236 |
+ int error = job->error(); |
237 |
+ kDebug(YAHOO_RAW_DEBUG) << "error:" << error; |
238 |
+ if (error == 0) |
239 |
+ { |
240 |
+ QStringList responses = m_stage2Data.split("\r\n"); |
241 |
+ kDebug(YAHOO_RAW_DEBUG) << responses; |
242 |
+ responseNumber = responses[0].toInt(); |
243 |
+ if (responseNumber == 0) |
244 |
+ { |
245 |
+ crumb = responses[1]; |
246 |
+ crumb.remove("crumb="); |
247 |
+ m_yCookie = responses[2].remove(0,2); /* remove Y= */ |
248 |
+ m_tCookie = responses[3].remove(0,2); /* remove T= */ |
249 |
+ } |
250 |
+ |
251 |
+ if (responseNumber != 0) |
252 |
+ { |
253 |
+ switch(responseNumber) |
254 |
+ { |
255 |
+ case -1: |
256 |
+ emit loginResponse(Yahoo::LoginSock, QString()); |
257 |
+ break; |
258 |
+ case 100: |
259 |
+ emit loginResponse(Yahoo::LoginSock, QString()); |
260 |
+ break; |
261 |
+ default: /* try to login anyways */ |
262 |
+ break; |
263 |
+ } |
264 |
+ } |
265 |
+ else |
266 |
+ { |
267 |
+ QString cryptString = crumb; |
268 |
+ cryptString.append(m_challengeString); |
269 |
+ sendAuthSixteenStage3(cryptString); |
270 |
+ } |
271 |
+ } |
272 |
+} |
273 |
+ |
274 |
+void LoginTask::sendAuthSixteenStage3(const QString& cryptString) |
275 |
+{ |
276 |
+ kDebug(YAHOO_RAW_DEBUG) << " with crypt string" << cryptString; |
277 |
+ QByteArray cryptStringHash = QCryptographicHash::hash( cryptString.toAscii(), |
278 |
+ QCryptographicHash::Md5 ); |
279 |
+ cryptStringHash = cryptStringHash.toBase64(); |
280 |
+ cryptStringHash = cryptStringHash.replace('+', '.'); |
281 |
+ cryptStringHash = cryptStringHash.replace('/', '_'); |
282 |
+ cryptStringHash = cryptStringHash.replace('=', '-'); |
283 |
+ |
284 |
YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAuthResp, m_stateOnConnect); |
285 |
- t->setId( sessionID ); |
286 |
- t->setParam( 0 , sn.toLocal8Bit()); |
287 |
- t->setParam( 2 , sn.toLocal8Bit()); |
288 |
+ t->setId( m_sessionID ); |
289 |
+ t->setParam( 1, client()->userId().toLocal8Bit()); |
290 |
+ t->setParam( 0 , client()->userId().toLocal8Bit()); |
291 |
+ t->setParam( 277, m_yCookie.toLocal8Bit() ); |
292 |
+ t->setParam( 278, m_tCookie.toLocal8Bit() ); |
293 |
+ t->setParam( 307, cryptStringHash ); |
294 |
+ t->setParam( 244, 2097087 ); |
295 |
+ t->setParam( 2 , client()->userId().toLocal8Bit()); |
296 |
t->setParam( 2, 1 ); // Both parameter 2s wind up in the packet |
297 |
- t->setParam( 6 , resp_6); |
298 |
- t->setParam( 1, sn.toLocal8Bit()); |
299 |
- t->setParam( 244, 2097087 ); |
300 |
t->setParam( 135, YMSG_PROGRAM_VERSION_STRING ); |
301 |
- t->setParam( 148, 480 ); |
302 |
- t->setParam( 59 , "B\\tfckeert1kk1nl&b=2" ); // ??? |
303 |
|
304 |
- if( !m_verificationWord.isEmpty() ) |
305 |
- { |
306 |
- t->setParam( 227 , m_verificationWord.toLocal8Bit() ); |
307 |
- m_verificationWord.clear(); |
308 |
- } |
309 |
- |
310 |
- free(resp_6); |
311 |
- free(resp_96); |
312 |
send(t); |
313 |
|
314 |
} |
315 |
Index: branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/yahooeditaccount.cpp |
316 |
=================================================================== |
317 |
--- branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/yahooeditaccount.cpp (revision 986795) |
318 |
+++ branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/yahooeditaccount.cpp (revision 986796) |
319 |
@@ -63,9 +63,9 @@ |
320 |
mAutoConnect->setChecked(acct->excludeConnect()); |
321 |
mPasswordWidget->load( &acct->password() ); |
322 |
|
323 |
- QString pagerServer = account()->configGroup()->readEntry("Server", "scs.msg.yahoo.com"); |
324 |
+ QString pagerServer = account()->configGroup()->readEntry("Server", "scsa.msg.yahoo.com"); |
325 |
int pagerPort = account()->configGroup()->readEntry("Port", 5050); |
326 |
- if( pagerServer != "scs.msg.yahoo.com" || pagerPort != 5050 ) |
327 |
+ if( pagerServer != "scsa.msg.yahoo.com" || pagerPort != 5050 ) |
328 |
optionOverrideServer->setChecked( true ); |
329 |
else |
330 |
optionOverrideServer->setChecked( false ); |
331 |
@@ -133,7 +133,7 @@ |
332 |
} |
333 |
else |
334 |
{ |
335 |
- yahooAccount->setServer( "scs.msg.yahoo.com" ); |
336 |
+ yahooAccount->setServer( "scsa.msg.yahoo.com" ); |
337 |
yahooAccount->setPort( 5050 ); |
338 |
} |
339 |
|
340 |
Index: branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp |
341 |
=================================================================== |
342 |
--- branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp (revision 986795) |
343 |
+++ branches/KDE/4.2/kdenetwork/kopete/protocols/yahoo/yahooaccount.cpp (revision 986796) |
344 |
@@ -539,7 +539,7 @@ |
345 |
return; |
346 |
} |
347 |
|
348 |
- QString server = configGroup()->readEntry( "Server", "scs.msg.yahoo.com" ); |
349 |
+ QString server = configGroup()->readEntry( "Server", "scsa.msg.yahoo.com" ); |
350 |
int port = configGroup()->readEntry( "Port", 5050 ); |
351 |
|
352 |
initConnectionSignals( MakeConnections ); |
353 |
Index: branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.upd |
354 |
=================================================================== |
355 |
--- branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.upd (revision 0) |
356 |
+++ branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.upd (revision 986796) |
357 |
@@ -0,0 +1,4 @@ |
358 |
+Id=kopete-update-yahoo-server/r1 |
359 |
+File=kopeterc |
360 |
+Options=overwrite |
361 |
+Script=kopete-update_yahoo_server.pl,perl |
362 |
Index: branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.pl |
363 |
=================================================================== |
364 |
--- branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.pl (revision 0) |
365 |
+++ branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.pl (revision 986796) |
366 |
@@ -0,0 +1,20 @@ |
367 |
+#!/usr/bin/perl |
368 |
+ |
369 |
+# Rename the old Gaim style to Pidgin |
370 |
+ |
371 |
+my $inYahoo = 0; |
372 |
+foreach (<>) { |
373 |
+ $inYahoo = 1 if (/^\[Account_YahooProtocol_.*$/); |
374 |
+ if ($inYahoo) { |
375 |
+ if (/^Server\=(.*)/) { |
376 |
+ my $oldServer = $1; |
377 |
+ if ($oldServer =~ m/\.yahoo\.com$/) { |
378 |
+ print "Server=scsa.msg.yahoo.com\n"; |
379 |
+ $inYahoo = 0; |
380 |
+ next; |
381 |
+ } |
382 |
+ } |
383 |
+ } |
384 |
+ |
385 |
+ print $_; |
386 |
+} |
387 |
|
388 |
Property changes on: branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/kopete-update_yahoo_server.pl |
389 |
___________________________________________________________________ |
390 |
Added: svn:executable |
391 |
+ * |
392 |
|
393 |
Index: branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/CMakeLists.txt |
394 |
=================================================================== |
395 |
--- branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/CMakeLists.txt (revision 986795) |
396 |
+++ branches/KDE/4.2/kdenetwork/kopete/kopete/kconf_update/CMakeLists.txt (revision 986796) |
397 |
@@ -4,10 +4,11 @@ |
398 |
endif(NOT WIN32) |
399 |
|
400 |
|
401 |
-install( FILES kopete-pluginloader.upd kopete-nameTracking.upd kopete-initialstatus.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) |
402 |
+install( FILES kopete-pluginloader.upd kopete-nameTracking.upd kopete-initialstatus.upd kopete-update_yahoo_server.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) |
403 |
|
404 |
-install( PROGRAMS kopete-pluginloader.pl |
405 |
- kopete-account-0.10.pl kopete-initialstatus.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) |
406 |
+install( PROGRAMS kopete-pluginloader.pl kopete-update_yahoo_server.pl |
407 |
+ kopete-account-0.10.pl kopete-initialstatus.pl |
408 |
+ DESTINATION ${KCONF_UPDATE_INSTALL_DIR}) |
409 |
|
410 |
|
411 |
#TODO kconf_program ? |