Only in w3m-0.1.11-pre-ja: Str.o diff -ru w3m-0.1.11-pre.dist/XXMakefile w3m-0.1.11-pre-ja/XXMakefile --- w3m-0.1.11-pre.dist/XXMakefile Wed Jun 14 06:49:53 2000 +++ w3m-0.1.11-pre-ja/XXMakefile Wed Jul 12 14:18:11 2000 @@ -2,12 +2,12 @@ BIN_DIR = /usr/local/bin HELP_DIR = /usr/local/lib/w3m -LIB_DIR = /usr/local/lib/w3m +LIB_DIR = /usr/local/lib/w3m/ja HELP_FILE = w3mhelp-w3m_ja.html -SYS_LIBRARIES = -lgpm -lbsd -lnsl -lncurses -L/usr/local/ssl/lib -lssl -lcrypto +SYS_LIBRARIES = -lgpm -lbsd -lncurses -L/usr/local/ssl/lib -lssl -lcrypto LOCAL_LIBRARIES = CC = gcc -MYCFLAGS = -O -I./gc -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include +MYCFLAGS = -O -I./gc -I/usr/local/include/openssl -I/usr/local/include KEYBIND_SRC = keybind.c KEYBIND_OBJ = keybind.o EXT= @@ -17,7 +17,7 @@ RANLIB=ranlib MKDIR=mkdir -p VERSION=0.1.11-pre -MODEL=Linux.i686-monster-ja +MODEL=Linux.i586-monster-ja #else SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \ form.c map.c frame.c rc.c menu.c mailcap.c\ Only in w3m-0.1.11-pre-ja: anchor.o Only in w3m-0.1.11-pre-ja: buffer.o diff -ru w3m-0.1.11-pre.dist/config.h w3m-0.1.11-pre-ja/config.h --- w3m-0.1.11-pre.dist/config.h Wed Jun 14 06:49:48 2000 +++ w3m-0.1.11-pre-ja/config.h Wed Jul 12 14:18:00 2000 @@ -54,7 +54,7 @@ /* * Support NNTP */ -#undef USE_NNTP +#define USE_NNTP /* * Enable id attribute @@ -71,12 +71,12 @@ BIN_DIR = /usr/local/bin HELP_DIR = /usr/local/lib/w3m -LIB_DIR = /usr/local/lib/w3m +LIB_DIR = /usr/local/lib/w3m/ja HELP_FILE = w3mhelp-w3m_ja.html -SYS_LIBRARIES = -lgpm -lbsd -lnsl -lncurses -L/usr/local/ssl/lib -lssl -lcrypto +SYS_LIBRARIES = -lgpm -lbsd -lncurses -L/usr/local/ssl/lib -lssl -lcrypto LOCAL_LIBRARIES = CC = gcc -MYCFLAGS = -O -I./gc -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include +MYCFLAGS = -O -I./gc -I/usr/local/include/openssl -I/usr/local/include KEYBIND_SRC = keybind.c KEYBIND_OBJ = keybind.o EXT= @@ -86,11 +86,11 @@ RANLIB=ranlib MKDIR=mkdir -p VERSION=0.1.11-pre -MODEL=Linux.i686-monster-ja +MODEL=Linux.i586-monster-ja #else -#define DISPLAY_CODE 'E' +#define DISPLAY_CODE 'N' #define JA 0 #define EN 1 @@ -103,15 +103,15 @@ #define MENU #define USE_COOKIE #define USE_SSL -#undef USE_SSL_VERIFY -#undef FTPPASS_HOSTNAMEGEN -#undef SHOW_PARAMS - -#define DEF_EDITOR "/bin/vi" -#define DEF_MAILER "/bin/mail" -#define DEF_EXT_BROWSER "/usr/X11R6/bin/netscape" +#define USE_SSL_VERIFY +#define FTPPASS_HOSTNAMEGEN +#define SHOW_PARAMS + +#define DEF_EDITOR "/usr/bin/vi" +#define DEF_MAILER "/software/mutt/bin/mutt" +#define DEF_EXT_BROWSER "/software/netscape/bin/netscape" -#define LIB_DIR "/usr/local/lib/w3m" +#define LIB_DIR "/usr/local/lib/w3m/ja" #define HELP_DIR "/usr/local/lib/w3m" #define HELP_FILE "w3mhelp.html" #define W3MCONFIG "w3mconfig" @@ -127,7 +127,7 @@ #define USER_MAILCAP "~/.mailcap" #define SYS_MAILCAP "/etc/mailcap" #define USER_MIMETYPES "~/.mime.types" -#define SYS_MIMETYPES "/usr/lib/mime.types" +#define SYS_MIMETYPES "/usr/local/lib/mime.types" #define DEF_SAVE_FILE "index.html" @@ -139,7 +139,7 @@ #define SYS_ERRLIST #undef NOBCOPY #define HAVE_WAITPID -#undef HAVE_WAITPID +#define HAVE_WAITPID #define HAVE_STRFTIME #define GETCWD diff -ru w3m-0.1.11-pre.dist/config.param w3m-0.1.11-pre-ja/config.param --- w3m-0.1.11-pre.dist/config.param Wed Jun 14 06:49:44 2000 +++ w3m-0.1.11-pre-ja/config.param Wed Jul 12 14:17:50 2000 @@ -1,24 +1,24 @@ -# Configuretion at ei5unix.yz.yamagata-u.ac.jp +# Configuretion at monet def_bindir='/usr/local/bin' -def_libdir='/usr/local/lib/w3m' +def_libdir='/usr/local/lib/w3m/ja' def_helpdir='/usr/local/lib/w3m' pref_lang=1 -def_dcode=E +def_dcode=N lynx_key=n kanji_symbols=y -ftppass_hostnamegen=n -show_params=n -use_nntp=n +ftppass_hostnamegen=y +show_params=y +use_nntp=y use_color=y use_menu=y use_mouse=y use_cookie=y use_ssl=y dmodel=5 -use_ssl_verify=n -ded='/bin/vi' -dmail='/bin/mail' -dbrowser='/usr/X11R6/bin/netscape' +use_ssl_verify=y +ded='/usr/bin/vi' +dmail='/software/mutt/bin/mutt' +dbrowser='/software/netscape/bin/netscape' dcc='gcc' dcflags='-O' dtermlib='-lncurses' diff -ru w3m-0.1.11-pre.dist/configure w3m-0.1.11-pre-ja/configure --- w3m-0.1.11-pre.dist/configure Wed Jun 14 00:28:32 2000 +++ w3m-0.1.11-pre-ja/configure Wed Jul 12 12:41:36 2000 @@ -576,7 +576,7 @@ fi echo "Do you want to use SSL?" -echo '(You need openSSL library; Please see http://www.openssl.org/)' +echo '(You need OpenSSL library; Please see http://www.openssl.org/)' yesno use_ssl "$use_ssl" n echo "use_ssl=$use_ssl" >> config.param if [ "$use_ssl" = y ]; then @@ -592,6 +592,7 @@ if [ "$use_ssl" = y ]; then echo "Do you want SSL verification support" + echo '(Your SSL library must be version 0.8 or later)' yesno use_ssl_verify "$use_ssl_verify" n echo "use_ssl_verify=$use_ssl_verify" >> config.param if [ "$use_ssl_verify" = y ]; then Only in w3m-0.1.11-pre-ja: conv.o diff -ru w3m-0.1.11-pre.dist/cookie.c w3m-0.1.11-pre-ja/cookie.c --- w3m-0.1.11-pre.dist/cookie.c Wed Jun 14 02:40:56 2000 +++ w3m-0.1.11-pre-ja/cookie.c Wed Jul 12 12:44:23 2000 @@ -20,6 +20,7 @@ { int m0, m1, offset; + /* RFC 2109 s. 2, "domain-match", case 1 (both are IP and identical) */ regexCompile("[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*", 0); m0 = regexMatch(host, 1); m1 = regexMatch(domain, 1); @@ -27,6 +28,7 @@ if (strcasecmp(host, domain) == 0) return host; } + /* RFC 2109 s. 2, cases 2, 3 */ else if (!m0 && !m1) { offset = (domain[0] != '.') ? 0 : strlen(host) - strlen(domain); if (offset >= 0 && strcasecmp(&host[offset], domain) == 0) @@ -35,6 +37,70 @@ return NULL; } +static char * +tail_match(char *host, char *domain) +{ + int m0, m1; + + /* http://www.netscape.com/newsref/std/cookie_spec.html defined + "tail-matching" quite sloppily. In particular case 1 of RFC 2109 + s. 2 was not considered. We use RFC 2109 semantics in the case + where IP numbers are involved. */ + + regexCompile("[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*",0); + m0 = regexMatch(host,1); + m1 = regexMatch(domain,1); + if (m0 && m1 && strcmp(host, domain) == 0) { + return host; + + /* Version 0 "tail-matching" for non-IP-number hosts names */ + } else if (!m0 && !m1 && !nodots(host, NULL)) { + if (strcasecmp(host, domain) == 0) { + return host; + } else { + int L_host = strlen(host); + int L_domain = strlen(domain); + if (L_host >= L_domain + 1 + && domain[0] == '.' + && strcasecmp(&host[L_host - L_domain], domain) == 0) + /* domain actually starts with a . (i.e., same as RFC 2109) */ + return &host[L_host - L_domain]; + else if (L_host >= L_domain + 2 + && host[L_host - L_domain - 1] == '.' + && strcasecmp(&host[L_host - L_domain], domain) == 0) + /* domain has no leading dot */ + return &host[L_host - L_domain - 1]; + } + } + return NULL; +} + +static char * +domain_or_tail_match(char *host, char *domain, int version) +{ + return version? domain_match(host, domain): tail_match(host, domain); +} + +static char * +fqdn( char *host, int scheme ) +{ + /* This is a wrapper for the FQDN() function. + + Note that if we are using a valid proxy, we will want to avoid calling + FQDN() to avoid resolving domain names twice, with the results of the + client-side resolution effectively discarded. We presumably only get a + cookie if we use HTTP or HTTPS, vs. FTP etc., so we ignore other scheme. + Note that we have no "HTTPS proxy" setting. */ + + char *domainname = NULL; + if (scheme == SCM_HTTP && HTTP_proxy != NULL && !Do_not_use_proxy && !check_no_proxy(host)) { + domainname = host; + } else { + domainname = FQDN(host); + } + return domainname; +} + static struct portlist * make_portlist(Str port) { @@ -122,12 +188,12 @@ static int match_cookie(ParsedURL * pu, struct cookie *cookie) { - char *domainname = FQDN(pu->host); + char *domainname = fqdn(pu->host, pu->scheme); if (!domainname) return 0; - if (!domain_match(domainname, cookie->domain->ptr)) + if (!domain_or_tail_match(domainname, cookie->domain->ptr, cookie->version)) return 0; if (strncmp(cookie->path->ptr, pu->file, cookie->path->length) != 0) return 0; @@ -184,6 +250,7 @@ return NULL; tmp = Strnew(); + /* XXX The version check is not necessary according to RFC 2109 s. 10.1.1 */ if (version > 0) Strcat(tmp, Sprintf("$Version=\"%d\"; ", version)); @@ -191,6 +258,7 @@ for (p1 = fco->next; p1; p1 = p1->next) { Strcat_charp(tmp, "; "); Strcat(tmp, make_cookie(p1)); + /* XXX The version check is not necessary according to RFC 2109 s. 10.1.1 */ if (version > 0) { if (p1->flag & COO_PATH) Strcat(tmp, Sprintf("; $Path=\"%s\"", p1->path->ptr)); @@ -226,9 +294,12 @@ Str port, Str commentURL) { struct cookie *p; - char *domainname = FQDN(pu->host); + char *domainname = fqdn(pu->host, pu->scheme); Str odomain = domain, opath = path; struct portlist *portlist = NULL; + int use_security = !(flag & COO_OVERRIDE); + +#define COOKIE_ERROR(err) if(!((err) & COO_OVERRIDE_OK) || use_security) return (err) #ifdef DEBUG fprintf(stderr, "host: [%s, %s] %d\n", pu->host, pu->file, flag); @@ -242,42 +313,62 @@ if (port) fprintf(stderr, "port: [%s]\n", port->ptr); #endif /* DEBUG */ + /* RFC 2109 s. 4.3.2 case 2; but this (no request-host) shouldn't happen */ if (!domainname) - return 1; + return COO_ENODOT; if (domain) { char *dp; - char **sdomain; -#if 0 - if (domain->ptr[0] != '.') - return 1; -#endif /* 0 */ +#if 1 + /* RFC 2109 s. 4.3.2 case 2 subcase 2 (does not apply for version 0) */ + if (version > 0 && domain->ptr[0] != '.') + COOKIE_ERROR(COO_ENOTV1DOM); +#endif /* 1 */ + /* RFC 2109 s. 4.3.2 case 2 subcase 1 */ if (nodots(&domain->ptr[1], &domain->ptr[domain->length])) - return 1; - if (!(dp = domain_match(domainname, domain->ptr))) - return 1; + COOKIE_ERROR(COO_ENODOT); + /* RFC 2109 s. 4.3.2 case 3, or version 0 "tail-matching" check */ + if (!(dp = domain_or_tail_match(domainname, domain->ptr, version))) + COOKIE_ERROR(version? COO_EDOM: COO_ETAIL); if (version == 0) { - for (sdomain = special_domain; *sdomain; sdomain++) { - int offset = domain->length - strlen(*sdomain); - if (offset >= 0 && strcasecmp(*sdomain, &domain->ptr[offset]) == 0) - break; + /* count the number of dots */ + int i; + int n = 0; + for (i = 0; i < domain->length; i += 1) { + if (domain->ptr[i] == '.') + n += 1; + } + if (n < 2) { + COOKIE_ERROR(COO_ESPECIAL); + } else if (n == 2) { + char **sdomain; + int ok = 0; + for (sdomain = special_domain; !ok && *sdomain; sdomain++) { + int offset = domain->length - strlen(*sdomain); + if (offset >= 0 && strcasecmp(*sdomain, &domain->ptr[offset]) == 0) + ok = 1; + } + if (!ok) + COOKIE_ERROR(COO_ESPECIAL); } - if (!*sdomain && !nodots(domainname, dp)) - return 1; } else { - if (!nodots(domainname, dp)) - return 1; + /* RFC 2109 s. 4.3.2 case 4 */ + /* Invariant: dp contains matched domain */ + if (!nodots(domainname, dp)) + COOKIE_ERROR(COO_EBADHOST); } } if (path) { - if (version > 0 && strncmp(path->ptr, pu->file, path->length) != 0) - return 1; + /* RFC 2109 s. 4.3.2 case 1 */ + /* XXX Why is the version 0 check here? */ + if (version > 0 && strncmp(path->ptr, pu->file, path->length) != 0) + COOKIE_ERROR(COO_EPATH); } if (port) { portlist = make_portlist(port); if (portlist && !port_match(portlist, pu->port)) - return 1; + COOKIE_ERROR(COO_EPORT); } if (!domain) @@ -538,7 +629,11 @@ } if (p->commentURL) { Strcat_charp(src, "