Changeset 27053b5 for protocols/msn/soap.c
- Timestamp:
- 2010-09-04T17:13:55Z (14 years ago)
- Branches:
- master
- Children:
- 4e1be76
- Parents:
- 4aa8a04
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 )
Note: See TracChangeset
for help on using the changeset viewer.