Ignore:
Timestamp:
2008-02-17T11:16:01Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9186d15
Parents:
4bbcba3
Message:

Replaced old MSN Passport (v1.4) authentication code with what's described on
http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener . This was an
attempt to fix bug #360, but it didn't. However, this change may make BitlBee
a little bit more future-proof. Plus, the code is tidier and sometimes faster
than the old mechanism.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/passport.h

    r4bbcba3 re6648bf  
    1 #ifndef __PASSPORT_H__
    2 #define __PASSPORT_H__
    31/* passport.h
    42 *
    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>
    85 *
    96 * This program is free software; you can redistribute it and/or modify             
     
    1815 * You should have received a copy of the GNU General Public License               
    1916 * 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         
    2118 */
     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__
    2225
    2326#include <stdio.h>
     
    3336#include "nogaim.h"
    3437
    35 struct passport_reply
     38struct msn_auth_data
    3639{
    37         void (*func)( struct passport_reply * );
    38         void *data;
    39         char *result;
    40         char *header;
    41         char *error_string;
     40        char *url;
     41        int ttl;
     42       
     43        char *username;
     44        char *password;
     45        char *cookie;
     46       
     47        /* The end result, the only thing we'll really be interested in
     48           once finished. */
     49        char *token;
     50        char *error; /* Yeah, or that... */
     51       
     52        void (*callback)( struct msn_auth_data *mad );
     53        gpointer data;
    4254};
    4355
    44 int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie );
     56#define SOAP_AUTHENTICATION_URL "https://loginnet.passport.com/RST.srf"
     57
     58#define SOAP_AUTHENTICATION_REQUEST \
     59"POST %s HTTP/1.0\r\n" \
     60"Accept: text/*\r\n" \
     61"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
     62"Host: %s\r\n" \
     63"Content-Length: %d\r\n" \
     64"Cache-Control: no-cache\r\n" \
     65"\r\n" \
     66"%s"
     67
     68#define SOAP_AUTHENTICATION_PAYLOAD \
     69"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
     70"<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\">" \
     71  "<Header>" \
     72    "<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">" \
     73      "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
     74      "<ps:BinaryVersion>4</ps:BinaryVersion>" \
     75      "<ps:UIVersion>1</ps:UIVersion>" \
     76      "<ps:Cookies></ps:Cookies>" \
     77      "<ps:RequestParams>AQAAAAIAAABsYwQAAAAzMDg0</ps:RequestParams>" \
     78    "</ps:AuthInfo>" \
     79    "<wsse:Security>" \
     80       "<wsse:UsernameToken Id=\"user\">" \
     81         "<wsse:Username>%s</wsse:Username>" \
     82         "<wsse:Password>%s</wsse:Password>" \
     83       "</wsse:UsernameToken>" \
     84    "</wsse:Security>" \
     85  "</Header>" \
     86  "<Body>" \
     87    "<ps:RequestMultipleSecurityTokens xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"RSTS\">" \
     88      "<wst:RequestSecurityToken Id=\"RST0\">" \
     89        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
     90        "<wsp:AppliesTo>" \
     91          "<wsa:EndpointReference>" \
     92            "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
     93          "</wsa:EndpointReference>" \
     94        "</wsp:AppliesTo>" \
     95      "</wst:RequestSecurityToken>" \
     96      "<wst:RequestSecurityToken Id=\"RST1\">" \
     97       "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
     98        "<wsp:AppliesTo>" \
     99          "<wsa:EndpointReference>" \
     100            "<wsa:Address>messenger.msn.com</wsa:Address>" \
     101          "</wsa:EndpointReference>" \
     102        "</wsp:AppliesTo>" \
     103        "<wsse:PolicyReference URI=\"?%s\"></wsse:PolicyReference>" \
     104      "</wst:RequestSecurityToken>" \
     105    "</ps:RequestMultipleSecurityTokens>" \
     106  "</Body>" \
     107"</Envelope>"
     108
     109int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie );
    45110
    46111#endif /* __PASSPORT_H__ */
Note: See TracChangeset for help on using the changeset viewer.