w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit ce3c69640106c6197f132dc27b8197c4560a6a66
parent e4ca268584e85bceae90cba25a23004c72aed896
Author: htrb <htrb>
Date:   Mon, 26 Jul 2010 11:38:53 +0000

* [w3m-dev 04237] [patch] cookie avoid [wrong number of dots]

Diffstat:
MChangeLog | 8++++++++
Mcookie.c | 31+++++++++++++++++++++++++++++--
Mfm.h | 2++
Mpo/ja.po | 142+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mpo/w3m.pot | 140+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mrc.c | 7+++++++
6 files changed, 191 insertions(+), 139 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,11 @@ +2010-07-26 d+w3m@vdr.jp + + * [w3m-dev 04237] [patch] cookie avoid [wrong number of dots] + * rc.c: Introduce option cookie_avoid_wrong_number_of_dots. + * fm.h: add global variables cookie_avoid_wrong_number_of_dots and Cookie_avoid_wrong_number_of_dots_domains. + * cookie.c (check_avoid_wrong_number_of_dots_domain): added. + (add_cookie): use check_avoid_wrong_number_of_dots_domain(). + 2010-07-26 Ito Hiroyuki <ZXB01226 at nifty.com> * acinclude.m4: define AC_W3M_SSL_DIGEST_AUTH diff --git a/cookie.c b/cookie.c @@ -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 { diff --git a/fm.h b/fm.h @@ -1112,8 +1112,10 @@ global int accept_cookie init(FALSE); 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 diff --git a/po/ja.po b/po/ja.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: w3m 0.5.2\n" "Report-Msgid-Bugs-To: satodai@w3m.jp\n" -"POT-Creation-Date: 2010-07-24 17:31+0900\n" -"PO-Revision-Date: 2010-07-24 13:50+0900\n" +"POT-Creation-Date: 2010-07-26 16:12+0900\n" +"PO-Revision-Date: 2010-07-26 16:13+0900\n" "Last-Translator: Fumitoshi UKAI <ukai@debian.or.jp>\n" "Language-Team: Japanese\n" "MIME-Version: 1.0\n" @@ -573,267 +573,271 @@ msgstr "クッキーを受け付けないドメイン" msgid "Domains to accept cookies from" msgstr "クッキーを受け付けるドメイン" -#: rc.c:204 +#: rc.c:203 +msgid "Domains to avoid [wrong number of dots]" +msgstr "[wrong number of dots] を無視するドメイン" + +#: rc.c:205 msgid "Number of redirections to follow" msgstr "従うリダイレクトの回数" -#: rc.c:205 +#: rc.c:206 msgid "Enable processing of meta-refresh tag" msgstr "meta refresh に対応する" -#: rc.c:208 +#: rc.c:209 msgid "Enable Migemo (Roma-ji search)" msgstr "Migemo(ローマ字検索)を使用する" -#: rc.c:209 +#: rc.c:210 msgid "Migemo command" msgstr "Migemoコマンド" -#: rc.c:213 +#: rc.c:214 msgid "Display charset" msgstr "表示用文字コード" -#: rc.c:214 +#: rc.c:215 msgid "Default document charset" msgstr "文書の標準の文字コード" -#: rc.c:215 +#: rc.c:216 msgid "Automatic charset detect when loading" msgstr "文書の読み込み時に文字コードの自動判定を行う" -#: rc.c:216 +#: rc.c:217 msgid "System charset" msgstr "システムの文字コード" -#: rc.c:217 +#: rc.c:218 msgid "System charset follows locale(LC_CTYPE)" msgstr "Locale(LC_CTYPE) に従ってシステムの文字コードを設定" -#: rc.c:218 +#: rc.c:219 msgid "Output halfdump with display charset" msgstr "表示用文字コードで halfdump の出力を行う" -#: rc.c:219 +#: rc.c:220 msgid "Use multi column characters" msgstr "複数カラムの文字を使う" -#: rc.c:220 +#: rc.c:221 msgid "Use combining characters" msgstr "結合文字を使う" -#: rc.c:221 +#: rc.c:222 msgid "Use double width for some Unicode characters" msgstr "ある種のUnicode文字を全角にする" -#: rc.c:222 +#: rc.c:223 msgid "Use Unicode language tags" msgstr "Unicode の言語タグを使う" -#: rc.c:223 +#: rc.c:224 msgid "Charset conversion using Unicode map" msgstr "Unicodeを介したコード変換" -#: rc.c:224 +#: rc.c:225 msgid "Charset conversion when loading" msgstr "文書の読み込み時に文字コードを変換する" -#: rc.c:225 +#: rc.c:226 msgid "Adjust search string for document charset" msgstr "検索文字列を文書の文字コードに変換する" -#: rc.c:226 +#: rc.c:227 msgid "Fix character width when conversion" msgstr "文字幅の変わる変換をしない" -#: rc.c:227 +#: rc.c:228 msgid "Use GB 12345 Unicode map instead of GB 2312's" msgstr "GB 12345 の Unicode マップを GB 2312 用に使う" -#: rc.c:228 +#: rc.c:229 msgid "Use JIS X 0201 Roman for ISO-2022-JP" msgstr "ISO-2022-JP で JIS X 0201-Roman を使う" -#: rc.c:229 +#: rc.c:230 msgid "Use JIS C 6226:1978 for ISO-2022-JP" msgstr "ISO-2022-JP で JIS C 6226:1978(旧JIS) を使う" -#: rc.c:230 +#: rc.c:231 msgid "Use JIS X 0201 Katakana" msgstr "JIS X 0201-Katakana を使う" -#: rc.c:231 +#: rc.c:232 msgid "Use JIS X 0212:1990 (Supplemental Kanji)" msgstr "JIS X 0212:1990(補助漢字) を使う" -#: rc.c:232 +#: rc.c:233 msgid "Use JIS X 0213:2000 (2000JIS)" msgstr "JIS X 0213:2000(2000JIS) を使う" -#: rc.c:233 +#: rc.c:234 msgid "Strict ISO-2022-JP/KR/CN" msgstr "厳格な ISO-2022-JP/KR/CN を使う" -#: rc.c:234 +#: rc.c:235 msgid "Treat 4 bytes char. of GB18030 as Unicode" msgstr "GB18030 の 4バイト文字を Unicode として扱う" -#: rc.c:235 +#: rc.c:236 msgid "Simple Preserve space" msgstr "単純な空白の保存" -#: rc.c:238 +#: rc.c:239 msgid "keymap file" msgstr "keymapファイル" -#: rc.c:255 +#: rc.c:256 msgid "black" msgstr "黒" -#: rc.c:256 +#: rc.c:257 msgid "red" msgstr "赤" -#: rc.c:257 +#: rc.c:258 msgid "green" msgstr "緑" -#: rc.c:258 +#: rc.c:259 msgid "yellow" msgstr "黄" -#: rc.c:259 +#: rc.c:260 msgid "blue" msgstr "青" -#: rc.c:260 +#: rc.c:261 msgid "magenta" msgstr "紫" -#: rc.c:261 +#: rc.c:262 msgid "cyan" msgstr "空色" -#: rc.c:262 +#: rc.c:263 msgid "white" msgstr "白" -#: rc.c:263 +#: rc.c:264 msgid "terminal" msgstr "端末" -#: rc.c:282 +#: rc.c:283 msgid "none" msgstr "無し" -#: rc.c:283 +#: rc.c:284 msgid "current URL" msgstr "現在のURL" -#: rc.c:284 +#: rc.c:285 msgid "link URL" msgstr "リンク先のURL" -#: rc.c:289 +#: rc.c:290 msgid "simple" msgstr "シンプル" -#: rc.c:290 +#: rc.c:291 msgid "use tag" msgstr "タグで表示" -#: rc.c:291 +#: rc.c:292 msgid "fontify" msgstr "文字装飾" -#: rc.c:297 +#: rc.c:298 msgid "A:relative to screen height" msgstr "A:画面サイズに比例" -#: rc.c:298 +#: rc.c:299 msgid "B:fixed speed" msgstr "B:一定の行数" -#: rc.c:305 +#: rc.c:306 msgid "unspecified" msgstr "指定しない" -#: rc.c:306 +#: rc.c:307 msgid "inet inet6" msgstr "IPv4優先" -#: rc.c:307 +#: rc.c:308 msgid "inet6 inet" msgstr "IPv6優先" -#: rc.c:308 +#: rc.c:309 msgid "inet only" msgstr "IPv4のみ" -#: rc.c:309 +#: rc.c:310 msgid "inet6 only" msgstr "IPv6のみ" -#: rc.c:316 +#: rc.c:317 msgid "discard" msgstr "破棄する" -#: rc.c:318 +#: rc.c:319 msgid "accept" msgstr "受け入れる" -#: rc.c:320 +#: rc.c:321 msgid "ask" msgstr "確認する" -#: rc.c:330 +#: rc.c:331 msgid "OFF" msgstr "無効" -#: rc.c:331 +#: rc.c:332 msgid "Only ISO 2022" msgstr "ISO 2022 のみ" -#: rc.c:332 +#: rc.c:333 msgid "ON" msgstr "有効" -#: rc.c:691 +#: rc.c:695 msgid "Display Settings" msgstr "表示関係" -#: rc.c:693 +#: rc.c:697 msgid "Color Settings" msgstr "表示色" -#: rc.c:695 +#: rc.c:699 msgid "Miscellaneous Settings" msgstr "雑多な設定" -#: rc.c:696 +#: rc.c:700 msgid "Directory Settings" msgstr "ディレクトリ設定" -#: rc.c:697 +#: rc.c:701 msgid "External Program Settings" msgstr "外部プログラム" -#: rc.c:698 +#: rc.c:702 msgid "Network Settings" msgstr "ネットワークの設定" -#: rc.c:699 +#: rc.c:703 msgid "Proxy Settings" msgstr "プロキシの設定" -#: rc.c:701 +#: rc.c:705 msgid "SSL Settings" msgstr "SSLの設定" -#: rc.c:704 +#: rc.c:708 msgid "Cookie Settings" msgstr "クッキーの設定" -#: rc.c:707 +#: rc.c:711 msgid "Charset Settings" msgstr "文字コードの設定" @@ -842,6 +846,6 @@ msgstr "文字コードの設定" #. * header. For example, ja.po should translate it as #. * "ja;q=1.0, en;q=0.5" like that. #. -#: rc.c:1183 +#: rc.c:1190 msgid "en;q=1.0" msgstr "ja;q=1.0, en;q=0.5" diff --git a/po/w3m.pot b/po/w3m.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: satodai@w3m.jp\n" -"POT-Creation-Date: 2010-07-24 17:31+0900\n" +"POT-Creation-Date: 2010-07-26 16:12+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -572,267 +572,271 @@ msgstr "" msgid "Domains to accept cookies from" msgstr "" -#: rc.c:204 -msgid "Number of redirections to follow" +#: rc.c:203 +msgid "Domains to avoid [wrong number of dots]" msgstr "" #: rc.c:205 +msgid "Number of redirections to follow" +msgstr "" + +#: rc.c:206 msgid "Enable processing of meta-refresh tag" msgstr "" -#: rc.c:208 +#: rc.c:209 msgid "Enable Migemo (Roma-ji search)" msgstr "" -#: rc.c:209 +#: rc.c:210 msgid "Migemo command" msgstr "" -#: rc.c:213 +#: rc.c:214 msgid "Display charset" msgstr "" -#: rc.c:214 +#: rc.c:215 msgid "Default document charset" msgstr "" -#: rc.c:215 +#: rc.c:216 msgid "Automatic charset detect when loading" msgstr "" -#: rc.c:216 +#: rc.c:217 msgid "System charset" msgstr "" -#: rc.c:217 +#: rc.c:218 msgid "System charset follows locale(LC_CTYPE)" msgstr "" -#: rc.c:218 +#: rc.c:219 msgid "Output halfdump with display charset" msgstr "" -#: rc.c:219 +#: rc.c:220 msgid "Use multi column characters" msgstr "" -#: rc.c:220 +#: rc.c:221 msgid "Use combining characters" msgstr "" -#: rc.c:221 +#: rc.c:222 msgid "Use double width for some Unicode characters" msgstr "" -#: rc.c:222 +#: rc.c:223 msgid "Use Unicode language tags" msgstr "" -#: rc.c:223 +#: rc.c:224 msgid "Charset conversion using Unicode map" msgstr "" -#: rc.c:224 +#: rc.c:225 msgid "Charset conversion when loading" msgstr "" -#: rc.c:225 +#: rc.c:226 msgid "Adjust search string for document charset" msgstr "" -#: rc.c:226 +#: rc.c:227 msgid "Fix character width when conversion" msgstr "" -#: rc.c:227 +#: rc.c:228 msgid "Use GB 12345 Unicode map instead of GB 2312's" msgstr "" -#: rc.c:228 +#: rc.c:229 msgid "Use JIS X 0201 Roman for ISO-2022-JP" msgstr "" -#: rc.c:229 +#: rc.c:230 msgid "Use JIS C 6226:1978 for ISO-2022-JP" msgstr "" -#: rc.c:230 +#: rc.c:231 msgid "Use JIS X 0201 Katakana" msgstr "" -#: rc.c:231 +#: rc.c:232 msgid "Use JIS X 0212:1990 (Supplemental Kanji)" msgstr "" -#: rc.c:232 +#: rc.c:233 msgid "Use JIS X 0213:2000 (2000JIS)" msgstr "" -#: rc.c:233 +#: rc.c:234 msgid "Strict ISO-2022-JP/KR/CN" msgstr "" -#: rc.c:234 +#: rc.c:235 msgid "Treat 4 bytes char. of GB18030 as Unicode" msgstr "" -#: rc.c:235 +#: rc.c:236 msgid "Simple Preserve space" msgstr "" -#: rc.c:238 +#: rc.c:239 msgid "keymap file" msgstr "" -#: rc.c:255 +#: rc.c:256 msgid "black" msgstr "" -#: rc.c:256 +#: rc.c:257 msgid "red" msgstr "" -#: rc.c:257 +#: rc.c:258 msgid "green" msgstr "" -#: rc.c:258 +#: rc.c:259 msgid "yellow" msgstr "" -#: rc.c:259 +#: rc.c:260 msgid "blue" msgstr "" -#: rc.c:260 +#: rc.c:261 msgid "magenta" msgstr "" -#: rc.c:261 +#: rc.c:262 msgid "cyan" msgstr "" -#: rc.c:262 +#: rc.c:263 msgid "white" msgstr "" -#: rc.c:263 +#: rc.c:264 msgid "terminal" msgstr "" -#: rc.c:282 +#: rc.c:283 msgid "none" msgstr "" -#: rc.c:283 +#: rc.c:284 msgid "current URL" msgstr "" -#: rc.c:284 +#: rc.c:285 msgid "link URL" msgstr "" -#: rc.c:289 +#: rc.c:290 msgid "simple" msgstr "" -#: rc.c:290 +#: rc.c:291 msgid "use tag" msgstr "" -#: rc.c:291 +#: rc.c:292 msgid "fontify" msgstr "" -#: rc.c:297 +#: rc.c:298 msgid "A:relative to screen height" msgstr "" -#: rc.c:298 +#: rc.c:299 msgid "B:fixed speed" msgstr "" -#: rc.c:305 +#: rc.c:306 msgid "unspecified" msgstr "" -#: rc.c:306 +#: rc.c:307 msgid "inet inet6" msgstr "" -#: rc.c:307 +#: rc.c:308 msgid "inet6 inet" msgstr "" -#: rc.c:308 +#: rc.c:309 msgid "inet only" msgstr "" -#: rc.c:309 +#: rc.c:310 msgid "inet6 only" msgstr "" -#: rc.c:316 +#: rc.c:317 msgid "discard" msgstr "" -#: rc.c:318 +#: rc.c:319 msgid "accept" msgstr "" -#: rc.c:320 +#: rc.c:321 msgid "ask" msgstr "" -#: rc.c:330 +#: rc.c:331 msgid "OFF" msgstr "" -#: rc.c:331 +#: rc.c:332 msgid "Only ISO 2022" msgstr "" -#: rc.c:332 +#: rc.c:333 msgid "ON" msgstr "" -#: rc.c:691 +#: rc.c:695 msgid "Display Settings" msgstr "" -#: rc.c:693 +#: rc.c:697 msgid "Color Settings" msgstr "" -#: rc.c:695 +#: rc.c:699 msgid "Miscellaneous Settings" msgstr "" -#: rc.c:696 +#: rc.c:700 msgid "Directory Settings" msgstr "" -#: rc.c:697 +#: rc.c:701 msgid "External Program Settings" msgstr "" -#: rc.c:698 +#: rc.c:702 msgid "Network Settings" msgstr "" -#: rc.c:699 +#: rc.c:703 msgid "Proxy Settings" msgstr "" -#: rc.c:701 +#: rc.c:705 msgid "SSL Settings" msgstr "" -#: rc.c:704 +#: rc.c:708 msgid "Cookie Settings" msgstr "" -#: rc.c:707 +#: rc.c:711 msgid "Charset Settings" msgstr "" @@ -841,6 +845,6 @@ msgstr "" #. * header. For example, ja.po should translate it as #. * "ja;q=1.0, en;q=0.5" like that. #. -#: rc.c:1183 +#: rc.c:1190 msgid "en;q=1.0" msgstr "" diff --git a/rc.c b/rc.c @@ -200,6 +200,7 @@ static int OptionEncode = FALSE; #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 @@ struct param_ptr params8[] = { (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 @@ parse_cookie() 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