comparison libpurple/protocols/simple/simple.c @ 17144:ff7dea1672b3

disapproval of revision '1e0f6c89bdf3a21258ac4f64039122a909ac67cc'
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 18 May 2007 01:46:51 +0000
parents 97a98ceb5c06
children 2ea3c46a63fe
comparison
equal deleted inserted replaced
17143:97a98ceb5c06 17144:ff7dea1672b3
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\"", 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\"\r\n", 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\"", auth->opaque, auth->realm, auth->target, ret); 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);
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=\"\"", auth->realm, auth->target); 291 tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"\r\n", 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\"", 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\"\r\n", 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\r\n", buf); 633 auth = g_strdup_printf("Authorization: %s", 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 } else if(sip->proxy.type && strcmp(method, "REGISTER")) { 636 }
637
638 if(sip->proxy.type && strcmp(method, "REGISTER")) {
637 buf = auth_header(sip, &sip->proxy, method, url); 639 buf = auth_header(sip, &sip->proxy, method, url);
638 auth = g_strdup_printf("Proxy-Authorization: %s\r\n", buf); 640 auth = g_strdup_printf("Proxy-Authorization: %s", buf);
639 g_free(buf); 641 g_free(buf);
640 purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); 642 purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth);
641 } 643 }
642 644
643 if (!dialog) 645 if (!dialog)
980 } 982 }
981 983
982 state = xmlnode_get_child(isc, "state"); 984 state = xmlnode_get_child(isc, "state");
983 985
984 if(!state) { 986 if(!state) {
985 purple_debug_info("simple", "process_incoming_message: no state found\n"); 987 purple_debug_info("simple", "process_incoming_message: no state found\n");
986 xmlnode_free(isc); 988 xmlnode_free(isc);
987 return; 989 return;
988 } 990 }
989 991
990 statedata = xmlnode_get_data(state); 992 statedata = xmlnode_get_data(state);
991 if(statedata) { 993 if(statedata) {