Changes in / [2528cda:b890626]


Ignore:
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • lib/misc.c

    r2528cda rb890626  
    298298void http_encode( char *s )
    299299{
    300         char t[strlen(s)+1];
     300        char *t;
    301301        int i, j;
    302302       
    303         strcpy( t, s );
     303        t = g_strdup( s );
     304       
    304305        for( i = j = 0; t[i]; i ++, j ++ )
    305306        {
     
    319320        }
    320321        s[j] = 0;
     322       
     323        g_free( t );
    321324}
    322325
  • protocols/msn/Makefile

    r2528cda rb890626  
    1313
    1414# [SH] Program variables
    15 objects = msn.o msn_util.o ns.o passport.o sb.o soap.o tables.o
     15objects = msn.o msn_util.o ns.o passport.o sb.o tables.o
    1616
    1717LFLAGS += -r
  • protocols/msn/msn.c

    r2528cda rb890626  
    103103                        g_free( md->grouplist[--md->groupcount] );
    104104                g_free( md->grouplist );
    105                 g_free( md->passport_token );
    106                 g_free( md->lock_key );
    107105               
    108106                while( md->grpq )
  • protocols/msn/msn.h

    r2528cda rb890626  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2010 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2004 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    4242#define QRY_CODE "Q1P7W2E4J9R8U3S5"
    4343
    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 
    5144#define MSN_SB_NEW         -24062002
    5245
     
    7669       
    7770        int trId;
    78         char *passport_token;
    79         char *lock_key;
    8071       
    8172        GSList *msgq, *grpq;
     
    184175void msn_msgq_purge( struct im_connection *ic, GSList **list );
    185176gboolean msn_set_display_name( struct im_connection *ic, const char *rawname );
    186 char *msn_p11_challenge( char *challenge );
    187177
    188178/* tables.c */
  • protocols/msn/msn_util.c

    r2528cda rb890626  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2010 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2004 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    2626#include "nogaim.h"
    2727#include "msn.h"
    28 #include "md5.h"
    2928#include <ctype.h>
    3029
     
    445444        return msn_write( ic, buf, strlen( buf ) ) != 0;
    446445}
    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

    r2528cda rb890626  
    783783                char buf[1024];
    784784               
    785                 md->passport_token = g_strdup( mad->token );
    786                
    787785                g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token );
    788786                msn_write( ic, buf, strlen( buf ) );
  • protocols/msn/sb.c

    r2528cda rb890626  
    2929#include "passport.h"
    3030#include "md5.h"
    31 #include "soap.h"
     31#include "invitation.h"
    3232
    3333static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition cond );
     
    625625                const struct msn_status_code *err = msn_status_by_number( num );
    626626               
    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 );
     627                imcb_error( ic, "Error reported by switchboard server: %s", err->text );
    633628               
    634629                if( err->flags & STATUS_SB_FATAL )
Note: See TracChangeset for help on using the changeset viewer.