Mercurial > pidgin
changeset 8161:d5dbb02d2837
[gaim-migrate @ 8873]
"Subject: [Gaim-devel] Yahoo (web auth) login fix
We're going to need some more milk."
--Tim Ringenbach
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 21 Jan 2004 15:42:22 +0000 |
parents | a0b7039de507 |
children | 3273ff25b645 |
files | src/protocols/yahoo/yahoo.c |
diffstat | 1 files changed, 14 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- 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. */