source: protocols/msn/soap.h @ 523fb23

Last change on this file since 523fb23 was 523fb23, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-08-11T08:08:39Z

Implement MSNP15 SSO (Sadistic Sign-On).

  • Property mode set to 100644
File size: 8.8 KB
Line 
1/* soap.h
2 *
3 * SOAP-related functions. Some manager at Microsoft apparently thought
4 * MSNP wasn't XMLy enough so someone stepped up and changed that. This
5 * is the result.
6 *
7 * Copyright (C) 2010 Wilmer van der Gaast <wilmer@gaast.net>
8 *
9 * This program is free software; you can redistribute it and/or modify             
10 * it under the terms of the GNU General Public License version 2                   
11 * as published by the Free Software Foundation                                     
12 *                                                                                   
13 * This program is distributed in the hope that is will be useful,                 
14 * bit WITHOU ANY WARRANTY; without even the implied warranty of                   
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   
16 * GNU General Public License for more details.                                     
17 *                                                                                   
18 * You should have received a copy of the GNU General Public License               
19 * along with this program; if not, write to the Free Software                     
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA         
21 */
22
23/* Thanks to http://msnpiki.msnfanatic.com/ for lots of info on this! */
24
25#ifndef __SOAP_H__
26#define __SOAP_H__
27
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
31#include <sys/types.h>
32#ifndef _WIN32
33#include <sys/socket.h>
34#include <netinet/in.h>
35#include <arpa/inet.h>
36#include <unistd.h>
37#endif
38#include "nogaim.h"
39
40
41#define SOAP_HTTP_REQUEST \
42"POST %s HTTP/1.0\r\n" \
43"Host: %s\r\n" \
44"Accept: */*\r\n" \
45"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
46"Content-Type: text/xml; charset=utf-8\r\n" \
47"%s" \
48"Content-Length: %zd\r\n" \
49"Cache-Control: no-cache\r\n" \
50"\r\n" \
51"%s"
52
53
54#define SOAP_PASSPORT_SSO_URL "https://login.live.com/RST.srf"
55#define SOAP_PASSPORT_SSO_URL_MSN "https://msnia.login.live.com/pp550/RST.srf"
56
57#define SOAP_PASSPORT_SSO_PAYLOAD \
58"<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" " \
59   "xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" " \
60   "xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" " \
61   "xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" " \
62   "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" " \
63   "xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" " \
64   "xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" " \
65   "xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">" \
66   "<Header>" \
67       "<ps:AuthInfo " \
68           "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
69           "Id=\"PPAuthInfo\">" \
70           "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
71           "<ps:BinaryVersion>4</ps:BinaryVersion>" \
72           "<ps:UIVersion>1</ps:UIVersion>" \
73           "<ps:Cookies></ps:Cookies>" \
74           "<ps:RequestParams>AQAAAAIAAABsYwQAAAAxMDMz</ps:RequestParams>" \
75       "</ps:AuthInfo>" \
76       "<wsse:Security>" \
77           "<wsse:UsernameToken Id=\"user\">" \
78               "<wsse:Username>%s</wsse:Username>" \
79               "<wsse:Password>%s</wsse:Password>" \
80           "</wsse:UsernameToken>" \
81       "</wsse:Security>" \
82   "</Header>" \
83   "<Body>" \
84       "<ps:RequestMultipleSecurityTokens " \
85           "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
86           "Id=\"RSTS\">" \
87           "<wst:RequestSecurityToken Id=\"RST0\">" \
88               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
89               "<wsp:AppliesTo>" \
90                   "<wsa:EndpointReference>" \
91                       "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
92                   "</wsa:EndpointReference>" \
93               "</wsp:AppliesTo>" \
94           "</wst:RequestSecurityToken>" \
95           "<wst:RequestSecurityToken Id=\"RST1\">" \
96               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
97               "<wsp:AppliesTo>" \
98                   "<wsa:EndpointReference>" \
99                       "<wsa:Address>messengerclear.live.com</wsa:Address>" \
100                   "</wsa:EndpointReference>" \
101               "</wsp:AppliesTo>" \
102               "<wsse:PolicyReference URI=\"%s\"></wsse:PolicyReference>" \
103           "</wst:RequestSecurityToken>" \
104           "<wst:RequestSecurityToken Id=\"RST2\">" \
105               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
106               "<wsp:AppliesTo>" \
107                   "<wsa:EndpointReference>" \
108                       "<wsa:Address>contacts.msn.com</wsa:Address>" \
109                   "</wsa:EndpointReference>" \
110               "</wsp:AppliesTo>" \
111               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI\"></wsse:PolicyReference>" \
112           "</wst:RequestSecurityToken>" \
113       "</ps:RequestMultipleSecurityTokens>" \
114   "</Body>" \
115"</Envelope>"
116
117int msn_soap_passport_sso_request( struct im_connection *ic, const char *policy, const char *nonce );
118
119
120#define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
121#define SOAP_OIM_SEND_ACTION "http://messenger.msn.com/ws/2004/09/oim/Store"
122
123#define SOAP_OIM_SEND_PAYLOAD \
124"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
125"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
126"<soap:Header>" \
127  "<From memberName=\"%s\" friendlyName=\"=?utf-8?B?%s?=\" xml:lang=\"nl-nl\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"MSNP13\" buildVer=\"8.0.0328\"/>" \
128  "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
129  "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
130  "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">" \
131    "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>" \
132    "<MessageNumber>%d</MessageNumber>" \
133  "</Sequence>" \
134"</soap:Header>" \
135"<soap:Body>" \
136  "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>" \
137  "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \
138    "MIME-Version: 1.0\r\n" \
139    "Content-Type: text/plain; charset=UTF-8\r\n" \
140    "Content-Transfer-Encoding: base64\r\n" \
141    "X-OIM-Message-Type: OfflineMessage\r\n" \
142    "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \
143    "X-OIM-Sequence-Num: %d\r\n" \
144    "\r\n" \
145    "%s" \
146  "</Content>" \
147"</soap:Body>" \
148"</soap:Envelope>"
149
150int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg );
151int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
152
153
154#define SOAP_MEMLIST_URL "https://byrdr.omega.contacts.msn.com/abservice/SharingService.asmx"
155#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
156
157#define SOAP_MEMLIST_PAYLOAD \
158"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
159"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
160  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
161    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
162      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
163      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
164      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">Initial</PartnerScenario>" \
165    "</ABApplicationHeader>" \
166    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
167      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
168    "</ABAuthHeader>" \
169  "</soap:Header>" \
170  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
171    "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\"><Types xmlns=\"http://www.msn.com/webservices/AddressBook\"><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType></Types></serviceFilter>" \
172    "</FindMembership>" \
173  "</soap:Body>" \
174"</soap:Envelope>"
175
176int msn_soap_memlist_request( struct im_connection *ic );
177
178
179#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.