libpurple/protocols/jabber/auth_digest_md5.c

changeset 31394
dd9b4ed08d0a
parent 30857
1a7e2da2ab01
child 31395
c47def35b008
equal deleted inserted replaced
31391:a2b7431453e4 31394:dd9b4ed08d0a
25 #include "debug.h" 25 #include "debug.h"
26 #include "cipher.h" 26 #include "cipher.h"
27 #include "util.h" 27 #include "util.h"
28 #include "xmlnode.h" 28 #include "xmlnode.h"
29 29
30 #include "auth_digest_md5.h"
30 #include "auth.h" 31 #include "auth.h"
31 #include "jabber.h" 32 #include "jabber.h"
32 33
33 static JabberSaslState 34 static JabberSaslState
34 digest_md5_start(JabberStream *js, xmlnode *packet, xmlnode **response, 35 digest_md5_start(JabberStream *js, xmlnode *packet, xmlnode **response,
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

mercurial