Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 288769 | Differences between
and this patch

Collapse All | Expand All

(-)kopete/protocols/yahoo.orig/libkyahoo/client.h (-1 / +1 lines)
Lines 27-33 Link Here
27
#include "transfer.h"
27
#include "transfer.h"
28
#include "yahootypes.h"
28
#include "yahootypes.h"
29
29
30
#define YMSG_PROGRAM_VERSION_STRING "7,5,0,33"
30
#define YMSG_PROGRAM_VERSION_STRING "8.1.0.209"
31
31
32
class QString;
32
class QString;
33
class QTimer;
33
class QTimer;
(-)kopete/protocols/yahoo.orig/libkyahoo/client.cpp (-1 / +1 lines)
Lines 258-264 void Client::slotLoginResponse( int resp Link Here
258
			changeStatus( d->statusOnConnect, d->statusMessageOnConnect, Yahoo::StatusTypeAway );
258
			changeStatus( d->statusOnConnect, d->statusMessageOnConnect, Yahoo::StatusTypeAway );
259
		d->statusMessageOnConnect = QString::null;
259
		d->statusMessageOnConnect = QString::null;
260
		setStatus( d->statusOnConnect );
260
		setStatus( d->statusOnConnect );
261
		m_pingTimer->start( 60 * 1000 );
261
		m_pingTimer->start( 60 * 60 * 1000 );
262
		initTasks();
262
		initTasks();
263
	} else {
263
	} else {
264
		d->active = false;
264
		d->active = false;
(-)kopete/protocols/yahoo.orig/libkyahoo/logintask.h (+18 lines)
Lines 27-32 Link Here
27
class QString;
27
class QString;
28
class YMSGTransfer;
28
class YMSGTransfer;
29
29
30
namespace KIO
31
{
32
    class Job;
33
}
34
30
/**
35
/**
31
@author Duncan Mac-Vicar
36
@author Duncan Mac-Vicar
32
*/
37
*/
Lines 58-63 protected: Link Here
58
	void sendAuthResp_pre_0x0b(const QString &sn, const QString &seed);
63
	void sendAuthResp_pre_0x0b(const QString &sn, const QString &seed);
59
	void handleAuthResp(YMSGTransfer *transfer);
64
	void handleAuthResp(YMSGTransfer *transfer);
60
	void parseCookies( YMSGTransfer *transfer );
65
	void parseCookies( YMSGTransfer *transfer );
66
	void sendAuthSixteenStage1(const QString &sn, const QString &seed);
67
	void sendAuthSixteenStage2(const QString &token);
68
	void sendAuthSixteenStage3(const QString &cryptString);
69
protected slots:
70
	void handleAuthSixteenStage1Data(KIO::Job*, const QByteArray &data);
71
	void handleAuthSixteenStage1Result(KIO::Job*);
72
	void handleAuthSixteenStage2Data(KIO::Job*, const QByteArray &data);
73
	void handleAuthSixteenStage2Result(KIO::Job*);
74
61
signals:
75
signals:
62
	void haveSessionID( uint );
76
	void haveSessionID( uint );
63
	void haveCookies();
77
	void haveCookies();
Lines 70-75 private: Link Here
70
	QString m_cCookie;
84
	QString m_cCookie;
71
	QString m_loginCookie;
85
	QString m_loginCookie;
72
	QString m_verificationWord;
86
	QString m_verificationWord;
87
	QString m_stage1Data;
88
	QString m_stage2Data;
89
	QString m_challengeString;
90
	uint m_sessionID;
73
};
91
};
74
92
75
#endif
93
#endif
(-)kopete/protocols/yahoo.orig/libkyahoo/logintask.cpp (-26 / +189 lines)
Lines 26-32 Link Here
26
#include "yahootypes.h"
26
#include "yahootypes.h"
27
#include "client.h"
27
#include "client.h"
28
#include <qstring.h>
28
#include <qstring.h>
29
#include <qurl.h>
29
#include <kdebug.h>
30
#include <kdebug.h>
31
#include <kio/global.h>
32
#include <kio/job.h>
33
#include <kio/jobclasses.h>
34
#include <kurl.h>
35
#include <kmdcodec.h>
30
#include <stdlib.h>
36
#include <stdlib.h>
31
extern "C"
37
extern "C"
32
{
38
{
Lines 67-72 bool LoginTask::take(Transfer* transfer) Link Here
67
73
68
	YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer);
74
	YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer);
69
75
76
	if( t->service() == Yahoo::ServicePing )
77
		return true;
78
70
	switch (mState)
79
	switch (mState)
71
	{
80
	{
72
		case (InitialState):
81
		case (InitialState):
Lines 101-106 bool LoginTask::forMe(Transfer* transfer Link Here
101
	if (!t)
110
	if (!t)
102
		return false;
111
		return false;
103
112
113
	if( t->service() == Yahoo::ServicePing )
114
		return true;
115
104
	switch (mState)
116
	switch (mState)
105
	{
117
	{
106
		case (InitialState):
118
		case (InitialState):
Lines 133-139 void LoginTask::onGo() Link Here
133
	if (mState == InitialState)
145
	if (mState == InitialState)
134
		sendVerify();
146
		sendVerify();
135
	else
147
	else
136
			client()->notifyError( "Error in login procedure.", "take called while not in initial state", Client::Debug );
148
			client()->notifyError( "Error in login procedure.", "onGo called while not in initial state", Client::Debug );
137
}
149
}
138
150
139
void LoginTask::reset()
151
void LoginTask::reset()
Lines 170-222 void LoginTask::sendAuthResp(YMSGTransfe Link Here
170
	
182
	
171
	QString sn = t->firstParam( 1 );
183
	QString sn = t->firstParam( 1 );
172
	QString seed = t->firstParam( 94 );
184
	QString seed = t->firstParam( 94 );
185
	m_challengeString = seed;
173
	QString version_s = t->firstParam( 13 );
186
	QString version_s = t->firstParam( 13 );
174
	uint sessionID = t->id();
187
	m_sessionID = t->id();
175
	int version = version_s.toInt();
188
	int version = version_s.toInt();
176
	
189
	
177
	switch (version)
190
	switch (version)
178
	{
191
	{
179
		case 0:
192
		case 0:
180
		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Version pre 0x0b "<< version_s << endl;	
193
		case 1:
194
		case 2:
195
		    kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Using version 16 authorization" << endl;
196
		    sendAuthSixteenStage1(sn, seed);
181
		break;
197
		break;
182
		default:
198
		default:
183
		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Version 0x0b "<< version_s << endl;
199
		    kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Unknown authentication method used !" << endl << " Attempting current authentication anyways" << endl;
184
		sendAuthResp_0x0b(sn, seed, sessionID);
200
		    sendAuthSixteenStage1(sn, seed);
185
		break;
201
		break;
186
	}	
202
	}	
187
	mState = SentAuthResp;
203
	mState = SentAuthResp;
188
204
189
	emit haveSessionID( sessionID );
205
	emit haveSessionID( m_sessionID );
190
}
206
}
191
207
192
void LoginTask::sendAuthResp_0x0b(const QString &sn, const QString &seed, uint sessionID)
208
void LoginTask::sendAuthResp_0x0b(const QString &sn, const QString &seed, uint sessionID)
193
{
209
{
210
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
211
}
212
213
void LoginTask::sendAuthSixteenStage1(const QString &sn, const QString &seed)
214
{
215
	const QString YahooTokenUrl = "https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=&login=%1&passwd=%2&chal=%3";
194
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with seed " << seed << endl;
216
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with seed " << seed << endl;
195
	char *resp_6 = (char *) malloc(100);
217
	m_stage1Data = QString::null;
196
	char *resp_96 = (char *) malloc(100);
218
	/* construct a URL from the seed and request tokens */
197
	authresp_0x0b(seed.latin1(), sn.latin1(), (client()->password()).latin1(), resp_6, resp_96);
219
	QString urlEncodedPass = client()->password();
198
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "resp_6: " << resp_6 << " resp_69: " << resp_96 << endl;
220
	QUrl::encode(urlEncodedPass);
199
	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAuthResp, m_stateOnConnect);
221
	QString fullUrl = YahooTokenUrl.arg(sn, urlEncodedPass, seed);
200
	t->setId( sessionID );
222
	KURL tokenUrl(fullUrl);
201
	t->setParam( 0 , sn.local8Bit());
223
	KIO::Job* job = KIO::get(tokenUrl, true, false);
202
	t->setParam( 6 , resp_6);
224
	connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)),
203
	t->setParam( 96 , resp_96);
225
	        this, SLOT(handleAuthSixteenStage1Data(KIO::Job*, const QByteArray&)));
204
	t->setParam( 59 , "B\\tfckeert1kk1nl&b=2" );	// ???
226
	connect(job, SIGNAL(result(KIO::Job*)),
205
	t->setParam( 135 , "7,0,0,437" );	// Client version
227
	        this, SLOT(handleAuthSixteenStage1Result(KIO::Job*)));
206
	t->setParam( 148 , -60 );
228
}
207
	t->setParam( 244 , 524223 );
229
208
	t->setParam( 1 , sn.local8Bit());
230
void LoginTask::handleAuthSixteenStage1Data(KIO::Job* job, const QByteArray &data)
231
{
232
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with data " << data << endl;
233
	m_stage1Data.append(data);
234
}
235
236
void LoginTask::handleAuthSixteenStage1Result(KIO::Job* job)
237
{
238
	int responseNumber = -1;
239
	QString token;
240
	int error = job->error();
241
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " error: " << error << endl;
242
	if (error == 0)
243
	{
244
		QStringList responses = QStringList::split("\r\n", m_stage1Data);
245
		responseNumber = responses[0].toInt();
246
		if (responses.count() >= 3)
247
		{
248
			token = responses[1];
249
			token.remove("ymsgr=");
250
			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "response is:" << responseNumber << endl;
251
			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "token is:" << token << endl;
252
		}
209
253
210
	if( !m_verificationWord.isEmpty() )
254
		if (responseNumber != 0)
255
	{
256
			switch(responseNumber)
211
	{
257
	{
212
		t->setParam( 227 , m_verificationWord.local8Bit() );
258
			case -1:
213
		m_verificationWord = QString::null;
259
				/* error in the received stream */
260
				emit loginResponse(Yahoo::LoginSock, QString());
261
				kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "unknown error logging in" << endl;
262
				break;
263
			case 1212:
264
				/* password incorrect */
265
				emit loginResponse(Yahoo::LoginPasswd, QString());
266
				kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "password incorrect" << endl;
267
				break;
268
			case 1213:
269
				/* security lock */
270
				emit loginResponse(Yahoo::LoginLock, QString());
271
				kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "user locked" << endl;
272
				break;
273
			case 1235:
274
				/* username does not exist */
275
				emit loginResponse(Yahoo::LoginUname, QString());
276
				kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "user does not exist" << endl;
277
				break;
278
			case 1214:
279
			case 1236:
280
				emit loginResponse(Yahoo::LoginVerify, QString());
281
				break;
282
			case 100: /* username or password missing */
283
				/*FIXME handle this */
284
				break;
285
			default:
286
				/* FIXME unknown error. handle it! */
287
				break;
288
			}
289
	}
290
		else
291
		{
292
			/* start stage 2 here */
293
			sendAuthSixteenStage2(token);
214
	}
294
	}
295
	}
296
}
215
297
216
	free(resp_6);
298
void LoginTask::sendAuthSixteenStage2(const QString &token)
217
	free(resp_96);
299
{
218
	send(t);
300
	const QString YahooLoginUrl = "https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=&token=%1";
301
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with token " << token << endl;
302
	m_stage2Data = QString::null;
303
	QString fullUrl = YahooLoginUrl.arg(token);
304
	KURL loginUrl(fullUrl);
305
	KIO::Job* job = KIO::get(loginUrl, true, false);
306
	connect(job, SIGNAL(data(KIO::Job*, const QByteArray&)),
307
	        this, SLOT(handleAuthSixteenStage2Data(KIO::Job*, const QByteArray&)));
308
	connect(job, SIGNAL(result(KIO::Job*)),
309
	        this, SLOT(handleAuthSixteenStage2Result(KIO::Job*)));
310
}
219
311
312
void LoginTask::handleAuthSixteenStage2Data(KIO::Job* job, const QByteArray &data)
313
{
314
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with data " << data << endl;
315
	m_stage2Data.append(data);
316
}
317
318
void LoginTask::handleAuthSixteenStage2Result(KIO::Job* job)
319
{
320
	QString crumb;
321
	int responseNumber = -1;
322
	int error = job->error();
323
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "error:" << error << endl;
324
	if (error == 0)
325
	{
326
		QStringList responses = QStringList::split("\r\n", m_stage2Data);
327
		kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << responses << endl;
328
		responseNumber = responses[0].toInt();
329
		if (responseNumber == 0)
330
		{
331
			crumb = responses[1];
332
			crumb.remove("crumb=");
333
			m_yCookie = responses[2].remove(0,2); /* remove Y= */
334
			m_tCookie = responses[3].remove(0,2); /* remove T= */
335
		}
336
337
		if (responseNumber != 0)
338
		{
339
			switch(responseNumber)
340
			{
341
			case -1:
342
				emit loginResponse(Yahoo::LoginSock, QString());
343
				break;
344
			case 100:
345
				emit loginResponse(Yahoo::LoginSock, QString());
346
				break;
347
			default: /* try to login anyways */
348
				break;
349
			}
350
		}
351
		else
352
		{
353
			QString cryptString = crumb;
354
			cryptString.append(m_challengeString);
355
			sendAuthSixteenStage3(cryptString);
356
		}
357
	}
358
}
359
360
void LoginTask::sendAuthSixteenStage3(const QString &cryptString)
361
{
362
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with crypt string " << cryptString << endl;
363
364
	KMD5 md5(cryptString.ascii());
365
	QCString cryptStringHash = md5.base64Digest();
366
	cryptStringHash = cryptStringHash.replace('+', '.');
367
	cryptStringHash = cryptStringHash.replace('/', '_');
368
	cryptStringHash = cryptStringHash.replace('=', '-');
369
370
	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAuthResp, m_stateOnConnect);
371
	t->setId( m_sessionID );
372
   	t->setParam( 1, client()->userId().local8Bit());
373
	t->setParam( 0 , client()->userId().local8Bit());
374
	t->setParam( 277, m_yCookie.local8Bit() );
375
	t->setParam( 278, m_tCookie.local8Bit() );
376
	t->setParam( 307, cryptStringHash );
377
	t->setParam( 244, 2097087 );
378
	t->setParam( 2 , client()->userId().local8Bit());
379
	t->setParam( 2, 1 ); // Both parameter 2s wind up in the packet
380
	t->setParam( 135, YMSG_PROGRAM_VERSION_STRING );
381
382
	send(t);
220
}
383
}
221
384
222
void LoginTask::sendAuthResp_pre_0x0b(const QString &/*sn*/, const QString &/*seed*/)
385
void LoginTask::sendAuthResp_pre_0x0b(const QString &/*sn*/, const QString &/*seed*/)
(-)kopete/protocols/yahoo.orig/libkyahoo/ymsgtransfer.h (+2 lines)
Lines 56-61 public: Link Here
56
	void setStatus(Yahoo::Status status);
56
	void setStatus(Yahoo::Status status);
57
	unsigned int id();
57
	unsigned int id();
58
	void setId(unsigned int id);
58
	void setId(unsigned int id);
59
	int packetLength();
60
	void setPacketLength(int len);
59
61
60
	ParamList paramList();
62
	ParamList paramList();
61
	QCString firstParam( int index );
63
	QCString firstParam( int index );
(-)kopete/protocols/yahoo.orig/libkyahoo/ymsgtransfer.cpp (-2 / +12 lines)
Lines 120-125 ParamList YMSGTransfer::paramList() Link Here
120
	return d->data;
120
	return d->data;
121
}
121
}
122
122
123
int YMSGTransfer::packetLength()
124
{
125
	return d->packetLength;
126
}
127
128
void YMSGTransfer::setPacketLength(int len)
129
{
130
	d->packetLength = len;
131
}
132
123
int YMSGTransfer::paramCount( int index )
133
int YMSGTransfer::paramCount( int index )
124
{
134
{
125
	int cnt = 0;
135
	int cnt = 0;
Lines 213-221 QByteArray YMSGTransfer::serialize() Link Here
213
	
223
	
214
	stream << (Q_INT8)'Y' << (Q_INT8)'M' << (Q_INT8)'S' << (Q_INT8)'G';
224
	stream << (Q_INT8)'Y' << (Q_INT8)'M' << (Q_INT8)'S' << (Q_INT8)'G';
215
	if( d->service == Yahoo::ServicePictureUpload )
225
	if( d->service == Yahoo::ServicePictureUpload )
216
		stream << (Q_INT16)0x0e00;
226
		stream << (Q_INT16)0x0f00;
217
	else
227
	else
218
		stream << (Q_INT16)0x000e;
228
		stream << (Q_INT16)0x000f;
219
	stream << (Q_INT16)0x0000;
229
	stream << (Q_INT16)0x0000;
220
	if( d->service == Yahoo::ServicePictureUpload ||
230
	if( d->service == Yahoo::ServicePictureUpload ||
221
		d->service == Yahoo::ServiceFileTransfer )
231
		d->service == Yahoo::ServiceFileTransfer )
(-)kopete/protocols/yahoo.orig/libkyahoo/statusnotifiertask.cpp (-1 / +2 lines)
Lines 72-78 bool StatusNotifierTask::forMe( Transfer Link Here
72
		t->service() == Yahoo::ServiceIddeAct ||
72
		t->service() == Yahoo::ServiceIddeAct ||
73
		t->service() == Yahoo::ServiceStatus ||
73
		t->service() == Yahoo::ServiceStatus ||
74
		t->service() == Yahoo::ServiceStealthOffline ||
74
		t->service() == Yahoo::ServiceStealthOffline ||
75
		t->service() == Yahoo::ServiceAuthorization
75
		t->service() == Yahoo::ServiceAuthorization ||
76
		t->service() == Yahoo::ServiceBuddyStatus
76
	)
77
	)
77
		return true;
78
		return true;
78
	else
79
	else
(-)kopete/protocols/yahoo.orig/libkyahoo/listtask.cpp (-2 / +19 lines)
Lines 58-64 bool ListTask::forMe( Transfer* transfer Link Here
58
		return false;
58
		return false;
59
59
60
60
61
	if ( t->service() == Yahoo::ServiceList )
61
	if ( t->service() == Yahoo::ServiceList  ||
62
	t->service() == Yahoo::ServiceBuddyList )
62
		return true;
63
		return true;
63
	else
64
	else
64
		return false;
65
		return false;
Lines 67-73 bool ListTask::forMe( Transfer* transfer Link Here
67
void ListTask::parseBuddyList( YMSGTransfer *t )
68
void ListTask::parseBuddyList( YMSGTransfer *t )
68
{
69
{
69
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
70
	kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl;
70
71
/*
71
	QString raw;
72
	QString raw;
72
	m_list.append( t->firstParam( 87 ) );
73
	m_list.append( t->firstParam( 87 ) );
73
74
Lines 89-94 void ListTask::parseBuddyList( YMSGTrans Link Here
89
		}
90
		}
90
	}
91
	}
91
	m_list.truncate( 0 );
92
	m_list.truncate( 0 );
93
*/
94
	ParamList plist = t->paramList();
95
	Param p;
96
	QString group;
97
	for(ParamList::Iterator it = plist.begin(); it != plist.end(); ++it)
98
	{
99
		p = *it;
100
		switch(p.first)
101
		{
102
			case 65:
103
				group = p.second;
104
				break;
105
			case 7:
106
				emit gotBuddy(p.second, QString::null, group);
107
		}
108
	}
92
}
109
}
93
110
94
void ListTask::parseStealthList( YMSGTransfer *t )
111
void ListTask::parseStealthList( YMSGTransfer *t )
(-)kopete/protocols/yahoo.orig/libkyahoo/yahootypes.h (-1 / +3 lines)
Lines 100-106 namespace Yahoo Link Here
100
		ServiceFileTransfer7 = 0xdc,	/* YMSG13 */
100
		ServiceFileTransfer7 = 0xdc,	/* YMSG13 */
101
		ServiceFileTransfer7Info,	/* YMSG13 */
101
		ServiceFileTransfer7Info,	/* YMSG13 */
102
		ServiceFileTransfer7Accept,	/* YMSG13 */
102
		ServiceFileTransfer7Accept,	/* YMSG13 */
103
		ServiceBuddyChangeGroup = 0xe7	/* YMSG13 */
103
		ServiceBuddyChangeGroup = 0xe7,	/* YMSG13 */
104
		ServiceBuddyStatus = 0xf0,	/* YMSG13 */
105
		ServiceBuddyList = 0xf1		/* YMSG13 */
104
	};
106
	};
105
	
107
	
106
	enum Status 
108
	enum Status 
(-)kopete/protocols/yahoo.orig/libkyahoo/ymsgprotocol.cpp (+8 lines)
Lines 237-242 Transfer* YMSGProtocol::parse( const QBy Link Here
237
			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service -  This means ServicePeerToPeer " << servicenum << endl;
237
			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service -  This means ServicePeerToPeer " << servicenum << endl;
238
			service = Yahoo::ServicePeerToPeer;
238
			service = Yahoo::ServicePeerToPeer;
239
		break;
239
		break;
240
		case (Yahoo::ServiceBuddyStatus) :
241
			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service -  This means ServiceBuddyStatus " << servicenum << endl;
242
			service = Yahoo::ServiceBuddyStatus;
243
		break;
244
		case (Yahoo::ServiceBuddyList) :
245
			kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service -  This means ServiceBuddyList " << servicenum << endl;
246
			service = Yahoo::ServiceBuddyList;
247
		break;
240
		/*
248
		/*
241
		ServiceIdle, // 5 (placemarker)
249
		ServiceIdle, // 5 (placemarker)
242
		ServiceMailStat,
250
		ServiceMailStat,

Return to bug 288769