~lericson/bitlbee/mek-ft

« back to all changes in this revision

Viewing changes to protocols/msn/passport.h

  • Committer: Ludvig Ericson
  • Date: 2008-02-19 13:56:56 UTC
  • mfrom: (167.1.169 devel)
  • Revision ID: toxik@odin.valhall-20080219135656-l3m1nii3sbtbm4n9
Merge devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __PASSPORT_H__
2
 
#define __PASSPORT_H__
3
1
/* passport.h
4
2
 *
5
 
 * Functions to login to Microsoft Passport Service for Messenger
6
 
 * Copyright (C) 2004 Wouter Paesen <wouter@blue-gate.be>,
7
 
 *                    Wilmer van der Gaast <wilmer@gaast.net>
 
3
 * Functions to login to Microsoft Passport service for Messenger
 
4
 * Copyright (C) 2004-2008 Wilmer van der Gaast <wilmer@gaast.net>
8
5
 *
9
6
 * This program is free software; you can redistribute it and/or modify             
10
7
 * it under the terms of the GNU General Public License version 2                   
17
14
 *                                                                                   
18
15
 * You should have received a copy of the GNU General Public License                
19
16
 * along with this program; if not, write to the Free Software                      
20
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA          
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA          
21
18
 */
22
19
 
 
20
/* Thanks to http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener
 
21
   for the specs! */
 
22
 
 
23
#ifndef __PASSPORT_H__
 
24
#define __PASSPORT_H__
 
25
 
23
26
#include <stdio.h>
24
27
#include <stdlib.h>
25
28
#include <string.h>
32
35
#endif
33
36
#include "nogaim.h"
34
37
 
35
 
struct passport_reply
 
38
#define MAX_PASSPORT_PWLEN 16
 
39
 
 
40
struct msn_auth_data
36
41
{
37
 
        void (*func)( struct passport_reply * );
38
 
        void *data;
39
 
        char *result;
40
 
        char *header;
41
 
        char *error_string;
 
42
        char *url;
 
43
        int ttl;
 
44
        
 
45
        char *username;
 
46
        char *password;
 
47
        char *cookie;
 
48
        
 
49
        /* The end result, the only thing we'll really be interested in
 
50
           once finished. */
 
51
        char *token;
 
52
        char *error; /* Yeah, or that... */
 
53
        
 
54
        void (*callback)( struct msn_auth_data *mad );
 
55
        gpointer data;
42
56
};
43
57
 
44
 
int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie );
 
58
#define SOAP_AUTHENTICATION_URL "https://loginnet.passport.com/RST.srf"
 
59
 
 
60
#define SOAP_AUTHENTICATION_REQUEST \
 
61
"POST %s HTTP/1.0\r\n" \
 
62
"Accept: text/*\r\n" \
 
63
"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
 
64
"Host: %s\r\n" \
 
65
"Content-Length: %d\r\n" \
 
66
"Cache-Control: no-cache\r\n" \
 
67
"\r\n" \
 
68
"%s"
 
69
 
 
70
#define SOAP_AUTHENTICATION_PAYLOAD \
 
71
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
 
72
"<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\">" \
 
73
  "<Header>" \
 
74
    "<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">" \
 
75
      "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
 
76
      "<ps:BinaryVersion>4</ps:BinaryVersion>" \
 
77
      "<ps:UIVersion>1</ps:UIVersion>" \
 
78
      "<ps:Cookies></ps:Cookies>" \
 
79
      "<ps:RequestParams>AQAAAAIAAABsYwQAAAAzMDg0</ps:RequestParams>" \
 
80
    "</ps:AuthInfo>" \
 
81
    "<wsse:Security>" \
 
82
       "<wsse:UsernameToken Id=\"user\">" \
 
83
         "<wsse:Username>%s</wsse:Username>" \
 
84
         "<wsse:Password>%s</wsse:Password>" \
 
85
       "</wsse:UsernameToken>" \
 
86
    "</wsse:Security>" \
 
87
  "</Header>" \
 
88
  "<Body>" \
 
89
    "<ps:RequestMultipleSecurityTokens xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"RSTS\">" \
 
90
      "<wst:RequestSecurityToken Id=\"RST0\">" \
 
91
        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
 
92
        "<wsp:AppliesTo>" \
 
93
          "<wsa:EndpointReference>" \
 
94
            "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
 
95
          "</wsa:EndpointReference>" \
 
96
        "</wsp:AppliesTo>" \
 
97
      "</wst:RequestSecurityToken>" \
 
98
      "<wst:RequestSecurityToken Id=\"RST1\">" \
 
99
       "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
 
100
        "<wsp:AppliesTo>" \
 
101
          "<wsa:EndpointReference>" \
 
102
            "<wsa:Address>messenger.msn.com</wsa:Address>" \
 
103
          "</wsa:EndpointReference>" \
 
104
        "</wsp:AppliesTo>" \
 
105
        "<wsse:PolicyReference URI=\"?%s\"></wsse:PolicyReference>" \
 
106
      "</wst:RequestSecurityToken>" \
 
107
    "</ps:RequestMultipleSecurityTokens>" \
 
108
  "</Body>" \
 
109
"</Envelope>"
 
110
 
 
111
int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie );
45
112
 
46
113
#endif /* __PASSPORT_H__ */