summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMa Yuan <mayuan2006@gmail.com>2006-09-08 16:02:00 +0000
committerMa Yuan <mayuan2006@gmail.com>2006-09-08 16:02:00 +0000
commit5128fb3cc7ff3d8a85803026bc3809a95c276a25 (patch)
treefd2bd24fde6c59ca9226a2e377d1d7cd9bfd5b4a
parent6a626d36db3c89d310cf0187040656c66a8046f8 (diff)
downloadpidgin-5128fb3cc7ff3d8a85803026bc3809a95c276a25.tar.gz
[gaim-migrate @ 17192]
trial of new Login.live.com passport login procedure Not stable. committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
-rw-r--r--src/protocols/msn/nexus.c39
-rw-r--r--src/protocols/msn/nexus.h66
2 files changed, 99 insertions, 6 deletions
diff --git a/src/protocols/msn/nexus.c b/src/protocols/msn/nexus.c
index e63108b255..69640e4f4e 100644
--- a/src/protocols/msn/nexus.c
+++ b/src/protocols/msn/nexus.c
@@ -26,6 +26,8 @@
#include "nexus.h"
#include "notification.h"
+#define NEXUS_LOGIN_TWN 1
+
/*Local Function Prototype*/
static void nexus_login_connect_cb(gpointer data, GaimSslConnection *gsc,GaimInputCondition cond);
@@ -95,15 +97,21 @@ nexus_login_read_cb(gpointer data, gint source, GaimInputCondition cond)
session = nexus->session;
g_return_if_fail(session != NULL);
-// gaim_debug_misc("msn", "TWN Server Reply: {%s}\n", soapconn->read_buf);
+ gaim_debug_misc("msn", "TWN Server Reply: {%s}\n", soapconn->read_buf);
/*reply OK, we should process the SOAP body*/
gaim_debug_info("MaYuan","Windows Live ID Reply OK!\n");
//TODO: we should parse it using XML
+#ifdef NEXUS_LOGIN_TWN
base = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_START_TOKEN);
base += strlen(TWN_START_TOKEN);
c = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_END_TOKEN);
+#else
+ base = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_LIVE_START_TOKEN);
+ base += strlen(TWN_LIVE_START_TOKEN);
+ c = g_strstr_len(soapconn->read_buf, soapconn->read_len, TWN_LIVE_END_TOKEN);
+#endif
login_params = g_strndup(base, c - base);
// gaim_debug_info("msn", "TWN Cert: {%s}\n", login_params);
@@ -166,7 +174,12 @@ nexus_login_connect_cb(gpointer data, GaimSslConnection *gsc,
char *ru,*lc,*id,*tw,*ct,*kpp,*kv,*ver,*rn,*tpf;
char *fs0,*fs;
char *username, *password;
- char *request_str, *head, *tail,*challenge_str;
+ char *request_str, *head, *tail;
+#ifdef NEXUS_LOGIN_TWN
+ char *challenge_str;
+#else
+ char *rst1_str,*rst2_str,*rst3_str;
+#endif
gaim_debug_info("MaYuan","starting Windows Live ID authentication\n");
@@ -222,14 +235,32 @@ nexus_login_connect_cb(gpointer data, GaimSslConnection *gsc,
}else{
fs = g_strdup("1");
}
+
+#ifdef NEXUS_LOGIN_TWN
challenge_str = g_strdup_printf(
"lc=%s&amp;id=%s&amp;tw=%s&amp;fs=%s&amp;ru=%s&amp;ct=%s&amp;kpp=%s&amp;kv=%s&amp;ver=%s&amp;rn=%s&amp;tpf=%s\r\n",
lc,id,tw,fs,ru,ct,kpp,kv,ver,rn,tpf
);
- g_free(fs);
/*build the SOAP windows Live ID XML body */
tail = g_strdup_printf(TWN_ENVELOP_TEMPLATE,username,password,challenge_str );
+ g_free(challenge_str);
+#else
+ rst1_str = g_strdup_printf(
+ "id=%s&amp;tw=%s&amp;fs=%s&amp;kpp=%s&amp;kv=%s&amp;ver=%s&amp;rn=%s",
+ id,tw,fs,kpp,kv,ver,rn
+ );
+ rst2_str = g_strdup_printf(
+ "fs=%s&amp;id=%s&amp;kv=%s&amp;rn=%s&amp;tw=%s&amp;ver=%s",
+ fs,id,kv,rn,tw,ver
+ );
+ rst3_str = g_strdup_printf("id=%s",id);
+ tail = g_strdup_printf(TWN_LIVE_ENVELOP_TEMPLATE,username,password,rst1_str,rst2_str,rst3_str);
+ g_free(rst1_str);
+ g_free(rst2_str);
+ g_free(rst3_str);
+#endif
+ g_free(fs);
soapconn->login_path = g_strdup(TWN_POST_URL);
head = g_strdup_printf(
@@ -243,7 +274,7 @@ nexus_login_connect_cb(gpointer data, GaimSslConnection *gsc,
soapconn->login_path,soapconn->login_host,(int)strlen(tail));
request_str = g_strdup_printf("%s%s", head,tail);
-// gaim_debug_misc("msn", "TWN Sending: {%s}\n", request_str);
+ gaim_debug_misc("msn", "TWN Sending: {%s}\n", request_str);
g_free(head);
g_free(tail);
diff --git a/src/protocols/msn/nexus.h b/src/protocols/msn/nexus.h
index 41fbf68d83..7b09dee850 100644
--- a/src/protocols/msn/nexus.h
+++ b/src/protocols/msn/nexus.h
@@ -26,7 +26,8 @@
#include "soap.h"
-#define MSN_TWN_SERVER "loginnet.passport.com"
+/*#define MSN_TWN_SERVER "loginnet.passport.com"*/
+#define MSN_TWN_SERVER "login.live.com"
#define TWN_START_TOKEN "<wsse:BinarySecurityToken Id=\"PPToken1\">"
#define TWN_END_TOKEN "</wsse:BinarySecurityToken>"
@@ -48,7 +49,8 @@
"<wsse:Password>%s</wsse:Password>"\
"</wsse:UsernameToken>"\
"</wsse:Security>"\
- "</Header><Body>"\
+ "</Header>"\
+ "<Body>"\
"<ps:RequestMultipleSecurityTokens xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"RSTS\">"\
"<wst:RequestSecurityToken Id=\"RST0\">"\
"<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>"\
@@ -72,6 +74,66 @@
"</Body>"\
"</Envelope>"
+#define TWN_LIVE_START_TOKEN "<wsse:BinarySecurityToken Id=\"PPToken1\">"
+#define TWN_LIVE_END_TOKEN "</wsse:BinarySecurityToken>"
+#define TWN_LIVE_ENVELOP_TEMPLATE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"\
+"<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">"\
+ "<Header>"\
+ "<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">"\
+ "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>"\
+ "<ps:BinaryVersion>4</ps:BinaryVersion>"\
+ "<ps:UIVersion>1</ps:UIVersion>"\
+ "<ps:Cookies></ps:Cookies>"\
+ "<ps:RequestParams>AQAAAAIAAABsYwQAAAAyMDUy</ps:RequestParams>"\
+ "</ps:AuthInfo>"\
+ "<wsse:Security>"\
+ "<wsse:UsernameToken Id=\"user\">"\
+ "<wsse:Username>%s</wsse:Username>"\
+ "<wsse:Password>%s</wsse:Password>"\
+ "</wsse:UsernameToken>"\
+ "</wsse:Security>"\
+ "</Header>"\
+ "<Body>"\
+ "<ps:RequestMultipleSecurityTokens xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"RSTS\">"\
+ "<wst:RequestSecurityToken Id=\"RST0\">"\
+ "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>"\
+ "<wsp:AppliesTo>"\
+ "<wsa:EndpointReference>"\
+ "<wsa:Address>http://Passport.NET/tb</wsa:Address>"\
+ "</wsa:EndpointReference>"\
+ "</wsp:AppliesTo>"\
+ "</wst:RequestSecurityToken>"\
+ "<wst:RequestSecurityToken Id=\"RST1\">"\
+ "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>"\
+ "<wsp:AppliesTo>"\
+ "<wsa:EndpointReference>"\
+ "<wsa:Address>messenger.msn.com</wsa:Address>"\
+ "</wsa:EndpointReference>"\
+ "</wsp:AppliesTo>"\
+ "<wsse:PolicyReference URI=\"%s\"></wsse:PolicyReference>"\
+ "</wst:RequestSecurityToken>"\
+ "<wst:RequestSecurityToken Id=\"RST2\">"\
+ "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>"\
+ "<wsp:AppliesTo>"\
+ "<wsa:EndpointReference>"\
+ "<wsa:Address>contacts.msn.com</wsa:Address>"\
+ "</wsa:EndpointReference>"\
+ "</wsp:AppliesTo>"\
+ "<wsse:PolicyReference URI=\"?%s\"></wsse:PolicyReference>"\
+ " </wst:RequestSecurityToken>"\
+ "<wst:RequestSecurityToken Id=\"RST3\">"\
+ "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>"\
+ "<wsp:AppliesTo>"\
+ "<wsa:EndpointReference>"\
+ "<wsa:Address>voice.messenger.msn.com</wsa:Address>"\
+ "</wsa:EndpointReference>"\
+ " </wsp:AppliesTo>"\
+ "<wsse:PolicyReference URI=\"?%s\"></wsse:PolicyReference>"\
+ "</wst:RequestSecurityToken>"\
+ "</ps:RequestMultipleSecurityTokens>"\
+ "</Body>"\
+"</Envelope>"
+
typedef struct _MsnNexus MsnNexus;
struct _MsnNexus