Ignore:
Timestamp:
2010-09-04T15:54:52Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
27053b5
Parents:
bae0617
Message:

This works (includes some token sabotage code to ease testing), but I just
realised there's probably no need for the additional temporary NS connection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/soap.c

    rbae0617 r4aa8a04  
    137137        {
    138138                struct xt_parser *parser;
     139                struct xt_node *err;
    139140               
    140141                parser = xt_new( soap_req->xml_parser, soap_req );
    141142                xt_feed( parser, http_req->reply_body, http_req->body_size );
     143                if( http_req->status_code == 500 &&
     144                    ( err = xt_find_path( parser->root, "soap:Body/soap:Fault/detail/errorcode" ) ) &&
     145                    err->text_len > 0 && strcmp( err->text, "PassportAuthFail" ) == 0 )
     146                {
     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;
     155                }
     156               
    142157                xt_handle( parser, NULL, -1 );
    143158                xt_free( parser );
     
    202217}
    203218
     219static int msn_soapq_empty( struct im_connection *ic )
     220{
     221        struct msn_data *md = ic->proto_data;
     222       
     223        while( md->soapq )
     224        {
     225                msn_soap_send_request( (struct msn_soap_req_data*) md->soapq->data );
     226                md->soapq = g_slist_remove( md->soapq, md->soapq->data );
     227        }
     228       
     229        return MSN_SOAP_OK;
     230}
     231
    204232
    205233/* passport_sso: Authentication MSNP15+ */
     
    207235struct msn_soap_passport_sso_data
    208236{
    209         char *policy;
    210237        char *nonce;
    211238        char *secret;
     
    217244        struct msn_soap_passport_sso_data *sd = soap_req->data;
    218245        struct im_connection *ic = soap_req->ic;
     246        struct msn_data *md = ic->proto_data;
    219247       
    220248        if( g_str_has_suffix( ic->acc->user, "@msn.com" ) )
     
    224252       
    225253        soap_req->payload = g_markup_printf_escaped( SOAP_PASSPORT_SSO_PAYLOAD,
    226                 ic->acc->user, ic->acc->pass, sd->policy );
     254                ic->acc->user, ic->acc->pass, md->pp_policy );
    227255       
    228256        return MSN_SOAP_OK;
     
    301329        struct msn_soap_passport_sso_data *sd = soap_req->data;
    302330        struct im_connection *ic = soap_req->ic;
     331        struct msn_data *md = ic->proto_data;
    303332        char *key1, *key2, *key3, *blurb64;
    304333        int key1_len;
     
    326355        };
    327356       
     357        if( md->soapq )
     358                return msn_soapq_empty( ic );
     359       
    328360        if( sd->secret == NULL )
    329361        {
     
    364396        struct msn_soap_passport_sso_data *sd = soap_req->data;
    365397       
    366         g_free( sd->policy );
    367398        g_free( sd->nonce );
    368399        g_free( sd->secret );
     
    372403}
    373404
    374 int msn_soap_passport_sso_request( struct im_connection *ic, const char *policy, const char *nonce )
     405int msn_soap_passport_sso_request( struct im_connection *ic, const char *nonce )
    375406{
    376407        struct msn_soap_passport_sso_data *sd = g_new0( struct msn_soap_passport_sso_data, 1 );
    377408       
    378         sd->policy = g_strdup( policy );
    379409        sd->nonce = g_strdup( nonce );
    380410       
Note: See TracChangeset for help on using the changeset viewer.