Mercurial > pidgin.yaz
comparison src/protocols/jabber/auth.c @ 7106:db6bd3e794d8
[gaim-migrate @ 7671]
tobase16(), frombase16(), tobase64(), frombase64() -> gaim_base16_encode(),
gaim_base16_decode(), gaim_base64_encode(), gaim_base64_decode().
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 01 Oct 2003 05:56:58 +0000 |
parents | 67c4e9d39242 |
children | e9867cdeb0fd |
comparison
equal
deleted
inserted
replaced
7105:9d0e74b6ca68 | 7106:db6bd3e794d8 |
---|---|
213 | 213 |
214 md5_init(&ctx); | 214 md5_init(&ctx); |
215 md5_append(&ctx, a1, strlen(a1)); | 215 md5_append(&ctx, a1, strlen(a1)); |
216 md5_finish(&ctx, result); | 216 md5_finish(&ctx, result); |
217 | 217 |
218 ha1 = tobase16(result, 16); | 218 ha1 = gaim_base16_encode(result, 16); |
219 | 219 |
220 md5_init(&ctx); | 220 md5_init(&ctx); |
221 md5_append(&ctx, a2, strlen(a2)); | 221 md5_append(&ctx, a2, strlen(a2)); |
222 md5_finish(&ctx, result); | 222 md5_finish(&ctx, result); |
223 | 223 |
224 ha2 = tobase16(result, 16); | 224 ha2 = gaim_base16_encode(result, 16); |
225 | 225 |
226 kd = g_strdup_printf("%s:%s:00000001:%s:auth:%s", ha1, nonce, cnonce, ha2); | 226 kd = g_strdup_printf("%s:%s:00000001:%s:auth:%s", ha1, nonce, cnonce, ha2); |
227 | 227 |
228 md5_init(&ctx); | 228 md5_init(&ctx); |
229 md5_append(&ctx, kd, strlen(kd)); | 229 md5_append(&ctx, kd, strlen(kd)); |
230 md5_finish(&ctx, result); | 230 md5_finish(&ctx, result); |
231 | 231 |
232 z = tobase16(result, 16); | 232 z = gaim_base16_encode(result, 16); |
233 | 233 |
234 g_free(x); | 234 g_free(x); |
235 g_free(y); | 235 g_free(y); |
236 g_free(a1); | 236 g_free(a1); |
237 g_free(ha1); | 237 g_free(ha1); |
247 char *enc_in = xmlnode_get_data(packet); | 247 char *enc_in = xmlnode_get_data(packet); |
248 char *dec_in; | 248 char *dec_in; |
249 char *enc_out; | 249 char *enc_out; |
250 GHashTable *parts; | 250 GHashTable *parts; |
251 | 251 |
252 frombase64(enc_in, &dec_in, NULL); | 252 gaim_base64_decode(enc_in, &dec_in, NULL); |
253 | 253 |
254 parts = parse_challenge(dec_in); | 254 parts = parse_challenge(dec_in); |
255 | 255 |
256 /* we're actually supposed to prompt the user for a realm if | 256 /* we're actually supposed to prompt the user for a realm if |
257 * the server doesn't send one, but that really complicates things, | 257 * the server doesn't send one, but that really complicates things, |
297 gaim_account_get_username(js->gc->account)); | 297 gaim_account_get_username(js->gc->account)); |
298 | 298 |
299 g_free(auth_resp); | 299 g_free(auth_resp); |
300 g_free(cnonce); | 300 g_free(cnonce); |
301 | 301 |
302 enc_out = tobase64(response->str, response->len); | 302 enc_out = gaim_base64_encode(response->str, response->len); |
303 | 303 |
304 gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str); | 304 gaim_debug(GAIM_DEBUG_MISC, "jabber", "decoded response (%d): %s\n", response->len, response->str); |
305 | 305 |
306 buf = g_strdup_printf("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>", enc_out); | 306 buf = g_strdup_printf("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>%s</response>", enc_out); |
307 | 307 |