diff options
-rw-r--r-- | protocols/msn/soap.c | 18 | ||||
-rw-r--r-- | protocols/msn/soap.h | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index 05d91109..21e9feec 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -261,14 +261,21 @@ struct msn_soap_passport_sso_data char *nonce; char *secret; char *error; + char *redirect; }; static int msn_soap_passport_sso_build_request( struct msn_soap_req_data *soap_req ) { + struct msn_soap_passport_sso_data *sd = soap_req->data; struct im_connection *ic = soap_req->ic; struct msn_data *md = ic->proto_data; - if( g_str_has_suffix( ic->acc->user, "@msn.com" ) ) + if( sd->redirect ) + { + soap_req->url = sd->redirect; + sd->redirect = NULL; + } + else if( g_str_has_suffix( ic->acc->user, "@msn.com" ) ) soap_req->url = g_strdup( SOAP_PASSPORT_SSO_URL_MSN ); else soap_req->url = g_strdup( SOAP_PASSPORT_SSO_URL ); @@ -311,9 +318,14 @@ static xt_status msn_soap_passport_failure( struct xt_node *node, gpointer data struct msn_soap_passport_sso_data *sd = soap_req->data; struct xt_node *code = xt_find_node( node->children, "faultcode" ); struct xt_node *string = xt_find_node( node->children, "faultstring" ); + struct xt_node *url; if( code == NULL || code->text_len == 0 ) sd->error = g_strdup( "Unknown error" ); + else if( strcmp( code->text, "psf:Redirect" ) == 0 && + ( url = xt_find_node( node->children, "psf:redirectUrl" ) ) && + url->text_len > 0 ) + sd->redirect = g_strdup( url->text ); else sd->error = g_strdup_printf( "%s (%s)", code->text, string && string->text_len ? string->text : "no description available" ); @@ -377,6 +389,9 @@ static int msn_soap_passport_sso_handle_response( struct msn_soap_req_data *soap GUINT32_TO_LE( 72 ), }; + if( sd->redirect ) + return MSN_SOAP_RETRY; + if( md->soapq ) return msn_soapq_flush( ic, TRUE ); @@ -421,6 +436,7 @@ static int msn_soap_passport_sso_free_data( struct msn_soap_req_data *soap_req ) g_free( sd->nonce ); g_free( sd->secret ); g_free( sd->error ); + g_free( sd->redirect ); return MSN_SOAP_OK; } diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index b13238a4..f49c86c4 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -61,7 +61,7 @@ int msn_soapq_flush( struct im_connection *ic, gboolean resend ); #define SOAP_PASSPORT_SSO_URL "https://login.live.com/RST.srf" -#define SOAP_PASSPORT_SSO_URL_MSN "https://msnia.login.live.com/pp550/RST.srf" +#define SOAP_PASSPORT_SSO_URL_MSN "https://msnia.login.live.com/pp800/RST.srf" #define SOAP_PASSPORT_SSO_PAYLOAD \ "<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" " \ |