Changeset 660cb00 for protocols


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.

Location:
protocols/msn
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.h

    r5a7af1b r660cb00  
    204204/* ns.c */
    205205gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );
    206 void msn_auth_got_passport_token( struct im_connection *ic, char *token );
     206void msn_auth_got_passport_token( struct im_connection *ic, const char *token, const char *error );
    207207void msn_auth_got_contact_list( struct im_connection *ic );
    208208
  • protocols/msn/ns.c

    r5a7af1b r660cb00  
    697697}
    698698
    699 void msn_auth_got_passport_token( struct im_connection *ic, char *token )
     699void msn_auth_got_passport_token( struct im_connection *ic, const char *token, const char *error )
    700700{
    701701        struct msn_data *md;
     
    707707        md = ic->proto_data;
    708708       
     709        if( token )
    709710        {
    710711                char buf[1536];
     
    712713                g_snprintf( buf, sizeof( buf ), "USR %d SSO S %s %s\r\n", ++md->trId, md->tokens[0], token );
    713714                msn_write( ic, buf, strlen( buf ) );
     715        }
     716        else
     717        {
     718                imcb_error( ic, "Error during Passport authentication: %s", error );
     719                imc_logout( ic, TRUE );
    714720        }
    715721}
  • 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.