source: protocols/msn/soap.h @ 2af3e23

Last change on this file since 2af3e23 was 2af3e23, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-10-02T06:56:33Z

Restore MSN password truncation code. MSN still can't handle passwords
longer than 16 chars and silently fails if you give >16chars.

  • Property mode set to 100644
File size: 16.2 KB
RevLine 
[d93c0eb9]1  /********************************************************************\
2  * BitlBee -- An IRC to other IM-networks gateway                     *
3  *                                                                    *
4  * Copyright 2002-2010 Wilmer van der Gaast and others                *
5  \********************************************************************/
6
7/* MSN module - All the SOAPy XML stuff.
8   Some manager at Microsoft apparently thought MSNP wasn't XMLy enough so
9   someone stepped up and changed that. This is the result. Kilobytes and
10   more kilobytes of XML vomit to transfer tiny bits of informaiton. */
11
12/*
13  This program is free software; you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 2 of the License, or
16  (at your option) any later version.
17
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  GNU General Public License for more details.
22
23  You should have received a copy of the GNU General Public License with
24  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
25  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
26  Suite 330, Boston, MA  02111-1307  USA
27*/
[e5a8118]28
29/* Thanks to http://msnpiki.msnfanatic.com/ for lots of info on this! */
30
31#ifndef __SOAP_H__
32#define __SOAP_H__
33
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <sys/types.h>
38#ifndef _WIN32
39#include <sys/socket.h>
40#include <netinet/in.h>
41#include <arpa/inet.h>
42#include <unistd.h>
43#endif
44#include "nogaim.h"
45
46
[4e1be76]47int msn_soapq_flush( struct im_connection *ic, gboolean resend );
48
49
[e5a8118]50#define SOAP_HTTP_REQUEST \
51"POST %s HTTP/1.0\r\n" \
52"Host: %s\r\n" \
53"Accept: */*\r\n" \
54"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
55"Content-Type: text/xml; charset=utf-8\r\n" \
[523fb23]56"%s" \
57"Content-Length: %zd\r\n" \
[e5a8118]58"Cache-Control: no-cache\r\n" \
59"\r\n" \
60"%s"
61
62
[523fb23]63#define SOAP_PASSPORT_SSO_URL "https://login.live.com/RST.srf"
[2c6b0f4]64#define SOAP_PASSPORT_SSO_URL_MSN "https://msnia.login.live.com/pp800/RST.srf"
[2af3e23]65#define MAX_PASSPORT_PWLEN 16
[523fb23]66
67#define SOAP_PASSPORT_SSO_PAYLOAD \
68"<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" " \
69   "xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" " \
70   "xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" " \
71   "xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" " \
72   "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" " \
73   "xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" " \
74   "xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" " \
75   "xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">" \
76   "<Header>" \
77       "<ps:AuthInfo " \
78           "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
79           "Id=\"PPAuthInfo\">" \
80           "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
81           "<ps:BinaryVersion>4</ps:BinaryVersion>" \
82           "<ps:UIVersion>1</ps:UIVersion>" \
83           "<ps:Cookies></ps:Cookies>" \
84           "<ps:RequestParams>AQAAAAIAAABsYwQAAAAxMDMz</ps:RequestParams>" \
85       "</ps:AuthInfo>" \
86       "<wsse:Security>" \
87           "<wsse:UsernameToken Id=\"user\">" \
88               "<wsse:Username>%s</wsse:Username>" \
89               "<wsse:Password>%s</wsse:Password>" \
90           "</wsse:UsernameToken>" \
91       "</wsse:Security>" \
92   "</Header>" \
93   "<Body>" \
94       "<ps:RequestMultipleSecurityTokens " \
95           "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
96           "Id=\"RSTS\">" \
97           "<wst:RequestSecurityToken Id=\"RST0\">" \
98               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
99               "<wsp:AppliesTo>" \
100                   "<wsa:EndpointReference>" \
101                       "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
102                   "</wsa:EndpointReference>" \
103               "</wsp:AppliesTo>" \
104           "</wst:RequestSecurityToken>" \
105           "<wst:RequestSecurityToken Id=\"RST1\">" \
106               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
107               "<wsp:AppliesTo>" \
108                   "<wsa:EndpointReference>" \
109                       "<wsa:Address>messengerclear.live.com</wsa:Address>" \
110                   "</wsa:EndpointReference>" \
111               "</wsp:AppliesTo>" \
112               "<wsse:PolicyReference URI=\"%s\"></wsse:PolicyReference>" \
113           "</wst:RequestSecurityToken>" \
114           "<wst:RequestSecurityToken Id=\"RST2\">" \
115               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
116               "<wsp:AppliesTo>" \
117                   "<wsa:EndpointReference>" \
118                       "<wsa:Address>contacts.msn.com</wsa:Address>" \
119                   "</wsa:EndpointReference>" \
120               "</wsp:AppliesTo>" \
121               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI\"></wsse:PolicyReference>" \
122           "</wst:RequestSecurityToken>" \
[91d6e91]123           "<wst:RequestSecurityToken Id=\"RST3\">" \
124               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
125               "<wsp:AppliesTo>" \
126                   "<wsa:EndpointReference>" \
127                       "<wsa:Address>messengersecure.live.com</wsa:Address>" \
128                   "</wsa:EndpointReference>" \
129               "</wsp:AppliesTo>" \
130               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \
131           "</wst:RequestSecurityToken>" \
[27053b5]132           "<wst:RequestSecurityToken Id=\"RST4\">" \
[80175a1]133               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
134               "<wsp:AppliesTo>" \
135                   "<wsa:EndpointReference>" \
136                       "<wsa:Address>storage.msn.com</wsa:Address>" \
137                   "</wsa:EndpointReference>" \
138               "</wsp:AppliesTo>" \
139               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \
140           "</wst:RequestSecurityToken>" \
[523fb23]141       "</ps:RequestMultipleSecurityTokens>" \
142   "</Body>" \
143"</Envelope>"
144
[4aa8a04]145int msn_soap_passport_sso_request( struct im_connection *ic, const char *nonce );
[523fb23]146
147
[e5a8118]148#define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
[91d6e91]149#define SOAP_OIM_SEND_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2"
[e5a8118]150
151#define SOAP_OIM_SEND_PAYLOAD \
152"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
153"<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/\">" \
154"<soap:Header>" \
[91d6e91]155  "<From memberName=\"%s\" friendlyName=\"=?utf-8?B?%s?=\" xml:lang=\"nl-nl\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"%s\" buildVer=\"%s\"/>" \
[e5a8118]156  "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
157  "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
158  "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">" \
159    "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>" \
160    "<MessageNumber>%d</MessageNumber>" \
161  "</Sequence>" \
162"</soap:Header>" \
163"<soap:Body>" \
164  "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>" \
[ffb6dea]165  "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \
166    "MIME-Version: 1.0\r\n" \
[e5a8118]167    "Content-Type: text/plain; charset=UTF-8\r\n" \
168    "Content-Transfer-Encoding: base64\r\n" \
169    "X-OIM-Message-Type: OfflineMessage\r\n" \
[5fecede]170    "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \
[e5a8118]171    "X-OIM-Sequence-Num: %d\r\n" \
172    "\r\n" \
173    "%s" \
174  "</Content>" \
175"</soap:Body>" \
176"</soap:Envelope>"
177
178int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg );
[bc090f0]179int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
[e5a8118]180
[7db65b7]181
[6ddb223]182#define SOAP_ABSERVICE_PAYLOAD \
[7db65b7]183"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
184"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
185  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
186    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
187      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
188      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
[6ddb223]189      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>" \
[7db65b7]190    "</ABApplicationHeader>" \
191    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
192      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
[7f34ce2]193      "<TicketToken>%s</TicketToken>" \
[7db65b7]194    "</ABAuthHeader>" \
195  "</soap:Header>" \
196  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
[6ddb223]197    "%%s" \
[7db65b7]198  "</soap:Body>" \
199"</soap:Envelope>"
200
[6ddb223]201#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
202#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
203
204#define SOAP_MEMLIST_PAYLOAD \
205    "<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>" \
206    "</FindMembership>"
207
[193dc74]208#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
209#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
210
211#define SOAP_MEMLIST_EDIT_PAYLOAD \
212  "<%sMember xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
213   "<serviceHandle>" \
214    "<Id>0</Id>" \
215    "<Type>Messenger</Type>" \
216    "<ForeignId></ForeignId>" \
217   "</serviceHandle>" \
218   "<memberships>" \
219    "<Membership>" \
220     "<MemberRole>%s</MemberRole>" \
221     "<Members>" \
222      "<Member xsi:type=\"PassportMember\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" \
223       "<Type>Passport</Type>" \
224       "<State>Accepted</State>" \
225       "<PassportName>%s</PassportName>" \
226      "</Member>" \
227     "</Members>" \
228    "</Membership>" \
229   "</memberships>" \
[6ddb223]230  "</%sMember>"
[193dc74]231
[7db65b7]232int msn_soap_memlist_request( struct im_connection *ic );
[193dc74]233int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list );
[7db65b7]234
235
[7f34ce2]236#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx"
237#define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
238
239#define SOAP_ADDRESSBOOK_PAYLOAD \
240    "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
241      "<abId>00000000-0000-0000-0000-000000000000</abId>" \
242      "<abView>Full</abView>" \
243      "<deltasOnly>false</deltasOnly>" \
244      "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
[6ddb223]245    "</ABFindAll>"
[7f34ce2]246
[4452e69]247#define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
248
249#define SOAP_AB_NAMECHANGE_PAYLOAD \
250        "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
251            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
252            "<contacts>" \
253                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
254                    "<contactInfo>" \
255                        "<contactType>Me</contactType>" \
256                        "<displayName>%s</displayName>" \
257                    "</contactInfo>" \
258                    "<propertiesChanged>DisplayName</propertiesChanged>" \
259                "</Contact>" \
260            "</contacts>" \
[6ddb223]261        "</ABContactUpdate>"
[4452e69]262
[4fc95c5]263#define SOAP_AB_CONTACT_ADD_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd"
264
265#define SOAP_AB_CONTACT_ADD_PAYLOAD \
266        "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
267            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
268            "<contacts>" \
269                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
270                    "<contactInfo>" \
271                        "<contactType>LivePending</contactType>" \
272                        "<passportName>%s</passportName>" \
273                        "<isMessengerUser>true</isMessengerUser>" \
274                        "<MessengerMemberInfo>" \
275                            "<DisplayName>%s</DisplayName>" \
276                        "</MessengerMemberInfo>" \
277                    "</contactInfo>" \
278                "</Contact>" \
279            "</contacts>" \
280            "<options>" \
281                "<EnableAllowListManagement>true</EnableAllowListManagement>" \
282            "</options>" \
283        "</ABContactAdd>"
284
285#define SOAP_AB_CONTACT_DEL_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete"
286
287#define SOAP_AB_CONTACT_DEL_PAYLOAD \
288        "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
289            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
290            "<contacts>" \
291                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
292                    "<contactId>%s</contactId>" \
293                "</Contact>" \
294            "</contacts>" \
295        "</ABContactDelete>"
296
[7f34ce2]297int msn_soap_addressbook_request( struct im_connection *ic );
[4452e69]298int msn_soap_addressbook_set_display_name( struct im_connection *ic, const char *new );
[4fc95c5]299int msn_soap_ab_contact_add( struct im_connection *ic, bee_user_t *bu );
300int msn_soap_ab_contact_del( struct im_connection *ic, bee_user_t *bu );
[7f34ce2]301
[80175a1]302
303#define SOAP_STORAGE_URL "https://storage.msn.com/storageservice/SchematizedStore.asmx"
304#define SOAP_PROFILE_GET_ACTION "http://www.msn.com/webservices/storage/w10/GetProfile"
305
306#define SOAP_PROFILE_GET_PAYLOAD \
307"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
308"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
309  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
310    "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
311      "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
312      "<Scenario>Initial</Scenario>" \
313    "</StorageApplicationHeader>" \
314    "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
315      "<Puid>0</Puid>" \
316      "<TicketToken>%s</TicketToken>" \
317    "</StorageUserHeader>" \
318  "</soap:Header>" \
319  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
320    "<GetProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
321      "<profileHandle>" \
322        "<Alias>" \
323          "<Name>%s</Name>" \
324          "<NameSpace>MyCidStuff</NameSpace>" \
325        "</Alias>" \
326        "<RelationshipName>MyProfile</RelationshipName>" \
327      "</profileHandle>" \
328      "<profileAttributes>" \
329        "<ResourceID>true</ResourceID>" \
330        "<DateModified>true</DateModified>" \
331        "<ExpressionProfileAttributes>" \
332          "<ResourceID>true</ResourceID>" \
333          "<DateModified>true</DateModified>" \
334          "<DisplayName>true</DisplayName>" \
335          "<DisplayNameLastModified>true</DisplayNameLastModified>" \
336          "<PersonalStatus>true</PersonalStatus>" \
337          "<PersonalStatusLastModified>true</PersonalStatusLastModified>" \
338          "<StaticUserTilePublicURL>true</StaticUserTilePublicURL>" \
339          "<Photo>true</Photo>" \
340          "<Flags>true</Flags>" \
341        "</ExpressionProfileAttributes>" \
342      "</profileAttributes>" \
343    "</GetProfile>" \
344  "</soap:Body>" \
345"</soap:Envelope>"
346
347int msn_soap_profile_get( struct im_connection *ic, const char *cid );
348
349
[e5a8118]350#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.