| 41 *response = auth; |
42 *response = auth; |
| 42 return JABBER_SASL_STATE_CONTINUE; |
43 return JABBER_SASL_STATE_CONTINUE; |
| 43 } |
44 } |
| 44 |
45 |
| 45 /* Parts of this algorithm are inspired by stuff in libgsasl */ |
46 /* Parts of this algorithm are inspired by stuff in libgsasl */ |
| 46 static GHashTable* parse_challenge(const char *challenge) |
47 GHashTable* jabber_auth_digest_md5_parse(const char *challenge) |
| 47 { |
48 { |
| 48 const char *token_start, *val_start, *val_end, *cur; |
49 const char *token_start, *val_start, *val_end, *cur; |
| 49 GHashTable *ret = g_hash_table_new_full(g_str_hash, g_str_equal, |
50 GHashTable *ret = g_hash_table_new_full(g_str_hash, g_str_equal, |
| 50 g_free, g_free); |
51 g_free, g_free); |
| 51 |
52 |
| 184 purple_debug_misc("jabber", "decoded challenge (%" |
185 purple_debug_misc("jabber", "decoded challenge (%" |
| 185 G_GSIZE_FORMAT "): %s\n", |
186 G_GSIZE_FORMAT "): %s\n", |
| 186 dec_in != NULL ? strlen(dec_in) : 0, |
187 dec_in != NULL ? strlen(dec_in) : 0, |
| 187 dec_in != NULL ? dec_in : "(null)"); |
188 dec_in != NULL ? dec_in : "(null)"); |
| 188 |
189 |
| 189 parts = parse_challenge(dec_in); |
190 parts = jabber_auth_digest_md5_parse(dec_in); |
| 190 |
191 |
| 191 if (g_hash_table_lookup(parts, "rspauth")) { |
192 if (g_hash_table_lookup(parts, "rspauth")) { |
| 192 char *rspauth = g_hash_table_lookup(parts, "rspauth"); |
193 char *rspauth = g_hash_table_lookup(parts, "rspauth"); |
| 193 char *expected_rspauth = js->auth_mech_data; |
194 char *expected_rspauth = js->auth_mech_data; |
| 194 |
195 |