aboutsummaryrefslogtreecommitdiffstats
path: root/cookie.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:45:29 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:45:29 +0000
commit2945f70be161735bf7efaefde43125a9ad3a4c88 (patch)
treeda85d4bca39cba5a7c4e6714c8b73d6a8cd547fe /cookie.c
parentReleasing debian version 0.5.2-10 (diff)
downloadw3m-2945f70be161735bf7efaefde43125a9ad3a4c88.tar.gz
w3m-2945f70be161735bf7efaefde43125a9ad3a4c88.zip
Releasing debian version 0.5.3-1debian/0.5.3-1
Diffstat (limited to '')
-rw-r--r--cookie.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/cookie.c b/cookie.c
index 1b64e40..8020f6d 100644
--- a/cookie.c
+++ b/cookie.c
@@ -1,4 +1,4 @@
-/* $Id: cookie.c,v 1.10 2006/12/10 10:53:22 inu Exp $ */
+/* $Id: cookie.c,v 1.11 2010/07/26 11:38:53 htrb Exp $ */
/*
* References for version 0 cookie:
@@ -258,6 +258,30 @@ char *special_domain[] = {
};
int
+check_avoid_wrong_number_of_dots_domain( Str domain )
+{
+ TextListItem *tl;
+ int avoid_wrong_number_of_dots_domain = FALSE;
+
+ if (Cookie_avoid_wrong_number_of_dots_domains &&
+ Cookie_avoid_wrong_number_of_dots_domains->nitem > 0) {
+ for (tl = Cookie_avoid_wrong_number_of_dots_domains->first;
+ tl != NULL; tl = tl->next) {
+ if (domain_match(domain->ptr, tl->ptr)) {
+ avoid_wrong_number_of_dots_domain = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (avoid_wrong_number_of_dots_domain == TRUE) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+int
add_cookie(ParsedURL *pu, Str name, Str value,
time_t expires, Str domain, Str path,
int flag, Str comment, int version, Str port, Str commentURL)
@@ -304,7 +328,9 @@ add_cookie(ParsedURL *pu, Str name, Str value,
domain->ptr + domain->length,
3);
if (n < 2) {
- COOKIE_ERROR(COO_ESPECIAL);
+ if (! check_avoid_wrong_number_of_dots_domain(domain)) {
+ COOKIE_ERROR(COO_ESPECIAL);
+ }
}
else if (n == 2) {
char **sdomain;
@@ -315,8 +341,9 @@ add_cookie(ParsedURL *pu, Str name, Str value,
strcasecmp(*sdomain, &domain->ptr[offset]) == 0)
ok = 1;
}
- if (!ok)
+ if (!ok && ! check_avoid_wrong_number_of_dots_domain(domain)) {
COOKIE_ERROR(COO_ESPECIAL);
+ }
}
}
else {