comparison src/protocols/simple/simple.c @ 12563:b7f7f3a685ea

[gaim-migrate @ 14882] Fix an "off by one" parsing error when parsing the nonce token. I haven't actually tested this, but this should hopefully fix bug #1385135. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 19 Dec 2005 15:17:19 +0000
parents 3aaa3236386d
children 3f895385e841
comparison
equal deleted inserted replaced
12562:e3b4abe7e0f8 12563:b7f7f3a685ea
340 } 340 }
341 341
342 auth->type = 1; 342 auth->type = 1;
343 parts = g_strsplit(hdr, " ", 0); 343 parts = g_strsplit(hdr, " ", 0);
344 while(parts[i]) { 344 while(parts[i]) {
345 if(!strncmp(parts[i],"nonce",5)) { 345 if(!strncmp(parts[i], "nonce", 5)) {
346 auth->nonce = g_strndup(parts[i]+7,strlen(parts[i]+7)-1); 346 auth->nonce = g_strndup(parts[i]+7,strlen(parts[i]+7)-2);
347 } 347 }
348 if(!strncmp(parts[i],"realm",5)) { 348 else if(!strncmp(parts[i], "realm", 5)) {
349 auth->realm = g_strndup(parts[i]+7,strlen(parts[i]+7)-2); 349 auth->realm = g_strndup(parts[i]+7,strlen(parts[i]+7)-2);
350 } 350 }
351 i++; 351 i++;
352 } 352 }
353 g_strfreev(parts); 353 g_strfreev(parts);
514 } 514 }
515 515
516 if(addheaders) addh=addheaders; 516 if(addheaders) addh=addheaders;
517 if(sip->registrar.type && !strcmp(method,"REGISTER")) { 517 if(sip->registrar.type && !strcmp(method,"REGISTER")) {
518 buf = auth_header(sip, &sip->registrar, method, url); 518 buf = auth_header(sip, &sip->registrar, method, url);
519 auth = g_strdup_printf("Authorization: %s",buf); 519 auth = g_strdup_printf("Authorization: %s", buf);
520 g_free(buf); 520 g_free(buf);
521 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth); 521 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
522 } 522 }
523 523
524 if(sip->proxy.type && strcmp(method,"REGISTER")) { 524 if(sip->proxy.type && strcmp(method,"REGISTER")) {
525 buf = auth_header(sip, &sip->proxy, method, url); 525 buf = auth_header(sip, &sip->proxy, method, url);
526 auth = g_strdup_printf("Proxy-Authorization: %s",buf); 526 auth = g_strdup_printf("Proxy-Authorization: %s", buf);
527 g_free(buf); 527 g_free(buf);
528 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth); 528 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
529 } 529 }
530 530
531 if(!sip->ip || !strcmp(sip->ip,"0.0.0.0")) { /* if there was no known ip retry now */ 531 if(!sip->ip || !strcmp(sip->ip,"0.0.0.0")) { /* if there was no known ip retry now */