Changeset 2528cda for protocols/msn
- Timestamp:
- 2010-08-08T15:34:49Z (14 years ago)
- Branches:
- master
- Children:
- 5fecede
- Parents:
- b890626 (diff), ee6cc94 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols/msn
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/Makefile
rb890626 r2528cda 13 13 14 14 # [SH] Program variables 15 objects = msn.o msn_util.o ns.o passport.o sb.o tables.o15 objects = msn.o msn_util.o ns.o passport.o sb.o soap.o tables.o 16 16 17 17 LFLAGS += -r -
protocols/msn/msn.c
rb890626 r2528cda 103 103 g_free( md->grouplist[--md->groupcount] ); 104 104 g_free( md->grouplist ); 105 g_free( md->passport_token ); 106 g_free( md->lock_key ); 105 107 106 108 while( md->grpq ) -
protocols/msn/msn.h
rb890626 r2528cda 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 04Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 42 42 #define QRY_CODE "Q1P7W2E4J9R8U3S5" 43 43 44 /* This should be MSN Messenger 7.0.0813 */ 45 //#define MSNP11_PROD_KEY "CFHUR$52U_{VIX5T" 46 //#define MSNP11_PROD_ID "PROD0101{0RM?UBW" 47 48 #define MSNP11_PROD_KEY "O4BG@C7BWLYQX?5G" 49 #define MSNP11_PROD_ID "PROD01065C%ZFN6F" 50 44 51 #define MSN_SB_NEW -24062002 45 52 … … 69 76 70 77 int trId; 78 char *passport_token; 79 char *lock_key; 71 80 72 81 GSList *msgq, *grpq; … … 175 184 void msn_msgq_purge( struct im_connection *ic, GSList **list ); 176 185 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname ); 186 char *msn_p11_challenge( char *challenge ); 177 187 178 188 /* tables.c */ -
protocols/msn/msn_util.c
rb890626 r2528cda 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 04Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 26 26 #include "nogaim.h" 27 27 #include "msn.h" 28 #include "md5.h" 28 29 #include <ctype.h> 29 30 … … 444 445 return msn_write( ic, buf, strlen( buf ) ) != 0; 445 446 } 447 448 unsigned int little_endian( unsigned int dw ) 449 { 450 #if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN 451 return dw; 452 #else 453 /* We're still not sure if this machine is big endian since the 454 constants above are not that portable. Don't swap bytes, just 455 force-compose a 32-bit little endian integer. */ 456 unsigned int ret = 0, i; 457 char *dst = (char*) (&ret + 1); 458 459 for (i = 0; i < 4; i ++) 460 { 461 *(--dst) = dw >> 24; 462 dw <<= 8; 463 } 464 465 return ret; 466 #endif 467 } 468 469 /* Copied and heavily modified from http://tmsnc.sourceforge.net/chl.c */ 470 char *msn_p11_challenge( char *challenge ) 471 { 472 char *output, buf[256]; 473 md5_state_t md5c; 474 unsigned char md5Hash[16], *newHash; 475 unsigned int *md5Parts, *chlStringParts, newHashParts[5]; 476 long long nHigh = 0, nLow = 0; 477 int i, n; 478 479 /* Create the MD5 hash */ 480 md5_init(&md5c); 481 md5_append(&md5c, (unsigned char*) challenge, strlen(challenge)); 482 md5_append(&md5c, (unsigned char*) MSNP11_PROD_KEY, strlen(MSNP11_PROD_KEY)); 483 md5_finish(&md5c, md5Hash); 484 485 /* Split it into four integers */ 486 md5Parts = (unsigned int *)md5Hash; 487 for (i = 0; i < 4; i ++) 488 { 489 md5Parts[i] = little_endian(md5Parts[i]); 490 491 /* & each integer with 0x7FFFFFFF */ 492 /* and save one unmodified array for later */ 493 newHashParts[i] = md5Parts[i]; 494 md5Parts[i] &= 0x7FFFFFFF; 495 } 496 497 /* make a new string and pad with '0' */ 498 n = g_snprintf(buf, sizeof(buf)-5, "%s%s00000000", challenge, MSNP11_PROD_ID); 499 /* truncate at an 8-byte boundary */ 500 buf[n&=~7] = '\0'; 501 502 /* split into integers */ 503 chlStringParts = (unsigned int *)buf; 504 505 /* this is magic */ 506 for (i = 0; i < (n / 4) - 1; i += 2) 507 { 508 long long temp; 509 510 chlStringParts[i] = little_endian(chlStringParts[i]); 511 chlStringParts[i+1] = little_endian(chlStringParts[i+1]); 512 513 temp = (md5Parts[0] * (((0x0E79A9C1 * (long long)chlStringParts[i]) % 0x7FFFFFFF)+nHigh) + md5Parts[1])%0x7FFFFFFF; 514 nHigh = (md5Parts[2] * (((long long)chlStringParts[i+1]+temp) % 0x7FFFFFFF) + md5Parts[3]) % 0x7FFFFFFF; 515 nLow = nLow + nHigh + temp; 516 } 517 nHigh = (nHigh+md5Parts[1]) % 0x7FFFFFFF; 518 nLow = (nLow+md5Parts[3]) % 0x7FFFFFFF; 519 520 newHashParts[0] ^= nHigh; 521 newHashParts[1] ^= nLow; 522 newHashParts[2] ^= nHigh; 523 newHashParts[3] ^= nLow; 524 525 /* swap more bytes if big endian */ 526 for (i = 0; i < 4; i ++) 527 newHashParts[i] = little_endian(newHashParts[i]); 528 529 /* make a string of the parts */ 530 newHash = (unsigned char *)newHashParts; 531 532 /* convert to hexadecimal */ 533 output = g_new(char, 33); 534 for (i = 0; i < 16; i ++) 535 sprintf(output + i * 2, "%02x", newHash[i]); 536 537 return output; 538 } -
protocols/msn/ns.c
rb890626 r2528cda 783 783 char buf[1024]; 784 784 785 md->passport_token = g_strdup( mad->token ); 786 785 787 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token ); 786 788 msn_write( ic, buf, strlen( buf ) ); -
protocols/msn/sb.c
rb890626 r2528cda 29 29 #include "passport.h" 30 30 #include "md5.h" 31 #include " invitation.h"31 #include "soap.h" 32 32 33 33 static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond ); … … 625 625 const struct msn_status_code *err = msn_status_by_number( num ); 626 626 627 imcb_error( ic, "Error reported by switchboard server: %s", err->text ); 627 /* If the person is offline, send an offline message instead, 628 and don't report an error. */ 629 if( num == 217 ) 630 msn_soap_oim_send_queue( ic, &sb->msgq ); 631 else 632 imcb_error( ic, "Error reported by switchboard server: %s", err->text ); 628 633 629 634 if( err->flags & STATUS_SB_FATAL )
Note: See TracChangeset
for help on using the changeset viewer.