pidgin: 5c1b1793: I was hoping this wouldn't be necessary,...
qulogic at pidgin.im
qulogic at pidgin.im
Sat Feb 14 22:15:39 EST 2009
-----------------------------------------------------------------
Revision: 5c1b1793e5a18e4e9272157a0d24d41c2d96647f
Ancestor: 2d005df3bacf16098d55c5d5c962fcae3af518ab
Author: qulogic at pidgin.im
Date: 2009-02-15T02:11:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5c1b1793e5a18e4e9272157a0d24d41c2d96647f
Modified files:
libpurple/protocols/msn/nexus.c
libpurple/protocols/msn/nexus.h
ChangeLog:
I was hoping this wouldn't be necessary, but it seems that the possibility
has increased now that we update the display name in the AB.
If two SOAP requests fail because of outdated tokens for the same server,
it's possible that the second one could fail miserably. That's because both
times, the update request would be made with the original cipher secret.
However, the response for the first request would overwrite this secret,
and the second response would attempt decryption with this new secret
instead of the original.
Now, we queue up the callbacks if a token-update is already in progress.
This results in a single update if there happens to be multiple failures at
a time, and it stops this incorrect decryption problem.
Fixes #8415.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/nexus.c 109063bcb2ba8803eb8a0ca5ee5ad45416a6758b
+++ libpurple/protocols/msn/nexus.c 9324736d30e65d90a59b72dfb571224b203770e5
@@ -235,6 +235,10 @@ struct _MsnNexusUpdateData {
struct _MsnNexusUpdateData {
MsnNexus *nexus;
int id;
+};
+
+typedef struct _MsnNexusUpdateCallback MsnNexusUpdateCallback;
+struct _MsnNexusUpdateCallback {
GSourceFunc cb;
gpointer data;
};
@@ -428,6 +432,7 @@ nexus_got_update_cb(MsnSoapMessage *req,
char *nonce;
gsize len;
char *key;
+ GSList *updates;
#if 0
char *decrypted_pp;
@@ -489,8 +494,15 @@ nexus_got_update_cb(MsnSoapMessage *req,
g_free(decrypted_data);
}
- if (ud->cb)
- purple_timeout_add(0, ud->cb, ud->data);
+ updates = nexus->tokens[ud->id].updates;
+ nexus->tokens[ud->id].updates = NULL;
+ while (updates != NULL) {
+ MsnNexusUpdateCallback *update = updates->data;
+ if (update->cb)
+ purple_timeout_add(0, update->cb, update->data);
+ g_free(update);
+ updates = g_slist_delete_link(updates, updates);
+ }
g_free(ud);
}
@@ -500,6 +512,7 @@ msn_nexus_update_token(MsnNexus *nexus,
{
MsnSession *session = nexus->session;
MsnNexusUpdateData *ud;
+ MsnNexusUpdateCallback *update;
PurpleCipherContext *sha1;
PurpleCipherContext *hmac;
@@ -526,16 +539,31 @@ msn_nexus_update_token(MsnNexus *nexus,
char *request;
MsnSoapMessage *soap;
- purple_debug_info("msn",
- "Updating ticket for user '%s' on domain '%s'\n",
- purple_account_get_username(session->account),
- ticket_domains[id][SSO_VALID_TICKET_DOMAIN]);
+ update = g_new0(MsnNexusUpdateCallback, 1);
+ update->cb = cb;
+ update->data = data;
+ if (nexus->tokens[id].updates != NULL) {
+ /* Update already in progress. Just add to list and return. */
+ purple_debug_info("msn",
+ "Ticket update for user '%s' on domain '%s' in progress. Adding request to queue.\n",
+ purple_account_get_username(session->account),
+ ticket_domains[id][SSO_VALID_TICKET_DOMAIN]);
+ nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates,
+ update);
+ return;
+ } else {
+ purple_debug_info("msn",
+ "Updating ticket for user '%s' on domain '%s'\n",
+ purple_account_get_username(session->account),
+ ticket_domains[id][SSO_VALID_TICKET_DOMAIN]);
+ nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates,
+ update);
+ }
+
ud = g_new0(MsnNexusUpdateData, 1);
ud->nexus = nexus;
ud->id = id;
- ud->cb = cb;
- ud->data = data;
sha1 = purple_cipher_context_new_by_name("sha1", NULL);
============================================================
--- libpurple/protocols/msn/nexus.h 3306b8423ecbad2f872a93fdeeb5e9e5813a4fe4
+++ libpurple/protocols/msn/nexus.h 883897035b9e94bb68d8e56415d5a3d4cd794cb1
@@ -204,6 +204,7 @@ struct _MsnTicketToken {
GHashTable *token;
char *secret;
time_t expiry;
+ GSList *updates;
};
typedef struct _MsnNexus MsnNexus;
More information about the Commits
mailing list