Mercurial > pidgin.yaz
comparison libpurple/protocols/simple/simple.c @ 17146:2ea3c46a63fe
Fix an extra \r\n in the Authorization header. Fixes #965.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 18 May 2007 01:51:35 +0000 |
parents | ff7dea1672b3 |
children | 2e4e3c3028ae |
comparison
equal
deleted
inserted
replaced
17145:9a31b7628022 | 17146:2ea3c46a63fe |
---|---|
275 response = purple_cipher_http_digest_calculate_response( | 275 response = purple_cipher_http_digest_calculate_response( |
276 "md5", method, target, NULL, NULL, | 276 "md5", method, target, NULL, NULL, |
277 auth->nonce, noncecount, NULL, auth->digest_session_key); | 277 auth->nonce, noncecount, NULL, auth->digest_session_key); |
278 purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); | 278 purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); |
279 | 279 |
280 ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"\r\n", authuser, auth->realm, auth->nonce, target, noncecount, response); | 280 ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); |
281 g_free(response); | 281 g_free(response); |
282 return ret; | 282 return ret; |
283 } else if(auth->type == 2) { /* NTLM */ | 283 } else if(auth->type == 2) { /* NTLM */ |
284 if(auth->nc == 3 && auth->nonce) { | 284 if(auth->nc == 3 && auth->nonce) { |
285 /* TODO: Don't hardcode "purple" as the hostname */ | 285 /* TODO: Don't hardcode "purple" as the hostname */ |
286 ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags); | 286 ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags); |
287 tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"\r\n", auth->opaque, auth->realm, auth->target, ret); | 287 tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"", auth->opaque, auth->realm, auth->target, ret); |
288 g_free(ret); | 288 g_free(ret); |
289 return tmp; | 289 return tmp; |
290 } | 290 } |
291 tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"\r\n", auth->realm, auth->target); | 291 tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"", auth->realm, auth->target); |
292 return tmp; | 292 return tmp; |
293 } | 293 } |
294 | 294 |
295 sprintf(noncecount, "%08d", auth->nc++); | 295 sprintf(noncecount, "%08d", auth->nc++); |
296 response = purple_cipher_http_digest_calculate_response( | 296 response = purple_cipher_http_digest_calculate_response( |
297 "md5", method, target, NULL, NULL, | 297 "md5", method, target, NULL, NULL, |
298 auth->nonce, noncecount, NULL, auth->digest_session_key); | 298 auth->nonce, noncecount, NULL, auth->digest_session_key); |
299 purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); | 299 purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); |
300 | 300 |
301 ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"\r\n", authuser, auth->realm, auth->nonce, target, noncecount, response); | 301 ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); |
302 g_free(response); | 302 g_free(response); |
303 return ret; | 303 return ret; |
304 } | 304 } |
305 | 305 |
306 static char *parse_attribute(const char *attrname, const char *source) { | 306 static char *parse_attribute(const char *attrname, const char *source) { |
628 } | 628 } |
629 | 629 |
630 if(addheaders) addh = addheaders; | 630 if(addheaders) addh = addheaders; |
631 if(sip->registrar.type && !strcmp(method, "REGISTER")) { | 631 if(sip->registrar.type && !strcmp(method, "REGISTER")) { |
632 buf = auth_header(sip, &sip->registrar, method, url); | 632 buf = auth_header(sip, &sip->registrar, method, url); |
633 auth = g_strdup_printf("Authorization: %s", buf); | 633 auth = g_strdup_printf("Authorization: %s\r\n", buf); |
634 g_free(buf); | 634 g_free(buf); |
635 purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); | 635 purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); |
636 } | 636 } else if(sip->proxy.type && strcmp(method, "REGISTER")) { |
637 | |
638 if(sip->proxy.type && strcmp(method, "REGISTER")) { | |
639 buf = auth_header(sip, &sip->proxy, method, url); | 637 buf = auth_header(sip, &sip->proxy, method, url); |
640 auth = g_strdup_printf("Proxy-Authorization: %s", buf); | 638 auth = g_strdup_printf("Proxy-Authorization: %s\r\n", buf); |
641 g_free(buf); | 639 g_free(buf); |
642 purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); | 640 purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); |
643 } | 641 } |
644 | 642 |
645 if (!dialog) | 643 if (!dialog) |
982 } | 980 } |
983 | 981 |
984 state = xmlnode_get_child(isc, "state"); | 982 state = xmlnode_get_child(isc, "state"); |
985 | 983 |
986 if(!state) { | 984 if(!state) { |
987 purple_debug_info("simple", "process_incoming_message: no state found\n"); | 985 purple_debug_info("simple", "process_incoming_message: no state found\n"); |
988 xmlnode_free(isc); | 986 xmlnode_free(isc); |
989 return; | 987 return; |
990 } | 988 } |
991 | 989 |
992 statedata = xmlnode_get_data(state); | 990 statedata = xmlnode_get_data(state); |
993 if(statedata) { | 991 if(statedata) { |