Ignore:
Timestamp:
2010-08-15T13:23:03Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9679fd8
Parents:
5a7af1b
Message:

Parse authentication errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/soap.c

    r5a7af1b r660cb00  
    173173        char *nonce;
    174174        char *secret;
     175        char *error;
    175176};
    176177
     
    217218}
    218219
     220static xt_status msn_soap_passport_failure( struct xt_node *node, gpointer data )
     221{
     222        struct msn_soap_req_data *soap_req = data;
     223        struct msn_soap_passport_sso_data *sd = soap_req->data;
     224        struct xt_node *code = xt_find_node( node->children, "faultcode" );
     225        struct xt_node *string = xt_find_node( node->children, "faultstring" );
     226       
     227        if( code == NULL || code->text_len == 0 )
     228                sd->error = g_strdup( "Unknown error" );
     229        else
     230                sd->error = g_strdup_printf( "%s (%s)", code->text, string && string->text_len ?
     231                                             string->text : "no description available" );
     232       
     233        return XT_HANDLED;
     234}
     235
    219236static const struct xt_handler_entry msn_soap_passport_sso_parser[] = {
    220237        { "wsse:BinarySecurityToken", "wst:RequestedSecurityToken", msn_soap_passport_sso_token },
     238        { "S:Fault", "S:Envelope", msn_soap_passport_failure },
    221239        { NULL, NULL, NULL }
    222240};
     
    270288                GUINT32_TO_LE( 72 ),
    271289        };
     290       
     291        if( sd->secret == NULL )
     292        {
     293                msn_auth_got_passport_token( ic, NULL, sd->error );
     294                return MSN_SOAP_OK;
     295        }
    272296
    273297        key1_len = base64_decode( sd->secret, (unsigned char**) &key1 );
     
    287311       
    288312        blurb64 = base64_encode( (unsigned char*) &blurb, sizeof( blurb ) );
    289         msn_auth_got_passport_token( ic, blurb64 );
     313        msn_auth_got_passport_token( ic, blurb64, NULL );
    290314       
    291315        g_free( padnonce );
     
    306330        g_free( sd->nonce );
    307331        g_free( sd->secret );
     332        g_free( sd->error );
    308333       
    309334        return MSN_SOAP_OK;
Note: See TracChangeset for help on using the changeset viewer.