[w3m-dev 03644] Re: Other user can see local cookie.

* cookie.c (save_cookies): return if no_rc_dir
* etc.c (tmpf_base): add cookie
	(tmpfname): use tmp_dir instead of rc_dir
* file.c (loadGeneralFile): cookie is not passed via URL
* fm.h (TMPF_COOKIE): incl
	(MAX_TMPF_TYPE): incl
	(no_rc_dir): added
	(tmp_dir): added
	(config_file): added
* local.c (Local_cookie_file): added
	(writeLocalCookie): added
	(setLocalCookie): dont set environment LOCAL_COOKIE
	(localcgi_post): writeLocalCookie
	(localcgi_get): writeLocalCookie
* main.c (config_filename): deleted
	(cmd_loadURL): arg FormList
	(main): rewrite config_file, rc
	(ldhelp): no cookie in URL
	(cmd_loadURL): arg FormList
	(goURL0): cmd_loadURL change
	(cmd_loadBuffer): cmd_loadURL change
	(adBmark): cookie is posted
	(follow_map): cmd_loadURL change
	(linkMn): cmd_loadURL change
	(reinit): init_rc change
* proto.h (create_option_search_table): deleted
	(init_rc): no args
* rc.c (create_option_search_table): static
	(init_rc): no args
		rewrite
	(optionpanel_src1): rewrite
	(load_option_panel): html_quote
	(panel_set_option): no_rc_dir
* w3mbookmark.c: rewrite
* w3mhelperpanel.c: rewrite
* scripts/dirlist.cgi.in: rewrite
* scripts/w3mhelp.cgi.in: rewrite
* scripts/w3mmail.cgi.in: rewrite
* scripts/multipart/multipart.cgi.in: rewrite
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2003-01-15 17:13:21 +00:00
parent 0aeedf43a0
commit 549ee1cc09
15 changed files with 326 additions and 236 deletions

View File

@@ -1,15 +1,21 @@
#!@PERL@
$rcsid = q$Id: w3mmail.cgi.in,v 1.11 2002/11/11 15:50:28 ukai Exp $;
$rcsid = q$Id: w3mmail.cgi.in,v 1.12 2003/01/15 17:13:22 ukai Exp $;
($id = $rcsid) =~ s/^.*,v ([\d\.]*).*/$1/;
($prog=$0) =~ s/.*\///;
$query = $ENV{'QUERY_STRING'};
$local_cookie = $ENV{'LOCAL_COOKIE'};
$cookie_file = $ENV{'LOCAL_COOKIE_FILE'};
$local_cookie = '';
$SENDMAIL = '/usr/lib/sendmail';
$SENDMAIL = '/usr/sbin/sendmail' if -x '/usr/sbin/sendmail';
$SENDMAIL_OPT = '-oi -t';
if (-f $cookie_file) {
open(F, "< $cookie_file");
$local_cookie = <F>;
close(F);
}
if ($query =~ s/^\w+://) {
$url = $query;
$qurl = &html_quote($url);
@@ -43,8 +49,9 @@ if ($query =~ s/^\w+://) {
print "\r\n";
print "<html><head><title>W3M Mailer: $qurl</title></head>\n";
print "<body><h1>W3M Mailer: $qurl</h1>\n";
print "<form action='file://$0' method='POST'>\n";
print "<input type='hidden' name='cookie' value='$local_cookie'>\n";
print "<form action=\"file://$0\" method='POST'>\n";
$local_cookie = &html_quote($local_cookie);
print "<input type='hidden' name='cookie' value=\"$local_cookie\">\n";
print "<table>\n";
foreach $h ('from', 'to', 'cc', 'bcc', 'subject') {
$v = &lang_html_quote($opt{$h});
@@ -52,6 +59,7 @@ if ($query =~ s/^\w+://) {
delete $opt{$h};
}
if ($boundary) {
$boundary = &html_quote($boundary);
print "<tr><td>Content-Type:<td>multipart/form-data; boundary=\"$boundary\"\n";
print "<input type='hidden' name='boundary' value=\"$boundary\">\n";
}
@@ -98,8 +106,9 @@ if ($query =~ s/^\w+://) {
print "<html><head><title>W3M Mailer</title></head>\n";
print "<body>\n";
print "<h1>W3M Mailer: preview</h1>\n";
print "<form action='$0' method='POST'>\n";
print "<input type='hidden' name='cookie' value='$local_cookie'>\n";
print "<form action=\"file://$0\" method='POST'>\n";
$local_cookie = &html_quote($local_cookie);
print "<input type='hidden' name='cookie' value=\"$local_cookie\">\n";
print "<hr>\n";
print "<pre>\n";
foreach $h (keys %opt) {
@@ -112,13 +121,15 @@ if ($query =~ s/^\w+://) {
($cs,$cte,$body) = &lang_body(&lang_html_quote($body), 0);
print "Mime-Version: 1.0\n";
if ($boundary) {
$boundary = &html_quote($boundary);
print "Content-Type: multipart/form-data;\n";
print " boundary=\"$boundary\"\n";
} else {
print "Content-Type: text/plain; charset=$cs\n";
}
# print "Content-Transfer-Encoding: $cte\n";
print "User-Agent: $ENV{'SERVER_SOFTWARE'} $prog/$id\n";
print "User-Agent: ", &html_quote("$ENV{'SERVER_SOFTWARE'} $prog/$id"),
"\n";
print "\n";
print $body;
print "\n" if ($body !~ /\n$/);
@@ -137,10 +148,10 @@ if ($query =~ s/^\w+://) {
foreach $h (keys %opt) {
$qh = &html_quote($h);
print "<tr><td>\u$qh:<td>$v{$h}\n";
print "<input type='hidden' name=\"$qh\" value=\"$v\">\n";
print "<input type='hidden' name=\"$qh\" value=\"$v{$h}\">\n";
}
print "<tr><td colspan=2>\n";
print "<textarea cols=40 rows=10 name='body'>\n";
print "<textarea cols=40 rows=10 name=body>\n";
if ($body) {
print $body;
}
@@ -158,7 +169,7 @@ if ($query =~ s/^\w+://) {
print "\r\n";
print "<html><head><title>W3M Mailer</title></head>\n";
print "<body><h1>W3M Mailer: open sendmail failed</h1>\n";
print "<p>$@</p>\n";
print "<p>", &html_quote($@), "</p>\n";
print "</body></html>\n";
exit(0);
}
@@ -189,7 +200,7 @@ if ($query =~ s/^\w+://) {
print "\r\n";
print "<html><head><title>W3M Mailer</title></head>\n";
print "<body><h1>W3M Mailer: close sendmail failed</h1>\n";
print "<p>$@</p>\n";
print "<p>", &html_quote($@), "</p>\n";
print "</body></html>\n";
}
}