[w3m-dev 04334] Re: w3m's bugs from bugs.debian.org
Hiroyuki Ito <[email protected]> Mon, 26 Jul 2010 20:39:27 +0900 (JST)
| Newsgroups | gmane.comp.web.w3m.devel |
|---|---|
| Message-ID | <[email protected]> |
>>> [w3m-dev 04237] [patch] cookie avoid [wrong number of dots]
>>> http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev/200705.month/4237.html
>>
>> w3m
>>
>>
>> w3m wrong number of dots
>> http://blog.goo.ne.jp/gleaning/e/0c7a996cfc8479a2527fe314ff65bcdd
>>
>> w3mdeb
>> http://easy.freespace.jp/msiz/w3m-avoid-wrong-number-of-dots.html
>>
>>
>>
>> w3m rejects valid cookies based on false assumptions
>> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=385702
>
> cookie_accept_domains cookie_avoid_wrong_number_of_dots 2
>
>
>
Index: cookie.c
===================================================================
RCS file: /cvsroot/w3m/w3m/cookie.c,v
retrieving revision 1.10
diff -u -r1.10 cookie.c
--- cookie.c 10 Dec 2006 10:53:22 -0000 1.10
+++ cookie.c 26 Jul 2010 11:36:35 -0000
@@ -258,6 +258,30 @@
};
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 @@
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 @@
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 {
Index: fm.h
===================================================================
RCS file: /cvsroot/w3m/w3m/fm.h,v
retrieving revision 1.144
diff -u -r1.144 fm.h
--- fm.h 25 Jul 2010 09:55:05 -0000 1.144
+++ fm.h 26 Jul 2010 11:36:35 -0000
@@ -1112,8 +1112,10 @@
global int accept_bad_cookie init(ACCEPT_BAD_COOKIE_DISCARD);
global char *cookie_reject_domains init(NULL);
global char *cookie_accept_domains init(NULL);
+global char *cookie_avoid_wrong_number_of_dots init(NULL);
global TextList *Cookie_reject_domains;
global TextList *Cookie_accept_domains;
+global TextList *Cookie_avoid_wrong_number_of_dots_domains;
#endif /* USE_COOKIE */
#ifdef USE_IMAGE
Index: rc.c
===================================================================
RCS file: /cvsroot/w3m/w3m/rc.c,v
retrieving revision 1.113
diff -u -r1.113 rc.c
--- rc.c 25 Jul 2010 09:55:05 -0000 1.113
+++ rc.c 26 Jul 2010 11:36:35 -0000
@@ -200,6 +200,7 @@
#define CMT_ACCEPTBADCOOKIE N_("Action to be taken on invalid cookie")
#define CMT_COOKIE_REJECT_DOMAINS N_("Domains to reject cookies from")
#define CMT_COOKIE_ACCEPT_DOMAINS N_("Domains to accept cookies from")
+#define CMT_COOKIE_AVOID_WONG_NUMBER_OF_DOTS N_("Domains to avoid [wrong number of dots]")
#endif
#define CMT_FOLLOW_REDIRECTION N_("Number of redirections to follow")
#define CMT_META_REFRESH N_("Enable processing of meta-refresh tag")
@@ -581,6 +582,9 @@
(void *)&cookie_reject_domains, CMT_COOKIE_REJECT_DOMAINS, NULL},
{"cookie_accept_domains", P_STRING, PI_TEXT,
(void *)&cookie_accept_domains, CMT_COOKIE_ACCEPT_DOMAINS, NULL},
+ {"cookie_avoid_wrong_number_of_dots", P_STRING, PI_TEXT,
+ (void *)&cookie_avoid_wrong_number_of_dots,
+ CMT_COOKIE_AVOID_WONG_NUMBER_OF_DOTS, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
#endif
@@ -1119,6 +1123,9 @@
Cookie_reject_domains = make_domain_list(cookie_reject_domains);
if (non_null(cookie_accept_domains))
Cookie_accept_domains = make_domain_list(cookie_accept_domains);
+ if (non_null(cookie_avoid_wrong_number_of_dots))
+ Cookie_avoid_wrong_number_of_dots_domains
+ = make_domain_list(cookie_avoid_wrong_number_of_dots);
}
#endif