Changeset f138bd2
- Timestamp:
- 2011-07-31T20:27:30Z (13 years ago)
- Branches:
- master
- Children:
- f988ad3
- Parents:
- e1c926f
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/oauth.c
re1c926f rf138bd2 122 122 char *item; 123 123 124 if( !key || !value ) 125 return; 126 124 127 item = g_strdup_printf( "%s=%s", key, value ); 125 128 *params = g_slist_insert_sorted( *params, item, (GCompareFunc) strcmp ); -
protocols/jabber/jabber.c
re1c926f rf138bd2 140 140 if( set_getbool( &acc->set, "oauth" ) ) 141 141 { 142 jd->fd = jd->r_inpa = jd->w_inpa = -1; 143 142 144 /* For the first login with OAuth, we have to authenticate via the browser. 143 145 For subsequent logins, exchange the refresh token for a valid access … … 285 287 xt_free( jd->xt ); 286 288 289 g_free( jd->oauth2_access_token ); 287 290 g_free( jd->away_message ); 288 291 g_free( jd->username ); -
protocols/jabber/sasl.c
re1c926f rf138bd2 234 234 struct im_connection *ic = data; 235 235 struct jabber_data *jd = ic->proto_data; 236 struct xt_node *reply = NULL;236 struct xt_node *reply_pkt = NULL; 237 237 char *nonce = NULL, *realm = NULL, *cnonce = NULL; 238 238 unsigned char cnonce_bin[30]; 239 239 char *digest_uri = NULL; 240 240 char *dec = NULL; 241 char *s = NULL ;241 char *s = NULL, *reply = NULL; 242 242 xt_status ret = XT_ABORT; 243 243 … … 249 249 if( jd->flags & JFLAG_SASL_FB ) 250 250 { 251 /* Facebook proprietary authentication. Not as useful as it seemed, but 252 the code's written now, may as well keep it.. 253 254 Mechanism is described on http://developers.facebook.com/docs/chat/ 255 and in their Python module. It's all mostly useless because the tokens 256 expire after 24h. */ 251 257 GSList *p_in = NULL, *p_out = NULL, *p; 252 258 md5_state_t md5; 253 char time[33], * fmt, *token;259 char time[33], *token; 254 260 const char *secret; 255 261 … … 275 281 276 282 secret = oauth_params_get( &p_in, "secret" ); 277 md5_append( &md5, (unsigned char*) secret, strlen( secret ) ); 283 if( secret ) 284 md5_append( &md5, (unsigned char*) secret, strlen( secret ) ); 278 285 md5_finish_ascii( &md5, time ); 279 286 oauth_params_add( &p_out, "sig", time ); 280 287 281 fmt= oauth_params_string( p_out );288 reply = oauth_params_string( p_out ); 282 289 oauth_params_free( &p_out ); 283 290 oauth_params_free( &p_in ); 284 s = tobase64( fmt );285 g_free( fmt );286 291 } 287 292 else if( !( s = sasl_get_part( dec, "rspauth" ) ) ) … … 346 351 347 352 /* Now build the SASL response string: */ 348 g_free( dec ); 349 dec = g_strdup_printf( "username=\"%s\",realm=\"%s\",nonce=\"%s\",cnonce=\"%s\"," 350 "nc=%08x,qop=auth,digest-uri=\"%s\",response=%s,charset=%s", 351 jd->username, realm, nonce, cnonce, 1, digest_uri, Hh, "utf-8" ); 352 s = tobase64( dec ); 353 reply = g_strdup_printf( "username=\"%s\",realm=\"%s\",nonce=\"%s\",cnonce=\"%s\"," 354 "nc=%08x,qop=auth,digest-uri=\"%s\",response=%s,charset=%s", 355 jd->username, realm, nonce, cnonce, 1, digest_uri, Hh, "utf-8" ); 353 356 } 354 357 else 355 358 { 356 359 /* We found rspauth, but don't really care... */ 357 g_free( s ); 358 s = NULL; 359 } 360 361 reply = xt_new_node( "response", s, NULL ); 362 xt_add_attr( reply, "xmlns", XMLNS_SASL ); 363 364 if( !jabber_write_packet( ic, reply ) ) 360 } 361 362 s = reply ? tobase64( reply ) : NULL; 363 reply_pkt = xt_new_node( "response", s, NULL ); 364 xt_add_attr( reply_pkt, "xmlns", XMLNS_SASL ); 365 366 if( !jabber_write_packet( ic, reply_pkt ) ) 365 367 goto silent_error; 366 368 … … 376 378 g_free( cnonce ); 377 379 g_free( nonce ); 380 g_free( reply ); 378 381 g_free( realm ); 379 382 g_free( dec ); 380 383 g_free( s ); 381 xt_free_node( reply );384 xt_free_node( reply_pkt ); 382 385 383 386 return ret;
Note: See TracChangeset
for help on using the changeset viewer.