# HG changeset patch # User Luke Schierer # Date 1074699742 0 # Node ID d5dbb02d28376e0cb6b9e1e529c83b6a46159856 # Parent a0b7039de507cfcae7bd4c84c38000e2b87ec76b [gaim-migrate @ 8873] "Subject: [Gaim-devel] Yahoo (web auth) login fix We're going to need some more milk." --Tim Ringenbach committer: Tailor Script diff -r a0b7039de507 -r d5dbb02d2837 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Wed Jan 21 05:34:32 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Wed Jan 21 15:42:22 2004 +0000 @@ -1917,38 +1917,28 @@ GaimConnection *gc = data; GaimAccount *account = gaim_connection_get_account(gc); struct yahoo_data *yd = gc->proto_data; - char buf[1024], buf2[256], *i = buf, *r = buf2, *rend; - int len, o = 0; + char buf[1024], *i = buf; + int len; + GString *s; len = read(source, buf, sizeof(buf)-1); if (len <= 0 || strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302"))) { gaim_connection_error(gc, _("Unable to read")); return; } + + s = g_string_sized_new(len); buf[sizeof(buf)-1] = '\0'; - buf2[0] = '\0'; - rend = r + sizeof(buf2); - - while ((i = strstr(i, "Set-Cookie: ")) && o < 2) { - i += strlen("Set-Cookie: "); - for (;*i != ';' && r < rend; r++, i++) { - *r = *i; - } - if (r >= rend-2) { - *r = '\0'; - r = buf2; - } - *r=';'; - r++; - *r=' '; - r++; - o++; + + while ((i = strstr(i, "Set-Cookie: "))) { + i += strlen("Set-Cookie: "); + for (;*i != ';'; i++) + g_string_append_c(s, *i); + + g_string_append(s, "; "); } - /* Get rid of that "; " */ - if (r > buf2) { - *(r-2) = '\0'; - } - yd->auth = g_strdup(buf2); + + yd->auth = g_string_free(s, FALSE); gaim_input_remove(gc->inpa); close(source); /* Now we have our cookies to login with. I'll go get the milk. */