- Timestamp:
- 2010-09-04T17:13:55Z (14 years ago)
- Branches:
- master
- Children:
- 4e1be76
- Parents:
- 4aa8a04
- Location:
- protocols/msn
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r4aa8a04 r27053b5 64 64 md->away_state = msn_away_state_list; 65 65 md->domaintree = g_tree_new( msn_domaintree_cmp ); 66 md->ns->fd = md->auth->fd =-1;66 md->ns->fd = -1; 67 67 68 68 msn_connections = g_slist_prepend( msn_connections, ic ); … … 87 87 88 88 msn_ns_close( md->ns ); 89 msn_ns_close( md->auth );90 89 91 90 while( md->switchboards ) … … 97 96 g_free( md->tokens[i] ); 98 97 g_free( md->lock_key ); 98 g_free( md->pp_policy ); 99 99 100 100 while( md->groups ) … … 181 181 struct msn_data *md = ic->proto_data; 182 182 183 strcpy( md->tokens[1], md->tokens[2] );184 185 183 if( state == NULL ) 186 184 md->away_state = msn_away_state_list; … … 284 282 static void msn_rem_permit( struct im_connection *ic, char *who ) 285 283 { 286 //msn_buddy_list_remove( ic, MSN_BUDDY_AL, who, NULL );284 msn_buddy_list_remove( ic, MSN_BUDDY_AL, who, NULL ); 287 285 } 288 286 … … 302 300 static void msn_rem_deny( struct im_connection *ic, char *who ) 303 301 { 304 //msn_buddy_list_remove( ic, MSN_BUDDY_BL, who, NULL );302 msn_buddy_list_remove( ic, MSN_BUDDY_BL, who, NULL ); 305 303 } 306 304 -
protocols/msn/msn.h
r4aa8a04 r27053b5 81 81 MSN_GOT_PROFILE_DN = 2, 82 82 MSN_DONE_ADL = 4, 83 MSN_REAUTHING = 8, 83 84 } msn_flags_t; 84 85 … … 103 104 struct im_connection *ic; 104 105 105 struct msn_handler_data ns[1] , auth[1];106 struct msn_handler_data ns[1]; 106 107 msn_flags_t flags; 107 108 -
protocols/msn/ns.c
r4aa8a04 r27053b5 275 275 md->pp_policy = g_strdup( cmd[4] ); 276 276 msn_soap_passport_sso_request( ic, cmd[5] ); 277 if( handler == md->auth )278 {279 msn_ns_close( md->auth );280 return 0;281 }282 277 } 283 278 else if( strcmp( cmd[2], "OK" ) == 0 ) -
protocols/msn/soap.c
r4aa8a04 r27053b5 48 48 MSN_SOAP_OK, 49 49 MSN_SOAP_RETRY, 50 MSN_SOAP_REAUTH, 50 51 MSN_SOAP_ABORT, 51 52 } msn_soap_result_t; … … 134 135 } 135 136 137 msn_soap_debug_print( http_req->reply_headers, http_req->reply_body ); 138 136 139 if( http_req->body_size > 0 ) 137 140 { … … 143 146 if( http_req->status_code == 500 && 144 147 ( err = xt_find_path( parser->root, "soap:Body/soap:Fault/detail/errorcode" ) ) && 145 err->text_len > 0 && strcmp( err->text, "PassportAuthFail" ) == 0)148 err->text_len > 0 ) 146 149 { 147 struct msn_data *md = soap_req->ic->proto_data; 148 149 xt_free( parser ); 150 if( md->auth->fd == -1 ) 151 msn_ns_connect( soap_req->ic, md->auth, MSN_NS_HOST, MSN_NS_PORT ); 152 md->soapq = g_slist_prepend( md->soapq, soap_req ); 153 154 return; 150 if( strcmp( err->text, "PassportAuthFail" ) == 0 ) 151 { 152 xt_free( parser ); 153 st = MSN_SOAP_REAUTH; 154 goto fail; 155 } 156 /* TODO: Handle/report other errors. */ 155 157 } 156 158 … … 159 161 } 160 162 161 msn_soap_debug_print( http_req->reply_headers, http_req->reply_body );162 163 163 st = soap_req->handle_response( soap_req ); 164 164 165 fail: 165 166 g_free( soap_req->url ); 166 167 g_free( soap_req->action ); … … 169 170 170 171 if( st == MSN_SOAP_RETRY && --soap_req->ttl ) 172 { 171 173 msn_soap_send_request( soap_req ); 174 } 175 else if( st == MSN_SOAP_REAUTH ) 176 { 177 struct msn_data *md = soap_req->ic->proto_data; 178 179 if( !( md->flags & MSN_REAUTHING ) ) 180 { 181 /* Nonce shouldn't actually be touched for re-auths. */ 182 msn_soap_passport_sso_request( soap_req->ic, "blaataap" ); 183 md->flags |= MSN_REAUTHING; 184 } 185 md->soapq = g_slist_append( md->soapq, soap_req ); 186 } 172 187 else 173 188 { … … 242 257 static int msn_soap_passport_sso_build_request( struct msn_soap_req_data *soap_req ) 243 258 { 244 struct msn_soap_passport_sso_data *sd = soap_req->data;245 259 struct im_connection *ic = soap_req->ic; 246 260 struct msn_data *md = ic->proto_data; … … 423 437 char *msg; 424 438 int number; 425 int need_retry;439 msn_soap_result_t need_retry; 426 440 }; 427 441 … … 444 458 445 459 g_free( display_name_b64 ); 446 447 return MSN_SOAP_OK; 448 } 449 450 static xt_status msn_soap_oim_send_challenge( struct xt_node *node, gpointer data ) 460 oim->need_retry = MSN_SOAP_OK; 461 462 return MSN_SOAP_OK; 463 } 464 465 static xt_status msn_soap_oim_reauth( struct xt_node *node, gpointer data ) 451 466 { 452 467 struct msn_soap_req_data *soap_req = data; … … 454 469 struct im_connection *ic = soap_req->ic; 455 470 struct msn_data *md = ic->proto_data; 456 457 g_free( md->lock_key ); 458 md->lock_key = msn_p11_challenge( node->text ); 459 460 oim->need_retry = 1; 471 struct xt_node *c; 472 473 if( ( c = xt_find_node( node->children, "LockKeyChallenge" ) ) && c->text_len > 0 ) 474 { 475 g_free( md->lock_key ); 476 md->lock_key = msn_p11_challenge( c->text ); 477 oim->need_retry = MSN_SOAP_RETRY; 478 } 479 if( xt_find_node( node->children, "RequiredAuthPolicy" ) ) 480 { 481 oim->need_retry = MSN_SOAP_REAUTH; 482 } 461 483 462 484 return XT_HANDLED; … … 464 486 465 487 static const struct xt_handler_entry msn_soap_oim_send_parser[] = { 466 { " LockKeyChallenge", "detail", msn_soap_oim_send_challenge},467 { NULL, NULL, NULL}488 { "detail", "soap:Fault", msn_soap_oim_reauth }, 489 { NULL, NULL, NULL } 468 490 }; 469 491 … … 474 496 if( soap_req->http_req->status_code == 500 && oim->need_retry && soap_req->ttl > 0 ) 475 497 { 476 oim->need_retry = 0; 477 return MSN_SOAP_RETRY; 498 return oim->need_retry; 478 499 } 479 500 else if( soap_req->http_req->status_code == 200 ) -
protocols/msn/soap.h
r4aa8a04 r27053b5 126 126 "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \ 127 127 "</wst:RequestSecurityToken>" \ 128 "<wst:RequestSecurityToken Id=\"RST 3\">" \128 "<wst:RequestSecurityToken Id=\"RST4\">" \ 129 129 "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \ 130 130 "<wsp:AppliesTo>" \
Note: See TracChangeset
for help on using the changeset viewer.