Changeset 89d736a for protocols/jabber/jabber.c
- Timestamp:
- 2008-06-22T19:21:06Z (16 years ago)
- Branches:
- master
- Children:
- dfbb056
- Parents:
- fab3d2d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber.c
rfab3d2d r89d736a 33 33 #include "jabber.h" 34 34 #include "md5.h" 35 #include "base64.h"36 35 37 36 GSList *jabber_connections; … … 241 240 } 242 241 242 /* This generates an unfinished md5_state_t variable. Every time we generate 243 an ID, we finish the state by adding a sequence number and take the hash. */ 243 244 static void jabber_generate_id_hash( struct jabber_data *jd ) 244 245 { 245 md5_state_t id_hash; 246 md5_byte_t binbuf[16]; 246 md5_byte_t binbuf[4]; 247 247 char *s; 248 248 249 md5_init( & id_hash);250 md5_append( & id_hash, (unsigned char *) jd->username, strlen( jd->username ) );251 md5_append( & id_hash, (unsigned char *) jd->server, strlen( jd->server ) );249 md5_init( &jd->cached_id_prefix ); 250 md5_append( &jd->cached_id_prefix, (unsigned char *) jd->username, strlen( jd->username ) ); 251 md5_append( &jd->cached_id_prefix, (unsigned char *) jd->server, strlen( jd->server ) ); 252 252 s = set_getstr( &jd->ic->acc->set, "resource" ); 253 md5_append( &id_hash, (unsigned char *) s, strlen( s ) ); 254 random_bytes( binbuf, 16 ); 255 md5_append( &id_hash, binbuf, 16 ); 256 md5_finish( &id_hash, binbuf ); 257 258 s = base64_encode( binbuf, 9 ); 259 jd->cached_id_prefix = g_strdup_printf( "%s%s", JABBER_CACHED_ID, s ); 260 g_free( s ); 253 md5_append( &jd->cached_id_prefix, (unsigned char *) s, strlen( s ) ); 254 random_bytes( binbuf, 4 ); 255 md5_append( &jd->cached_id_prefix, binbuf, 4 ); 261 256 } 262 257 … … 289 284 xt_free( jd->xt ); 290 285 291 g_free( jd->cached_id_prefix );292 286 g_free( jd->away_message ); 293 287 g_free( jd->username );
Note: See TracChangeset
for help on using the changeset viewer.