aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/msn/ns.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2012-09-16 12:52:35 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2012-09-16 12:52:35 +0100
commitf9258aead615ef9b87baa1754777fd5faf867fe1 (patch)
tree5f6aea374774854cbb0173ce69f82dd29ca52591 /protocols/msn/ns.c
parentbc676acb5f316f0688ab9f99dd2b73315a6ad50c (diff)
Generate a machine UUID instead of using a hardcoded one.
Diffstat (limited to 'protocols/msn/ns.c')
-rw-r--r--protocols/msn/ns.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 4dac75c5..b613b557 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -1,7 +1,7 @@
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
- * Copyright 2002-2010 Wilmer van der Gaast and others *
+ * Copyright 2002-2012 Wilmer van der Gaast and others *
\********************************************************************/
/* MSN module - Notification server callbacks */
@@ -24,9 +24,11 @@
*/
#include <ctype.h>
+#include <sys/utsname.h>
#include "nogaim.h"
#include "msn.h"
#include "md5.h"
+#include "sha1.h"
#include "soap.h"
#include "xmltree.h"
@@ -110,6 +112,23 @@ static gboolean msn_ns_connected( gpointer data, gint source, b_input_condition
handler->rxlen = 0;
handler->rxq = g_new0( char, 1 );
+ if( md->uuid == NULL )
+ {
+ struct utsname name;
+ sha1_state_t sha[1];
+
+ /* UUID == SHA1("BitlBee" + my hostname + MSN username) */
+ sha1_init( sha );
+ sha1_append( sha, (void*) "BitlBee", 7 );
+ if( uname( &name ) == 0 )
+ {
+ sha1_append( sha, (void*) name.nodename, strlen( name.nodename ) );
+ }
+ sha1_append( sha, (void*) ic->acc->user, strlen( ic->acc->user ) );
+ md->uuid = sha1_random_uuid( sha );
+ memcpy( md->uuid, "b171be3e", 8 ); /* :-P */
+ }
+
if( msn_ns_write( ic, source, "VER %d %s CVR0\r\n", ++md->trId, MSNP_VER ) )
{
handler->inpa = b_input_add( handler->fd, B_EV_IO_READ, msn_ns_callback, handler );
@@ -756,7 +775,7 @@ void msn_auth_got_passport_token( struct im_connection *ic, const char *token, c
if( token )
{
- msn_ns_write( ic, -1, "USR %d SSO S %s %s {7535ef7c-ff92-11e1-8069-50e5493b06de}\r\n", ++md->trId, md->tokens[0], token );
+ msn_ns_write( ic, -1, "USR %d SSO S %s %s {%s}\r\n", ++md->trId, md->tokens[0], token, md->uuid );
}
else
{