Mon, 28 Feb 2011 07:12:27 +0000
Fix a memleak in the MSN prpl when removing a buddy from your buddy list.
We needed to call msn_user_unref() after calling msn_userlist_remove_user()
I chose to fix this by changing msn_userlist_add_user() and
msn_userlist_remove_user() to incremend and decrement the reference counter
themselves--after all, they ARE the ones who add/remove a reference to
the MsnUser struct. Conceptually I thought this made the most sense.
|
9198
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
1 | /** |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
2 | * @file nexus.c MSN Nexus functions |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
3 | * |
| 15884 | 4 | * purple |
|
9198
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
5 | * |
| 15884 | 6 | * Purple is the legal property of its developers, whose names are too numerous |
|
9198
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
8 | * source distribution. |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
9 | * |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
10 | * This program is free software; you can redistribute it and/or modify |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
12 | * the Free Software Foundation; either version 2 of the License, or |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
13 | * (at your option) any later version. |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
14 | * |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
15 | * This program is distributed in the hope that it will be useful, |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
18 | * GNU General Public License for more details. |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
19 | * |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
21 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
9198
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9193
diff
changeset
|
23 | */ |
|
30945
b875cf477e19
Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
29642
diff
changeset
|
24 | |
|
30961
885064b16c54
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
30945
diff
changeset
|
25 | #include "internal.h" |
|
30945
b875cf477e19
Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
29642
diff
changeset
|
26 | #include "cipher.h" |
|
b875cf477e19
Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
29642
diff
changeset
|
27 | #include "debug.h" |
|
b875cf477e19
Remove unnecesary includes from msn.h.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
29642
diff
changeset
|
28 | |
|
23819
c3bbef4646b1
Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23805
diff
changeset
|
29 | #include "soap.h" |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
30 | #include "nexus.h" |
|
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
31 | #include "notification.h" |
|
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
32 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
33 | /************************************************************************** |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
34 | * Valid Ticket Tokens |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
35 | **************************************************************************/ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
36 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
37 | #define SSO_VALID_TICKET_DOMAIN 0 |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
38 | #define SSO_VALID_TICKET_POLICY 1 |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
39 | static char *ticket_domains[][2] = { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
40 | /* http://msnpiki.msnfanatic.com/index.php/MSNP15:SSO */ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
41 | /* {"Domain", "Policy Ref URI"}, Purpose */ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
42 | {"messengerclear.live.com", NULL}, /* Authentication for messenger. */ |
|
23764
a20c976bf63f
References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23762
diff
changeset
|
43 | {"messenger.msn.com", "?id=507"}, /* Authentication for receiving OIMs. */ |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
44 | {"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */ |
|
23764
a20c976bf63f
References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23762
diff
changeset
|
45 | {"messengersecure.live.com", "MBI_SSL"}, /* Authentication for sending OIMs. */ |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
46 | {"spaces.live.com", "MBI"}, /* Authentication for the Windows Live Spaces */ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
47 | {"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
48 | {"storage.live.com", "MBI"}, /* Storage REST API */ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
49 | }; |
| 13907 | 50 | |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
51 | /************************************************************************** |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
52 | * Main |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
53 | **************************************************************************/ |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
54 | |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
55 | MsnNexus * |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
56 | msn_nexus_new(MsnSession *session) |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
57 | { |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
58 | MsnNexus *nexus; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
59 | int i; |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
60 | |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
61 | nexus = g_new0(MsnNexus, 1); |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
62 | nexus->session = session; |
| 13855 | 63 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
64 | nexus->token_len = sizeof(ticket_domains) / sizeof(char *[2]); |
|
23767
99a6b7205637
zero out this, side effect is not crashing when password is incorrect
Ka-Hing Cheung <khc@pidgin.im>
parents:
23765
diff
changeset
|
65 | nexus->tokens = g_new0(MsnTicketToken, nexus->token_len); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
66 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
67 | for (i = 0; i < nexus->token_len; i++) |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
68 | nexus->tokens[i].token = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
69 | g_free, g_free); |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
70 | |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
71 | return nexus; |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
72 | } |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
73 | |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
74 | void |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
75 | msn_nexus_destroy(MsnNexus *nexus) |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
76 | { |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
77 | int i; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
78 | for (i = 0; i < nexus->token_len; i++) { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
79 | g_hash_table_destroy(nexus->tokens[i].token); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
80 | g_free(nexus->tokens[i].secret); |
|
25613
77fac33acbdf
Add a missed g_slist_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25596
diff
changeset
|
81 | g_slist_free(nexus->tokens[i].updates); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
82 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
83 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
84 | g_free(nexus->tokens); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
85 | g_free(nexus->policy); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
86 | g_free(nexus->nonce); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
87 | g_free(nexus->cipher); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
88 | g_free(nexus->secret); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
89 | g_free(nexus); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
90 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
91 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
92 | /************************************************************************** |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
93 | * RPS/SSO Authentication |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
94 | **************************************************************************/ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
95 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
96 | static char * |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
97 | rps_create_key(const char *key, int key_len, const char *data, size_t data_len) |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
98 | { |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
99 | const guchar magic[] = "WS-SecureConversation"; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
100 | const int magic_len = sizeof(magic) - 1; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
101 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
102 | PurpleCipherContext *hmac; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
103 | guchar hash1[20], hash2[20], hash3[20], hash4[20]; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
104 | char *result; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
105 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
106 | hmac = purple_cipher_context_new_by_name("hmac", NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
107 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
108 | purple_cipher_context_set_option(hmac, "hash", "sha1"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
109 | purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
110 | purple_cipher_context_append(hmac, magic, magic_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
111 | purple_cipher_context_append(hmac, (guchar *)data, data_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
112 | purple_cipher_context_digest(hmac, sizeof(hash1), hash1, NULL); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
113 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
114 | purple_cipher_context_reset(hmac, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
115 | purple_cipher_context_set_option(hmac, "hash", "sha1"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
116 | purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
117 | purple_cipher_context_append(hmac, hash1, 20); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
118 | purple_cipher_context_append(hmac, magic, magic_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
119 | purple_cipher_context_append(hmac, (guchar *)data, data_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
120 | purple_cipher_context_digest(hmac, sizeof(hash2), hash2, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
121 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
122 | purple_cipher_context_reset(hmac, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
123 | purple_cipher_context_set_option(hmac, "hash", "sha1"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
124 | purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
125 | purple_cipher_context_append(hmac, hash1, 20); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
126 | purple_cipher_context_digest(hmac, sizeof(hash3), hash3, NULL); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
127 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
128 | purple_cipher_context_reset(hmac, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
129 | purple_cipher_context_set_option(hmac, "hash", "sha1"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
130 | purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
131 | purple_cipher_context_append(hmac, hash3, sizeof(hash3)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
132 | purple_cipher_context_append(hmac, magic, magic_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
133 | purple_cipher_context_append(hmac, (guchar *)data, data_len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
134 | purple_cipher_context_digest(hmac, sizeof(hash4), hash4, NULL); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
135 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
136 | purple_cipher_context_destroy(hmac); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
137 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
138 | result = g_malloc(24); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
139 | memcpy(result, hash2, sizeof(hash2)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
140 | memcpy(result + sizeof(hash2), hash4, 4); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
141 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
142 | return result; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
143 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
144 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
145 | static char * |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
146 | des3_cbc(const char *key, const char *iv, const char *data, int len, gboolean decrypt) |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
147 | { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
148 | PurpleCipherContext *des3; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
149 | char *out; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
150 | size_t outlen; |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
151 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
152 | des3 = purple_cipher_context_new_by_name("des3", NULL); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
153 | purple_cipher_context_set_key(des3, (guchar *)key); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
154 | purple_cipher_context_set_batch_mode(des3, PURPLE_CIPHER_BATCH_MODE_CBC); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
155 | purple_cipher_context_set_iv(des3, (guchar *)iv, 8); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
156 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
157 | out = g_malloc(len); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
158 | if (decrypt) |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
159 | purple_cipher_context_decrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
160 | else |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
161 | purple_cipher_context_encrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
162 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
163 | purple_cipher_context_destroy(des3); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
164 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
165 | return out; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
166 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
167 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
168 | #define CRYPT_MODE_CBC 1 |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
169 | #define CIPHER_TRIPLE_DES 0x6603 |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
170 | #define HASH_SHA1 0x8004 |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
171 | static char * |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
172 | msn_rps_encrypt(MsnNexus *nexus) |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
173 | { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
174 | MsnUsrKey *usr_key; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
175 | const char magic1[] = "SESSION KEY HASH"; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
176 | const char magic2[] = "SESSION KEY ENCRYPTION"; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
177 | PurpleCipherContext *hmac; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
178 | size_t len; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
179 | guchar hash[20]; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
180 | char *key1, *key2, *key3; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
181 | gsize key1_len; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
182 | int *iv; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
183 | char *nonce_fixed; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
184 | char *cipher; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
185 | char *response; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
186 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
187 | usr_key = g_malloc(sizeof(MsnUsrKey)); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
188 | usr_key->size = GUINT32_TO_LE(28); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
189 | usr_key->crypt_mode = GUINT32_TO_LE(CRYPT_MODE_CBC); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
190 | usr_key->cipher_type = GUINT32_TO_LE(CIPHER_TRIPLE_DES); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
191 | usr_key->hash_type = GUINT32_TO_LE(HASH_SHA1); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
192 | usr_key->iv_len = GUINT32_TO_LE(8); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
193 | usr_key->hash_len = GUINT32_TO_LE(20); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
194 | usr_key->cipher_len = GUINT32_TO_LE(72); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
195 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
196 | key1 = (char *)purple_base64_decode((const char *)nexus->tokens[MSN_AUTH_MESSENGER].secret, &key1_len); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
197 | key2 = rps_create_key(key1, key1_len, magic1, sizeof(magic1) - 1); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
198 | key3 = rps_create_key(key1, key1_len, magic2, sizeof(magic2) - 1); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
199 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
200 | iv = (int *)usr_key->iv; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
201 | iv[0] = rand(); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
202 | iv[1] = rand(); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
203 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
204 | len = strlen(nexus->nonce); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
205 | hmac = purple_cipher_context_new_by_name("hmac", NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
206 | purple_cipher_context_set_option(hmac, "hash", "sha1"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
207 | purple_cipher_context_set_key_with_len(hmac, (guchar *)key2, 24); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
208 | purple_cipher_context_append(hmac, (guchar *)nexus->nonce, len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
209 | purple_cipher_context_digest(hmac, 20, hash, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
210 | purple_cipher_context_destroy(hmac); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
211 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
212 | /* We need to pad this to 72 bytes, apparently */ |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
213 | nonce_fixed = g_malloc(len + 8); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
214 | memcpy(nonce_fixed, nexus->nonce, len); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
215 | memset(nonce_fixed + len, 0x08, 8); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
216 | cipher = des3_cbc(key3, usr_key->iv, nonce_fixed, len + 8, FALSE); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
217 | g_free(nonce_fixed); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
218 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
219 | memcpy(usr_key->hash, hash, 20); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
220 | memcpy(usr_key->cipher, cipher, 72); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
221 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
222 | g_free(key1); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
223 | g_free(key2); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
224 | g_free(key3); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
225 | g_free(cipher); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
226 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
227 | response = purple_base64_encode((guchar *)usr_key, sizeof(MsnUsrKey)); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
228 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
229 | g_free(usr_key); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
230 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
231 | return response; |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
232 | } |
|
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
233 | |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
234 | /************************************************************************** |
|
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
235 | * Login |
|
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
236 | **************************************************************************/ |
|
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
237 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
238 | /* Used to specify which token to update when only doing single updates */ |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
239 | typedef struct _MsnNexusUpdateData MsnNexusUpdateData; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
240 | struct _MsnNexusUpdateData { |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
241 | MsnNexus *nexus; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
242 | int id; |
|
25596
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
243 | }; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
244 | |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
245 | typedef struct _MsnNexusUpdateCallback MsnNexusUpdateCallback; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
246 | struct _MsnNexusUpdateCallback { |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
247 | GSourceFunc cb; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
248 | gpointer data; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
249 | }; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
250 | |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
251 | static gboolean |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
252 | nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
253 | { |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
254 | char *token_str, *expiry_str; |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
255 | const char *id_str; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
256 | char **elems, **cur, **tokens; |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
257 | xmlnode *token = xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken"); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
258 | xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
259 | xmlnode *expires = xmlnode_get_child(node, "LifeTime/Expires"); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
260 | |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
261 | if (!token) |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
262 | return FALSE; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
263 | |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
264 | /* Use the ID that the server sent us */ |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
265 | if (id == -1) { |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
266 | id_str = xmlnode_get_attrib(token, "Id"); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
267 | if (id_str == NULL) |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
268 | return FALSE; |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
269 | |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
270 | id = atol(id_str + 7) - 1; /* 'Compact#' or 'PPToken#' */ |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
271 | if (id >= nexus->token_len) |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
272 | return FALSE; /* Where did this come from? */ |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
273 | } |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
274 | |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
275 | token_str = xmlnode_get_data(token); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
276 | if (token_str == NULL) |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
277 | return FALSE; |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
278 | |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
279 | g_hash_table_remove_all(nexus->tokens[id].token); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
280 | |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
281 | elems = g_strsplit(token_str, "&", 0); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
282 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
283 | for (cur = elems; *cur != NULL; cur++) { |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
284 | tokens = g_strsplit(*cur, "=", 2); |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
285 | g_hash_table_insert(nexus->tokens[id].token, tokens[0], tokens[1]); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
286 | /* Don't free each of the tokens, only the array. */ |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
287 | g_free(tokens); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
288 | } |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
289 | g_strfreev(elems); |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
290 | g_free(token_str); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
291 | |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
292 | if (secret) |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
293 | nexus->tokens[id].secret = xmlnode_get_data(secret); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
294 | else |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
295 | nexus->tokens[id].secret = NULL; |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
296 | |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
297 | /* Yay for MS using ISO-8601 */ |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
298 | expiry_str = xmlnode_get_data(expires); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
299 | nexus->tokens[id].expiry = purple_str_to_time(expiry_str, |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
300 | FALSE, NULL, NULL, NULL); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
301 | g_free(expiry_str); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
302 | |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
303 | purple_debug_info("msn", "Updated ticket for domain '%s', expires at %" G_GINT64_FORMAT ".\n", |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
304 | ticket_domains[id][SSO_VALID_TICKET_DOMAIN], |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
305 | (gint64)nexus->tokens[id].expiry); |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
306 | return TRUE; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
307 | } |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
308 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
309 | static gboolean |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
310 | nexus_parse_collection(MsnNexus *nexus, int id, xmlnode *collection) |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
311 | { |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
312 | xmlnode *node; |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
313 | gboolean result; |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
314 | |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
315 | node = xmlnode_get_child(collection, "RequestSecurityTokenResponse"); |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
316 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
317 | if (!node) |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
318 | return FALSE; |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
319 | |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
320 | result = TRUE; |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
321 | for (; node && result; node = node->next) { |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
322 | xmlnode *endpoint = xmlnode_get_child(node, "AppliesTo/EndpointReference/Address"); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
323 | char *address = xmlnode_get_data(endpoint); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
324 | |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
325 | if (g_str_equal(address, "http://Passport.NET/tb")) { |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
326 | /* This node contains the stuff for updating tokens. */ |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
327 | char *data; |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
328 | xmlnode *cipher = xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue"); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
329 | xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
330 | |
| 28636 | 331 | g_free(nexus->cipher); |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
332 | nexus->cipher = xmlnode_get_data(cipher); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
333 | data = xmlnode_get_data(secret); |
| 28636 | 334 | g_free(nexus->secret); |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
335 | nexus->secret = (char *)purple_base64_decode(data, NULL); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
336 | g_free(data); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
337 | |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
338 | } else { |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
339 | result = nexus_parse_token(nexus, id, node); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
340 | } |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
341 | g_free(address); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
342 | } |
| 21358 | 343 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
344 | return result; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
345 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
346 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
347 | static void |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
348 | nexus_got_response_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
349 | { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
350 | MsnNexus *nexus = data; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
351 | MsnSession *session = nexus->session; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
352 | const char *ticket; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
353 | char *response; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
354 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
355 | if (resp == NULL) { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
356 | msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Unable to connect")); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
357 | return; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
358 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
359 | |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
360 | if (!nexus_parse_collection(nexus, -1, |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
361 | xmlnode_get_child(resp->xml, |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
362 | "Body/RequestSecurityTokenResponseCollection"))) { |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
363 | msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Invalid response")); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
364 | return; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
365 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
366 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
367 | ticket = msn_nexus_get_token_str(nexus, MSN_AUTH_MESSENGER); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
368 | response = msn_rps_encrypt(nexus); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
369 | msn_got_login_params(session, ticket, response); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
370 | g_free(response); |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
371 | } |
|
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
372 | |
| 13859 | 373 | /*when connect, do the SOAP Style windows Live ID authentication */ |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
374 | void |
|
21359
c501751711b0
removed lots of commented out old soap code
Ka-Hing Cheung <khc@pidgin.im>
parents:
21358
diff
changeset
|
375 | msn_nexus_connect(MsnNexus *nexus) |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
376 | { |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
377 | MsnSession *session = nexus->session; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
378 | const char *username; |
|
24033
1f6d71178481
Use MIN(strlen(password), 16) for MSN because g_markup_escape_text will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23937
diff
changeset
|
379 | const char *password; |
|
1f6d71178481
Use MIN(strlen(password), 16) for MSN because g_markup_escape_text will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23937
diff
changeset
|
380 | char *password_xml; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
381 | GString *domains; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
382 | char *request; |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
383 | int i; |
| 13854 | 384 | |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
385 | MsnSoapMessage *soap; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
386 | |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
387 | purple_debug_info("msn", "Starting Windows Live ID authentication\n"); |
|
10519
80801a34a246
[gaim-migrate @ 11833]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10504
diff
changeset
|
388 | msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
389 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
390 | username = purple_account_get_username(session->account); |
|
24033
1f6d71178481
Use MIN(strlen(password), 16) for MSN because g_markup_escape_text will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23937
diff
changeset
|
391 | password = purple_connection_get_password(session->account->gc); |
|
28730
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
392 | if (g_utf8_strlen(password, -1) > 16) { |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
393 | /* max byte size for 16 utf8 characters is 64 + 1 for the null */ |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
394 | gchar truncated[65]; |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
395 | g_utf8_strncpy(truncated, password, 16); |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
396 | password_xml = g_markup_escape_text(truncated, -1); |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
397 | } else { |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
398 | password_xml = g_markup_escape_text(password, -1); |
|
b2ccebb2477b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
Mark Doliner <markdoliner@pidgin.im>
parents:
28657
diff
changeset
|
399 | } |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
400 | |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
401 | purple_debug_info("msn", "Logging on %s, with policy '%s', nonce '%s'\n", |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
402 | username, nexus->policy, nexus->nonce); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
403 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
404 | domains = g_string_new(NULL); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
405 | for (i = 0; i < nexus->token_len; i++) { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
406 | g_string_append_printf(domains, MSN_SSO_RST_TEMPLATE, |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
407 | i+1, |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
408 | ticket_domains[i][SSO_VALID_TICKET_DOMAIN], |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
409 | ticket_domains[i][SSO_VALID_TICKET_POLICY] != NULL ? |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
410 | ticket_domains[i][SSO_VALID_TICKET_POLICY] : |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
411 | nexus->policy); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
412 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
413 | |
|
24033
1f6d71178481
Use MIN(strlen(password), 16) for MSN because g_markup_escape_text will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23937
diff
changeset
|
414 | request = g_strdup_printf(MSN_SSO_TEMPLATE, username, password_xml, domains->str); |
|
1f6d71178481
Use MIN(strlen(password), 16) for MSN because g_markup_escape_text will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23937
diff
changeset
|
415 | g_free(password_xml); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
416 | g_string_free(domains, TRUE); |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
417 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
418 | soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
419 | g_free(request); |
|
23925
aa38fbc30cfb
Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23853
diff
changeset
|
420 | msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE, |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
421 | nexus_got_response_cb, nexus); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
422 | } |
|
12457
6d2633b10f1d
[gaim-migrate @ 14766]
Casey Harkins <charkins@pidgin.im>
parents:
10740
diff
changeset
|
423 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
424 | static void |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
425 | nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
426 | { |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
427 | MsnNexusUpdateData *ud = data; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
428 | MsnNexus *nexus = ud->nexus; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
429 | char iv[8] = {0,0,0,0,0,0,0,0}; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
430 | xmlnode *enckey; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
431 | char *tmp; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
432 | char *nonce; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
433 | gsize len; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
434 | char *key; |
|
25596
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
435 | GSList *updates; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
436 | |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
437 | #if 0 |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
438 | char *decrypted_pp; |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
439 | #endif |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
440 | char *decrypted_data; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
441 | |
|
25189
6901902cfca5
Do something sane if the response is NULL when updating contact tokens,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24033
diff
changeset
|
442 | if (resp == NULL) |
|
6901902cfca5
Do something sane if the response is NULL when updating contact tokens,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24033
diff
changeset
|
443 | return; |
|
6901902cfca5
Do something sane if the response is NULL when updating contact tokens,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24033
diff
changeset
|
444 | |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
445 | purple_debug_info("msn", "Got Update Response for %s.\n", ticket_domains[ud->id][SSO_VALID_TICKET_DOMAIN]); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
446 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
447 | enckey = xmlnode_get_child(resp->xml, "Header/Security/DerivedKeyToken"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
448 | while (enckey) { |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
449 | if (g_str_equal(xmlnode_get_attrib(enckey, "Id"), "EncKey")) |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
450 | break; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
451 | enckey = xmlnode_get_next_twin(enckey); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
452 | } |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
453 | if (!enckey) { |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
454 | purple_debug_error("msn", "Invalid response in token update.\n"); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
455 | return; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
456 | } |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
457 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
458 | tmp = xmlnode_get_data(xmlnode_get_child(enckey, "Nonce")); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
459 | nonce = (char *)purple_base64_decode(tmp, &len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
460 | key = rps_create_key(nexus->secret, 24, nonce, len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
461 | g_free(tmp); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
462 | g_free(nonce); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
463 | |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
464 | #if 0 |
|
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
465 | /* Don't know what this is for yet */ |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
466 | tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
467 | "Header/EncryptedPP/EncryptedData/CipherData/CipherValue")); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
468 | if (tmp) { |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
469 | decrypted_pp = des3_cbc(key, iv, tmp, len, TRUE); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
470 | g_free(tmp); |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
471 | purple_debug_info("msn", "Got Response Header EncryptedPP: %s\n", decrypted_pp); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
472 | g_free(decrypted_pp); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
473 | } |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
474 | #endif |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
475 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
476 | tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
477 | "Body/EncryptedData/CipherData/CipherValue")); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
478 | if (tmp) { |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
479 | char *unescaped; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
480 | xmlnode *rstresponse; |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
481 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
482 | unescaped = (char *)purple_base64_decode(tmp, &len); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
483 | g_free(tmp); |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
484 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
485 | decrypted_data = des3_cbc(key, iv, unescaped, len, TRUE); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
486 | g_free(unescaped); |
|
23830
1436e3de5d6c
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23819
diff
changeset
|
487 | purple_debug_info("msn", "Got Response Body EncryptedData: %s\n", decrypted_data); |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
488 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
489 | rstresponse = xmlnode_from_str(decrypted_data, -1); |
|
23805
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
490 | if (g_str_equal(rstresponse->name, "RequestSecurityTokenResponse")) |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
491 | nexus_parse_token(nexus, ud->id, rstresponse); |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
492 | else |
|
024a2801725c
Sometimes (after 24h+) when you request a MSN token update, you get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23788
diff
changeset
|
493 | nexus_parse_collection(nexus, ud->id, rstresponse); |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
494 | g_free(decrypted_data); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
495 | } |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
496 | |
|
25596
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
497 | updates = nexus->tokens[ud->id].updates; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
498 | nexus->tokens[ud->id].updates = NULL; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
499 | while (updates != NULL) { |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
500 | MsnNexusUpdateCallback *update = updates->data; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
501 | if (update->cb) |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
502 | purple_timeout_add(0, update->cb, update->data); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
503 | g_free(update); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
504 | updates = g_slist_delete_link(updates, updates); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
505 | } |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
506 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
507 | g_free(ud); |
|
28657
57fbfb8905c2
Fix a small leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
28636
diff
changeset
|
508 | g_free(key); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
509 | } |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
510 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
511 | void |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
512 | msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data) |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
513 | { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
514 | MsnSession *session = nexus->session; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
515 | MsnNexusUpdateData *ud; |
|
25596
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
516 | MsnNexusUpdateCallback *update; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
517 | PurpleCipherContext *sha1; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
518 | PurpleCipherContext *hmac; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
519 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
520 | char *key; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
521 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
522 | guchar digest[20]; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
523 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
524 | struct tm *tm; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
525 | time_t now; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
526 | char *now_str; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
527 | char *timestamp; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
528 | char *timestamp_b64; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
529 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
530 | char *domain; |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
531 | char *domain_b64; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
532 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
533 | char *signedinfo; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
534 | gint32 nonce[6]; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
535 | int i; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
536 | char *nonce_b64; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
537 | char *signature_b64; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
538 | guchar signature[20]; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
539 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
540 | char *request; |
|
21357
64a63a153c62
the new soap code finally doesn't crash on startup, still can't
Ka-Hing Cheung <khc@pidgin.im>
parents:
20597
diff
changeset
|
541 | MsnSoapMessage *soap; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
542 | |
|
25596
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
543 | update = g_new0(MsnNexusUpdateCallback, 1); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
544 | update->cb = cb; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
545 | update->data = data; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
546 | |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
547 | if (nexus->tokens[id].updates != NULL) { |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
548 | /* Update already in progress. Just add to list and return. */ |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
549 | purple_debug_info("msn", |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
550 | "Ticket update for user '%s' on domain '%s' in progress. Adding request to queue.\n", |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
551 | purple_account_get_username(session->account), |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
552 | ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
553 | nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates, |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
554 | update); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
555 | return; |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
556 | } else { |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
557 | purple_debug_info("msn", |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
558 | "Updating ticket for user '%s' on domain '%s'\n", |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
559 | purple_account_get_username(session->account), |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
560 | ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
561 | nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates, |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
562 | update); |
|
a0155035f7f0
I was hoping this wouldn't be necessary, but it seems that the possibility
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25189
diff
changeset
|
563 | } |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
564 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
565 | ud = g_new0(MsnNexusUpdateData, 1); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
566 | ud->nexus = nexus; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
567 | ud->id = id; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
568 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
569 | sha1 = purple_cipher_context_new_by_name("sha1", NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
570 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
571 | domain = g_strdup_printf(MSN_SSO_RST_TEMPLATE, |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
572 | id, |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
573 | ticket_domains[id][SSO_VALID_TICKET_DOMAIN], |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
574 | ticket_domains[id][SSO_VALID_TICKET_POLICY] != NULL ? |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
575 | ticket_domains[id][SSO_VALID_TICKET_POLICY] : |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
576 | nexus->policy); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
577 | purple_cipher_context_append(sha1, (guchar *)domain, strlen(domain)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
578 | purple_cipher_context_digest(sha1, 20, digest, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
579 | domain_b64 = purple_base64_encode(digest, 20); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
580 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
581 | now = time(NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
582 | tm = gmtime(&now); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
583 | now_str = g_strdup(purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
584 | now += 5*60; |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
585 | tm = gmtime(&now); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
586 | timestamp = g_strdup_printf(MSN_SSO_TIMESTAMP_TEMPLATE, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
587 | now_str, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
588 | purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
589 | purple_cipher_context_reset(sha1, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
590 | purple_cipher_context_append(sha1, (guchar *)timestamp, strlen(timestamp)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
591 | purple_cipher_context_digest(sha1, 20, digest, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
592 | timestamp_b64 = purple_base64_encode(digest, 20); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
593 | g_free(now_str); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
594 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
595 | purple_cipher_context_destroy(sha1); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
596 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
597 | signedinfo = g_strdup_printf(MSN_SSO_SIGNEDINFO_TEMPLATE, |
|
23788
b5ab3fd1c440
Finally got MSN token updating working (I think).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23780
diff
changeset
|
598 | id, |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
599 | domain_b64, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
600 | timestamp_b64); |
|
10481
a5d6b8e1717d
[gaim-migrate @ 11769]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
10345
diff
changeset
|
601 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
602 | for (i = 0; i < 6; i++) |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
603 | nonce[i] = rand(); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
604 | nonce_b64 = purple_base64_encode((guchar *)&nonce, sizeof(nonce)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
605 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
606 | key = rps_create_key(nexus->secret, 24, (char *)nonce, sizeof(nonce)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
607 | hmac = purple_cipher_context_new_by_name("hmac", NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
608 | purple_cipher_context_set_option(hmac, "hash", "sha1"); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
609 | purple_cipher_context_set_key_with_len(hmac, (guchar *)key, 24); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
610 | purple_cipher_context_append(hmac, (guchar *)signedinfo, strlen(signedinfo)); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
611 | purple_cipher_context_digest(hmac, 20, signature, NULL); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
612 | purple_cipher_context_destroy(hmac); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
613 | signature_b64 = purple_base64_encode(signature, 20); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
614 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
615 | request = g_strdup_printf(MSN_SSO_TOKEN_UPDATE_TEMPLATE, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
616 | nexus->cipher, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
617 | nonce_b64, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
618 | timestamp, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
619 | signedinfo, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
620 | signature_b64, |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
621 | domain); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
622 | |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
623 | g_free(nonce_b64); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
624 | g_free(domain_b64); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
625 | g_free(timestamp_b64); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
626 | g_free(timestamp); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
627 | g_free(key); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
628 | g_free(signature_b64); |
|
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
629 | g_free(signedinfo); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
630 | g_free(domain); |
|
12457
6d2633b10f1d
[gaim-migrate @ 14766]
Casey Harkins <charkins@pidgin.im>
parents:
10740
diff
changeset
|
631 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
632 | soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
633 | g_free(request); |
|
23925
aa38fbc30cfb
Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23853
diff
changeset
|
634 | msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE, |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
635 | nexus_got_update_cb, ud); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12457
diff
changeset
|
636 | } |
|
8171
c3c43a25caec
[gaim-migrate @ 8884]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
diff
changeset
|
637 | |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
638 | GHashTable * |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
639 | msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id) |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
640 | { |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
641 | g_return_val_if_fail(nexus != NULL, NULL); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
642 | g_return_val_if_fail(id < nexus->token_len, NULL); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
643 | |
|
23759
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
644 | return nexus->tokens[id].token; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
645 | } |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
646 | |
|
23759
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
647 | const char * |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
648 | msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id) |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
649 | { |
|
23759
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
650 | static char buf[1024]; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
651 | GHashTable *token = msn_nexus_get_token(nexus, id); |
|
23759
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
652 | const char *msn_t; |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
653 | const char *msn_p; |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
654 | gint ret; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
655 | |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
656 | g_return_val_if_fail(token != NULL, NULL); |
|
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
657 | |
|
23759
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
658 | msn_t = g_hash_table_lookup(token, "t"); |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
659 | msn_p = g_hash_table_lookup(token, "p"); |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
660 | |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
661 | g_return_val_if_fail(msn_t != NULL, NULL); |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
662 | g_return_val_if_fail(msn_p != NULL, NULL); |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
663 | |
|
23780
fda6e23ac6f6
Update MSN nexus functions so that tokens are properly updateable. It
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23773
diff
changeset
|
664 | ret = g_snprintf(buf, sizeof(buf) - 1, "t=%s&p=%s", msn_t, msn_p); |
|
23759
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
665 | g_return_val_if_fail(ret != -1, NULL); |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
666 | |
|
1abf46eeccec
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@pidgin.im>
parents:
23756
diff
changeset
|
667 | return buf; |
|
23756
1569608cab71
Patch 2 from Qulogic, this one adds SSO authentication
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21679
diff
changeset
|
668 | } |
|
23765
8a43c0d4a095
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23764
diff
changeset
|
669 |