Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/nexus.c @ 23513:1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
also uses a callback to signify that the token has been updated.
Note: The updating does not actually work yet, but this commit is so
that the next two updates will compile.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 07 Jun 2008 06:08:01 +0000 |
parents | d756a0477c06 |
children | 9fdf0accd4aa |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file nexus.c MSN Nexus functions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15823 | 4 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15823 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19653
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "msn.h" |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
25 #include "soap2.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "nexus.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "notification.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
29 /************************************************************************** |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
30 * Valid Ticket Tokens |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
31 **************************************************************************/ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
32 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
33 #define SSO_VALID_TICKET_DOMAIN 0 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
34 #define SSO_VALID_TICKET_POLICY 1 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
35 static char *ticket_domains[][2] = { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
36 /* http://msnpiki.msnfanatic.com/index.php/MSNP15:SSO */ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
37 /* {"Domain", "Policy Ref URI"}, Purpose */ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
38 {"messengerclear.live.com", NULL}, /* Authentication for messenger. */ |
23497
b268fc2c9121
References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23495
diff
changeset
|
39 {"messenger.msn.com", "?id=507"}, /* Authentication for receiving OIMs. */ |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
40 {"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */ |
23497
b268fc2c9121
References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23495
diff
changeset
|
41 {"messengersecure.live.com", "MBI_SSL"}, /* Authentication for sending OIMs. */ |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
42 {"spaces.live.com", "MBI"}, /* Authentication for the Windows Live Spaces */ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
43 {"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
44 {"storage.live.com", "MBI"}, /* Storage REST API */ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
45 }; |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
46 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 * Main |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 MsnNexus * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 msn_nexus_new(MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 MsnNexus *nexus; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
55 int i; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 nexus = g_new0(MsnNexus, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 nexus->session = session; |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
59 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
60 nexus->token_len = sizeof(ticket_domains) / sizeof(char *[2]); |
23500
f182cf94145c
zero out this, side effect is not crashing when password is incorrect
Ka-Hing Cheung <khc@hxbc.us>
parents:
23498
diff
changeset
|
61 nexus->tokens = g_new0(MsnTicketToken, nexus->token_len); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
62 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
63 for (i = 0; i < nexus->token_len; i++) |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
64 nexus->tokens[i].token = g_hash_table_new_full(g_str_hash, g_str_equal, |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
65 g_free, g_free); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 return nexus; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 msn_nexus_destroy(MsnNexus *nexus) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 { |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
73 int i; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
74 for (i = 0; i < nexus->token_len; i++) { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
75 g_hash_table_destroy(nexus->tokens[i].token); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
76 g_free(nexus->tokens[i].secret); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
77 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
78 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
79 g_free(nexus->tokens); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
80 g_free(nexus->policy); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
81 g_free(nexus->nonce); |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
82 g_free(nexus->cipher); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
83 g_free(nexus->secret); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
84 g_free(nexus); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
85 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
86 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
87 /************************************************************************** |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
88 * RPS/SSO Authentication |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
89 **************************************************************************/ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
90 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
91 static char * |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
92 rps_create_key(const char *key, int key_len, const char *data, size_t data_len) |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
93 { |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
94 const guchar magic[] = "WS-SecureConversation"; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
95 const int magic_len = sizeof(magic) - 1; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
96 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
97 PurpleCipherContext *hmac; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
98 guchar hash1[20], hash2[20], hash3[20], hash4[20]; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
99 char *result; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
100 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
101 hmac = purple_cipher_context_new_by_name("hmac", NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
102 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
103 purple_cipher_context_set_option(hmac, "hash", "sha1"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
104 purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
105 purple_cipher_context_append(hmac, magic, magic_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
106 purple_cipher_context_append(hmac, (guchar *)data, data_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
107 purple_cipher_context_digest(hmac, sizeof(hash1), hash1, NULL); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
108 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
109 purple_cipher_context_reset(hmac, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
110 purple_cipher_context_set_option(hmac, "hash", "sha1"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
111 purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
112 purple_cipher_context_append(hmac, hash1, 20); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
113 purple_cipher_context_append(hmac, magic, magic_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
114 purple_cipher_context_append(hmac, (guchar *)data, data_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
115 purple_cipher_context_digest(hmac, sizeof(hash2), hash2, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
116 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
117 purple_cipher_context_reset(hmac, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
118 purple_cipher_context_set_option(hmac, "hash", "sha1"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
119 purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
120 purple_cipher_context_append(hmac, hash1, 20); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
121 purple_cipher_context_digest(hmac, sizeof(hash3), hash3, NULL); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
122 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
123 purple_cipher_context_reset(hmac, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
124 purple_cipher_context_set_option(hmac, "hash", "sha1"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
125 purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
126 purple_cipher_context_append(hmac, hash3, sizeof(hash3)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
127 purple_cipher_context_append(hmac, magic, magic_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
128 purple_cipher_context_append(hmac, (guchar *)data, data_len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
129 purple_cipher_context_digest(hmac, sizeof(hash4), hash4, NULL); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
130 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
131 purple_cipher_context_destroy(hmac); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
132 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
133 result = g_malloc(24); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
134 memcpy(result, hash2, sizeof(hash2)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
135 memcpy(result + sizeof(hash2), hash4, 4); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
136 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
137 return result; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
138 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
139 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
140 static char * |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
141 des3_cbc(const char *key, const char *iv, const char *data, int len, gboolean decrypt) |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
142 { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
143 PurpleCipherContext *des3; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
144 char *out; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
145 size_t outlen; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
147 des3 = purple_cipher_context_new_by_name("des3", NULL); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
148 purple_cipher_context_set_key(des3, (guchar *)key); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
149 purple_cipher_context_set_batch_mode(des3, PURPLE_CIPHER_BATCH_MODE_CBC); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
150 purple_cipher_context_set_iv(des3, (guchar *)iv, 8); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
151 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
152 out = g_malloc(len); |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
153 if (decrypt) |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
154 purple_cipher_context_decrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
155 else |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
156 purple_cipher_context_encrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
157 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
158 purple_cipher_context_destroy(des3); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
159 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
160 return out; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
161 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
162 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
163 #define CRYPT_MODE_CBC 1 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
164 #define CIPHER_TRIPLE_DES 0x6603 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
165 #define HASH_SHA1 0x8004 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
166 static char * |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
167 msn_rps_encrypt(MsnNexus *nexus) |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
168 { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
169 MsnUsrKey *usr_key; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
170 const char magic1[] = "SESSION KEY HASH"; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
171 const char magic2[] = "SESSION KEY ENCRYPTION"; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
172 PurpleCipherContext *hmac; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
173 size_t len; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
174 guchar hash[20]; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
175 char *key1, *key2, *key3; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
176 gsize key1_len; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
177 int *iv; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
178 char *nonce_fixed; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
179 char *cipher; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
180 char *response; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
181 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
182 usr_key = g_malloc(sizeof(MsnUsrKey)); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
183 usr_key->size = GUINT32_TO_LE(28); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
184 usr_key->crypt_mode = GUINT32_TO_LE(CRYPT_MODE_CBC); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
185 usr_key->cipher_type = GUINT32_TO_LE(CIPHER_TRIPLE_DES); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
186 usr_key->hash_type = GUINT32_TO_LE(HASH_SHA1); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
187 usr_key->iv_len = GUINT32_TO_LE(8); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
188 usr_key->hash_len = GUINT32_TO_LE(20); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
189 usr_key->cipher_len = GUINT32_TO_LE(72); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
190 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
191 key1 = (char *)purple_base64_decode((const char *)nexus->tokens[MSN_AUTH_MESSENGER].secret, &key1_len); |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
192 key2 = rps_create_key(key1, key1_len, magic1, sizeof(magic1) - 1); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
193 key3 = rps_create_key(key1, key1_len, magic2, sizeof(magic2) - 1); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
194 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
195 iv = (int *)usr_key->iv; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
196 iv[0] = rand(); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
197 iv[1] = rand(); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
198 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
199 len = strlen(nexus->nonce); |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
200 hmac = purple_cipher_context_new_by_name("hmac", NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
201 purple_cipher_context_set_option(hmac, "hash", "sha1"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
202 purple_cipher_context_set_key_with_len(hmac, (guchar *)key2, 24); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
203 purple_cipher_context_append(hmac, (guchar *)nexus->nonce, len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
204 purple_cipher_context_digest(hmac, 20, hash, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
205 purple_cipher_context_destroy(hmac); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
206 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
207 /* We need to pad this to 72 bytes, apparently */ |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
208 nonce_fixed = g_malloc(len + 8); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
209 memcpy(nonce_fixed, nexus->nonce, len); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
210 memset(nonce_fixed + len, 0x08, 8); |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
211 cipher = des3_cbc(key3, usr_key->iv, nonce_fixed, len + 8, FALSE); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
212 g_free(nonce_fixed); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
213 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
214 memcpy(usr_key->hash, hash, 20); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
215 memcpy(usr_key->cipher, cipher, 72); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
216 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
217 g_free(key1); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
218 g_free(key2); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
219 g_free(key3); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
220 g_free(cipher); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
221 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
222 response = purple_base64_encode((guchar *)usr_key, sizeof(MsnUsrKey)); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
223 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
224 g_free(usr_key); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
225 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
226 return response; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 * Login |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 **************************************************************************/ |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
232 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
233 /* Used to specify which token to update when only doing single updates */ |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
234 typedef struct _MsnNexusUpdateData MsnNexusUpdateData; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
235 struct _MsnNexusUpdateData { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
236 MsnNexus *nexus; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
237 int id; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
238 GSourceFunc cb; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
239 gpointer data; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
240 }; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
241 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
242 static void |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
243 save_tokens(GHashTable *table, const char *str) |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
244 { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
245 char **elems, **cur, **tokens; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
246 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
247 elems = g_strsplit(str, "&", 0); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
248 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
249 for (cur = elems; *cur != NULL; cur++) { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
250 tokens = g_strsplit(*cur, "=", 2); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
251 g_hash_table_insert(table, tokens[0], tokens[1]); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
252 /* Don't free each of the tokens, only the array. */ |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
253 g_free(tokens); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
254 } |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
255 g_strfreev(elems); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
256 } |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
257 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
258 static gboolean |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
259 nexus_parse_response(MsnNexus *nexus, int id, xmlnode *xml) |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
260 { |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
261 xmlnode *node; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
262 xmlnode *cipher; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
263 xmlnode *secret; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
264 char *data; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
265 gboolean result = FALSE; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
266 gboolean parse_all = (id == -1); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
267 |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
268 node = xmlnode_get_child(xml, "Body/RequestSecurityTokenResponseCollection/RequestSecurityTokenResponse"); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
269 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
270 if (!node) |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
271 return FALSE; |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
272 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
273 /* The first node contains the stuff for updating tokens. */ |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
274 cipher = xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
275 nexus->cipher = xmlnode_get_data(cipher); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
276 secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
277 data = xmlnode_get_data(secret); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
278 nexus->secret = (char *)purple_base64_decode(data, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
279 g_free(data); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
280 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
281 for (node = node->next; node; node = node->next) { |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
282 xmlnode *token = xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken"); |
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
283 xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); |
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
284 xmlnode *expires = xmlnode_get_child(node, "LifeTime/Expires"); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
285 |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
286 if (token) { |
23495
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
287 char *token_str, *expiry_str; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
288 const char *id_str = xmlnode_get_attrib(token, "Id"); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
289 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
290 if (id_str == NULL) continue; |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
291 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
292 if (parse_all) |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
293 id = atol(id_str + 7) - 1; /* 'Compact#' or 'PPToken#' */ |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
294 if (id >= nexus->token_len) |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
295 continue; /* Where did this come from? */ |
20531 | 296 |
23495
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
297 token_str = xmlnode_get_data(token); |
20531 | 298 if (token_str == NULL) continue; |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
299 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
300 save_tokens(nexus->tokens[id].token, token_str); |
20531 | 301 g_free(token_str); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
302 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
303 if (secret) |
23495
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
304 nexus->tokens[id].secret = xmlnode_get_data(secret); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
305 else |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
306 nexus->tokens[id].secret = NULL; |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
307 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
308 /* Yay for MS using ISO-8601 */ |
23495
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
309 expiry_str = xmlnode_get_data(expires); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
310 |
23495
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
311 nexus->tokens[id].expiry = purple_str_to_time(expiry_str, |
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
312 FALSE, NULL, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 |
23495
b82a17934604
fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents:
23492
diff
changeset
|
314 g_free(expiry_str); |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
315 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
316 purple_debug_info("msnp15", "Updated ticket for domain '%s'\n", |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
317 ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
318 result = TRUE; |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
319 } |
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
320 } |
20531 | 321 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
322 return result; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
323 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
324 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
325 static void |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
326 nexus_got_response_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
327 { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
328 MsnNexus *nexus = data; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
329 MsnSession *session = nexus->session; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
330 const char *ticket; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
331 char *response; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
332 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
333 if (resp == NULL) { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
334 msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Unable to connect")); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
335 return; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
336 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
337 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
338 if (!nexus_parse_response(nexus, -1, resp->xml)) { |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
339 msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Invalid response")); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
340 return; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
341 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
342 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
343 ticket = msn_nexus_get_token_str(nexus, MSN_AUTH_MESSENGER); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
344 response = msn_rps_encrypt(nexus); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
345 msn_got_login_params(session, ticket, response); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
346 g_free(response); |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
347 } |
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
348 |
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
349 /*when connect, do the SOAP Style windows Live ID authentication */ |
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
350 void |
20532
10d27a4be2fd
removed lots of commented out old soap code
Ka-Hing Cheung <khc@hxbc.us>
parents:
20531
diff
changeset
|
351 msn_nexus_connect(MsnNexus *nexus) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 { |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
353 MsnSession *session = nexus->session; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
354 const char *username; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
355 char *password; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
356 GString *domains; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
357 char *request; |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
358 int i; |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
359 |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
360 MsnSoapMessage *soap; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
362 purple_debug_info("MSN Nexus","Starting Windows Live ID authentication\n"); |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
363 msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); |
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
16078
diff
changeset
|
364 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
365 username = purple_account_get_username(session->account); |
21286
b2e646507c18
Use only the first 16 characters of the password, and plug a leak.
Ka-Hing Cheung <khc@hxbc.us>
parents:
21162
diff
changeset
|
366 password = g_strndup(purple_connection_get_password(session->account->gc), 16); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
368 purple_debug_info("msnp15", "Logging on %s, with policy '%s', nonce '%s'\n", |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
369 username, nexus->policy, nexus->nonce); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
371 domains = g_string_new(NULL); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
372 for (i = 0; i < nexus->token_len; i++) { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
373 g_string_append_printf(domains, MSN_SSO_RST_TEMPLATE, |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
374 i+1, |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
375 ticket_domains[i][SSO_VALID_TICKET_DOMAIN], |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
376 ticket_domains[i][SSO_VALID_TICKET_POLICY] != NULL ? |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
377 ticket_domains[i][SSO_VALID_TICKET_POLICY] : |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
378 nexus->policy); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
381 request = g_strdup_printf(MSN_SSO_TEMPLATE, username, password, domains->str); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
382 g_free(password); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
383 g_string_free(domains, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
385 soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
386 g_free(request); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
387 msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
388 nexus_got_response_cb, nexus); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
389 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
391 static void |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
392 nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
393 { |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
394 MsnNexusUpdateData *ud = data; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
395 MsnNexus *nexus = ud->nexus; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
396 char iv[8] = {0,0,0,0,0,0,0,0}; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
397 xmlnode *enckey; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
398 char *tmp; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
399 char *nonce; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
400 gsize len; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
401 char *key; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
402 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
403 char *decrypted_pp; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
404 char *decrypted_data; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
405 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
406 purple_debug_info("msnp15", "Got Update Response for %s.\n", ticket_domains[ud->id][SSO_VALID_TICKET_DOMAIN]); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
407 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
408 enckey = xmlnode_get_child(resp->xml, "Header/Security/DerivedKeyToken"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
409 while (enckey) { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
410 if (g_str_equal(xmlnode_get_attrib(enckey, "Id"), "EncKey")) |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
411 break; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
412 enckey = xmlnode_get_next_twin(enckey); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
413 } |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
414 if (!enckey) { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
415 purple_debug_info("msnp15", "Invalid Response.\n"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
416 return; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
417 } |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
418 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
419 tmp = xmlnode_get_data(xmlnode_get_child(enckey, "Nonce")); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
420 nonce = (char *)purple_base64_decode(tmp, &len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
421 key = rps_create_key(nexus->secret, 24, nonce, len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
422 g_free(tmp); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
423 g_free(nonce); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
424 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
425 tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
426 "Header/EncryptedPP/EncryptedData/CipherData/CipherValue")); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
427 if (tmp) { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
428 /* Don't know what this is for yet */ |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
429 decrypted_pp = des3_cbc(key, iv, tmp, len, TRUE); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
430 g_free(tmp); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
431 purple_debug_info("msnp15", "Got Response Header EncryptedPP: %s\n", decrypted_pp); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
432 g_free(decrypted_pp); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
433 } |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
434 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
435 tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
436 "Body/EncryptedData/CipherData/CipherValue")); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
437 if (tmp) { |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
438 char *unescaped; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
439 xmlnode *rstresponse; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
440 unescaped = (char *)purple_base64_decode(tmp, &len); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
441 g_free(tmp); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
442 decrypted_data = des3_cbc(key, iv, unescaped, len, TRUE); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
443 g_free(unescaped); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
444 rstresponse = xmlnode_from_str(decrypted_data, -1); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
445 g_hash_table_remove_all(nexus->tokens[ud->id].token); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
446 save_tokens(nexus->tokens[ud->id].token, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
447 xmlnode_get_data(xmlnode_get_child(rstresponse, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
448 "RequestSecurityTokenResponse/RequestedSecurityToken/BinarySecurityToken"))); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
449 purple_debug_info("msnp15", "Got Response Body EncryptedData: %s\n", decrypted_data); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
450 g_free(decrypted_data); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
451 } |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
452 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
453 if (ud->cb) |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
454 purple_timeout_add(0, ud->cb, ud->data); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
455 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
456 g_free(ud); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
459 void |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
460 msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data) |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
461 { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
462 MsnSession *session = nexus->session; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
463 MsnNexusUpdateData *ud; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
464 PurpleCipherContext *sha1; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
465 PurpleCipherContext *hmac; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
466 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
467 char *key; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
468 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
469 guchar digest[20]; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
470 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
471 struct tm *tm; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
472 time_t now; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
473 char *now_str; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
474 char *timestamp; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
475 char *timestamp_b64; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
476 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
477 char *domain; |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
478 char *domain_b64; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
479 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
480 char *signedinfo; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
481 gint32 nonce[6]; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
482 int i; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
483 char *nonce_b64; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
484 char *signature_b64; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
485 guchar signature[20]; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
486 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
487 char *request; |
20530
719ce4acfcb9
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@hxbc.us>
parents:
20514
diff
changeset
|
488 MsnSoapMessage *soap; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
490 purple_debug_info("msnp15", |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
491 "Updating ticket for user '%s' on domain '%s'\n", |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
492 purple_account_get_username(session->account), |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
493 ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
495 ud = g_new0(MsnNexusUpdateData, 1); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
496 ud->nexus = nexus; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
497 ud->id = id; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
498 ud->cb = cb; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
499 ud->data = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
501 sha1 = purple_cipher_context_new_by_name("sha1", NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
502 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
503 domain = g_strdup_printf(MSN_SSO_RST_TEMPLATE, |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
504 0, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
505 ticket_domains[id][SSO_VALID_TICKET_DOMAIN], |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
506 ticket_domains[id][SSO_VALID_TICKET_POLICY] != NULL ? |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
507 ticket_domains[id][SSO_VALID_TICKET_POLICY] : |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
508 nexus->policy); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
509 purple_cipher_context_append(sha1, (guchar *)domain, strlen(domain)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
510 purple_cipher_context_digest(sha1, 20, digest, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
511 domain_b64 = purple_base64_encode(digest, 20); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
512 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
513 now = time(NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
514 tm = gmtime(&now); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
515 now_str = g_strdup(purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
516 now += 5*60; |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
517 tm = gmtime(&now); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
518 timestamp = g_strdup_printf(MSN_SSO_TIMESTAMP_TEMPLATE, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
519 now_str, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
520 purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
521 purple_cipher_context_reset(sha1, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
522 purple_cipher_context_append(sha1, (guchar *)timestamp, strlen(timestamp)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
523 purple_cipher_context_digest(sha1, 20, digest, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
524 timestamp_b64 = purple_base64_encode(digest, 20); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
525 g_free(now_str); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
526 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
527 purple_cipher_context_destroy(sha1); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
528 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
529 signedinfo = g_strdup_printf(MSN_SSO_SIGNEDINFO_TEMPLATE, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
530 domain_b64, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
531 timestamp_b64); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
533 for (i = 0; i < 6; i++) |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
534 nonce[i] = rand(); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
535 nonce_b64 = purple_base64_encode((guchar *)&nonce, sizeof(nonce)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
536 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
537 key = rps_create_key(nexus->secret, 24, (char *)nonce, sizeof(nonce)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
538 hmac = purple_cipher_context_new_by_name("hmac", NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
539 purple_cipher_context_set_option(hmac, "hash", "sha1"); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
540 purple_cipher_context_set_key_with_len(hmac, (guchar *)key, 24); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
541 purple_cipher_context_append(hmac, (guchar *)signedinfo, strlen(signedinfo)); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
542 purple_cipher_context_digest(hmac, 20, signature, NULL); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
543 purple_cipher_context_destroy(hmac); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
544 signature_b64 = purple_base64_encode(signature, 20); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
545 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
546 request = g_strdup_printf(MSN_SSO_TOKEN_UPDATE_TEMPLATE, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
547 nexus->cipher, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
548 nonce_b64, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
549 timestamp, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
550 signedinfo, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
551 signature_b64, |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
552 domain); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
553 |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
554 g_free(nonce_b64); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
555 g_free(domain_b64); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
556 g_free(timestamp_b64); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
557 g_free(timestamp); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
558 g_free(key); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
559 g_free(signature_b64); |
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
560 g_free(signedinfo); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
561 g_free(domain); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
563 soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
564 g_free(request); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
565 msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
566 nexus_got_update_cb, ud); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
569 GHashTable * |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
570 msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id) |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
571 { |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
572 g_return_val_if_fail(nexus != NULL, NULL); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
573 g_return_val_if_fail(id < nexus->token_len, NULL); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
574 |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
575 return nexus->tokens[id].token; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
576 } |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
577 |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
578 const char * |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
579 msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id) |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
580 { |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
581 static char buf[1024]; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
582 GHashTable *token = msn_nexus_get_token(nexus, id); |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
583 const char *msn_t; |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
584 const char *msn_p; |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
585 gint ret; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
586 |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
587 g_return_val_if_fail(token != NULL, NULL); |
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
588 |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
589 msn_t = g_hash_table_lookup(token, "t"); |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
590 msn_p = g_hash_table_lookup(token, "p"); |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
591 |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
592 g_return_val_if_fail(msn_t != NULL, NULL); |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
593 g_return_val_if_fail(msn_p != NULL, NULL); |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
594 |
23513
1b98e2090a71
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23506
diff
changeset
|
595 ret = g_snprintf(buf, sizeof(buf) - 1, "t=%s&p=%s", msn_t, msn_p); |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
596 g_return_val_if_fail(ret != -1, NULL); |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
597 |
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23489
diff
changeset
|
598 return buf; |
23489
25899ec348a4
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21594
diff
changeset
|
599 } |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
600 |