diff options
author | portix <none@none> | 2013-02-14 13:14:11 +0100 |
---|---|---|
committer | portix <none@none> | 2013-02-14 13:14:11 +0100 |
commit | bc933d6e87a4421101be6121b27cab252ccaf7fd (patch) | |
tree | b7916d36d21bc6ae72505d2ac8535ea9a4152bec /src/soup.c | |
parent | 02d1b0549a11697832b5b15ea66caeb67f04d57f (diff) | |
download | dwb-bc933d6e87a4421101be6121b27cab252ccaf7fd.zip |
Fixing check for supercookies if a cookie domain starts with a dot
Diffstat (limited to 'src/soup.c')
-rw-r--r-- | src/soup.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -280,22 +280,25 @@ dwb_soup_cookie_changed_cb(SoupCookieJar *jar, SoupCookie *old, SoupCookie *new, if (new) { /* Check if this is a super-cookie */ - if (new->domain) { - const char *base; - base = domain_get_tld(new->domain); - - /* If base is NULL, that means we're trying to set the cookie - * on a TLD (e.g. ".com", ".co.uk", ".c.jp", ".pref.kyoto.jp") - */ - if (base == NULL) { + if (new->domain) + { + const char *base = new->domain; + + if (*base == '.') + base++; + + if (domain_is_tld(base)) + { fprintf(stderr, "Site tried to set super-cookie @ TLD %s (base %s)\n", new->domain, base); return; } } - if (dwb.state.cookie_store_policy == COOKIE_STORE_PERSISTENT || dwb_soup_test_cookie_allowed(dwb.fc.cookies_allow, new)) { + if (dwb.state.cookie_store_policy == COOKIE_STORE_PERSISTENT || dwb_soup_test_cookie_allowed(dwb.fc.cookies_allow, new)) + { soup_cookie_jar_add_cookie(s_pers_jar, soup_cookie_copy(new)); - } else + } + else { soup_cookie_jar_add_cookie(s_tmp_jar, soup_cookie_copy(new)); |