diff options
Diffstat (limited to 'mail/premail/files/patch-aa')
-rw-r--r-- | mail/premail/files/patch-aa | 142 |
1 files changed, 96 insertions, 46 deletions
diff --git a/mail/premail/files/patch-aa b/mail/premail/files/patch-aa index 3de24cf..b7e5612 100644 --- a/mail/premail/files/patch-aa +++ b/mail/premail/files/patch-aa @@ -1,20 +1,39 @@ ---- premail.orig Thu Oct 31 06:25:10 1996 -+++ premail Sat Feb 14 16:34:31 1998 +--- premail.old Thu Oct 31 06:25:10 1996 ++++ premail Sat Feb 14 19:22:24 1998 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/local/bin/perl -w # # premail, an e-mail privacy package # -@@ -96,6 +96,7 @@ +@@ -85,8 +85,11 @@ + $config{'rlist-valid'} = 300; + +-$config{'rlist-url'} = 'http://kiwi.cs.berkeley.edu/rlist'; +-$config{'pubring-url'} = 'http://kiwi.cs.berkeley.edu/pubring.pgp'; ++#$config{'rlist-url'} = 'http://www.cs.berkeley.edu/rlist'; ++#$config{'pubring-url'} = 'http://www.cs.berkeley.edu/pubring.pgp'; ++ ++$config{'rlist-url'} = 'finger:rlist@anon.lcs.mit.edu'; ++$config{'pubring-url'} = 'finger:pubring@anon.lcs.mit.edu'; + $config{'type2-list-url'} = 'http://www.jpunix.com/type2.html'; + $config{'pubring-mix-url'} = 'http://www.jpunix.com/pubring.html'; + +@@ -94,8 +97,12 @@ + + $config{'encrypt'} = 'yes'; + ++my @RELAYS; ++#@RELAYS = ('anon.lcs.mit.edu'); ++ # the following config options are for testing only! #$config{'debug'} = 'chvy'; +$config{'debug'} = ''; # Global state -@@ -112,6 +113,7 @@ +@@ -112,6 +119,7 @@ $editfile = ''; # name of file to edit $dashoi = 0; # -oi on cmd line $more_input = 1; @@ -22,7 +41,7 @@ $header_sep = ''; $in_body = ''; # the filename of the input message body $prezilla = 0; # special mode for Netscape Navigator 2.1 -@@ -226,7 +228,7 @@ +@@ -226,7 +234,7 @@ # Return the name of the real sendmail executable if (!defined $config{'sendmail'} || $config{'sendmail'} eq '') { # Standard place @@ -31,7 +50,7 @@ # Newer BSD-based systems (-x '/usr/sbin/sendmail') && return '/usr/sbin/sendmail'; # Okay, I give up -@@ -308,6 +310,12 @@ +@@ -308,6 +316,12 @@ if ($1 =~ /^[mwpqe]$/) { push (@sendmail_args, $_); } } elsif (/^\-od(.)$/) { push (@sendmail_args, $_); @@ -44,7 +63,7 @@ } elsif (/^\-f$/) { if ($#_ < 0) { &error ("$_ option needs an argument\n"); } shift; # discard -@@ -363,7 +371,7 @@ +@@ -363,7 +377,7 @@ &apply_cmdline_configs (); if ($config{'preferences'}) { $preferences = &tilde_expand ($config{'preferences'}); @@ -53,7 +72,7 @@ while (<PREF>) { if (/^\s*\$config\{\"([^\"]+)\"\}\s*\=\s*\"([^\"]*)\"/ || /^\s*\$config\{\'([^\']+)\'\}\s*\=\s*\'([^\']*)\'/) { -@@ -371,10 +379,11 @@ +@@ -371,10 +385,11 @@ } } close (PREF); @@ -66,7 +85,7 @@ while (<ADDR>) { if (/^([\w\-\_\+\.\@\!]+)\:\s*(.*)$/) { $recip = &strip_address ($1); -@@ -382,6 +391,7 @@ +@@ -382,6 +397,7 @@ } } close (ADDR); @@ -74,7 +93,7 @@ } if ($config{'logfile'}) { open (LOG, '>>'.&tilde_expand_mkdir ($config{'logfile'})); -@@ -413,6 +423,7 @@ +@@ -413,6 +429,7 @@ if (!open (IN, $editfile)) { &error ("cannot open edit file $editfile\n"); } @@ -82,7 +101,7 @@ return 1; } elsif ($dashbs) { # do simple SMTP -@@ -463,7 +474,9 @@ +@@ -463,7 +480,9 @@ @in_headers = (); for ($lineno = 0;;$lineno++) { @@ -93,7 +112,7 @@ if ($handle_from && $lineno == 0 && $line =~ /^From /) { return $line; } -@@ -495,16 +508,16 @@ +@@ -495,16 +514,16 @@ my $line; if ($edit || $post) { @@ -113,7 +132,7 @@ return $line; } -@@ -516,6 +529,7 @@ +@@ -516,6 +535,7 @@ # } if ($edit || $post) { close (IN); @@ -121,7 +140,7 @@ } elsif ($dashbs) { print "250 Message accepted for delivery\n"; $more_input = 1; -@@ -1268,7 +1282,7 @@ +@@ -1268,7 +1288,7 @@ my ($body, @the_recips) = @_; my ($key_type, $key); my (@keys); @@ -130,7 +149,7 @@ my (@mime_fields, $prefix, $boundary); my ($sign_type, $sign); my ($invoc, $errfile); -@@ -1354,7 +1368,7 @@ +@@ -1354,7 +1374,7 @@ my ($body, @the_recips) = @_; my ($key_type, $key); my (@keys); @@ -139,7 +158,7 @@ my (@mime_fields, $prefix); my ($sign_type, $sign); my ($invoc, $errfile); -@@ -1687,7 +1701,7 @@ +@@ -1687,7 +1707,7 @@ } } if ($put_open) { close (PUT); } @@ -148,7 +167,7 @@ } } -@@ -1817,7 +1831,7 @@ +@@ -1817,7 +1837,7 @@ } } push (@deliver_headers, "To\: $new_to\n"); @@ -157,7 +176,7 @@ $hash = "$1\n".$hash; $body = &cat_tail ($body, "\*\*\n"); } -@@ -2214,7 +2228,7 @@ +@@ -2214,7 +2234,7 @@ # we know it's sendmail $invoc = &bin_sendmail (); if ($#sendmail_args >= 0) { @@ -166,7 +185,7 @@ } $invoc .= ' -oi'; foreach $recip (@the_recips) { -@@ -2252,11 +2266,11 @@ +@@ -2252,11 +2272,11 @@ &close_body ($body); if ($post) { close (DELIVER); @@ -182,7 +201,7 @@ unlink $tmpfile; } elsif ($edit && !$prezilla) { close (DELIVER); -@@ -2801,6 +2815,7 @@ +@@ -2801,6 +2821,7 @@ # (@new_dict) = &delete_field ($key, @dict) my ($key, @dict) = @_; my (@new_dict); @@ -190,7 +209,7 @@ @new_dict = (); foreach $field (@dict) { -@@ -2972,8 +2987,8 @@ +@@ -2972,8 +2993,8 @@ $data = ''; if (open (ERRFILE, $file)) { @@ -200,7 +219,7 @@ $data .= $_; } close (ERRFILE); -@@ -3040,7 +3055,7 @@ +@@ -3040,7 +3061,7 @@ $pass = ''; } if ($pubring) { $invoc .= ' +pubring='.&shell_quote ($pubring); } @@ -209,7 +228,7 @@ if ($sign) { $invoc .= 's -u '.&shell_quote ($signuser); &load_secrets (); -@@ -3126,7 +3141,7 @@ +@@ -3126,7 +3147,7 @@ $signuser = '0x'; $pass = ''; } @@ -218,7 +237,7 @@ $invoc .= ' -u '.&shell_quote ($signuser); unless (defined $pass) { if (defined $pgppass{$signuser}) { -@@ -3182,7 +3197,7 @@ +@@ -3182,7 +3203,7 @@ $signuser = '0x'; $pass = ''; } @@ -227,7 +246,7 @@ $invoc .= ' -u '.&shell_quote ($signuser); unless (defined $pass) { if (defined $pgppass{$signuser}) { -@@ -3238,7 +3253,7 @@ +@@ -3238,7 +3259,7 @@ return ($mimefile, $err, $boundary); } @@ -236,7 +255,7 @@ sub pgp_decrypt { # ($out_body, $err) = &pgp_decrypt ($body, $pass) # Try to decrypt $body using passphrase $pass. $out_body is null on error. -@@ -3251,7 +3266,7 @@ +@@ -3251,7 +3272,7 @@ $outfile = &tmp_filename (); $errfile = &tmp_filename (); $invoc = &tilde_expand ($config{'pgp'}); @@ -245,7 +264,7 @@ $invoc .= " +pubring=$PUBRING" if $PUBRING; $invoc .= " +secring=$SECRING" if $SECRING; # if ($pass =~ /^RING$;/) { -@@ -3299,7 +3314,7 @@ +@@ -3299,7 +3320,7 @@ $errfile = &tmp_filename (); $invoc = &tilde_expand ($config{'pgp'}); @@ -254,7 +273,7 @@ $invoc .= ' '.$pgp_file; $invoc .= ' '.$signed_file; $invoc .= ' > '.$errfile.' 2>&1'; -@@ -3390,7 +3405,7 @@ +@@ -3390,7 +3411,7 @@ $chars_needed = 2 + sprintf ("%d", $bits / 8); &pdv ($config{'pgp'}." +makerandom=$chars_needed $outf" ." >/dev/null 2>&1\n"); @@ -263,7 +282,7 @@ ." >/dev/null 2>&1"; &pdv ($status."\n"); if (!$status) { -@@ -3626,11 +3641,14 @@ +@@ -3626,11 +3647,14 @@ $errfile = &tmp_filename (); $invoc = &tilde_expand ($config{'pgp'}); @@ -279,7 +298,7 @@ $status = &open_pgp ($invoc, $pass, ''); $err = &read_and_delete ($errfile); &pdv ($err); -@@ -3647,7 +3665,7 @@ +@@ -3647,7 +3671,7 @@ unlink $ps_pgp; } $invoc = &tilde_expand ($config{'pgp'}); @@ -288,7 +307,7 @@ $invoc .= ' < '.$ps; $invoc .= ' > '.$ps_pgp; $invoc .= ' 2> '.$errfile; -@@ -3910,7 +3928,8 @@ +@@ -3910,7 +3934,8 @@ &replace_field ('Content-Type: text/plain; charset=' .$config{'charset'}."\n", @deliver_headers); @@ -298,7 +317,7 @@ # Should we detect other charsets which are supersets of us-ascii? if (!$mv_present) { push (@deliver_headers, 'MIME-Version: 1.0'."\n"); -@@ -3923,7 +3942,8 @@ +@@ -3923,7 +3948,8 @@ } } # must deal with existing cte, charset, etc. @@ -308,7 +327,7 @@ # Do the QP &pdv ("Doing QP encoding!\n"); if (!$mv_present) { -@@ -4336,6 +4356,8 @@ +@@ -4336,6 +4362,8 @@ exit 0; } @@ -317,7 +336,7 @@ sub decode_msg { # &decode_msg ($msg) # This is possibly the ugliest function in all of premail. Most of it is -@@ -5129,7 +5151,7 @@ +@@ -5129,7 +5157,7 @@ &load_secrets (); foreach (keys %pgpring) { my ($tpr, $tsr) = &makerings ($pgpring{$_}); @@ -326,7 +345,7 @@ #filecat ($tpr, $pr); filecat ($tsr, $sr); &delete_tmpfile ($tpr); -@@ -5157,12 +5179,12 @@ +@@ -5157,12 +5185,12 @@ # &pdv ('&makerings ("'.join ('", "', @_)."\")\n"); foreach ([$pr, $pk], [$sr, $sk]) { open TMP, ">$$_[0]"; @@ -341,7 +360,7 @@ . "$id $pr $pubring 2>&1"; &pdv ("$invoc > /dev/null\n"); system "$invoc > /dev/null"; -@@ -5189,7 +5211,7 @@ +@@ -5189,7 +5217,7 @@ $outfile = &tmp_filename (); $errfile = &tmp_filename (); $invoc = &tilde_expand ($config{'pgp'}); @@ -350,7 +369,7 @@ $invoc .= " +pubring=$pr +secring=$sr "; $invoc .= $cmd; $invoc .= ' < ' . $infile if $infile; -@@ -5248,7 +5270,7 @@ +@@ -5248,7 +5276,7 @@ EOF <STDIN>; @@ -359,7 +378,7 @@ print STDERR "\nKey generation failed.\n"; &killbaks ($pr, $sr); &delete_open_tmpfiles (); -@@ -5272,7 +5294,7 @@ +@@ -5272,7 +5300,7 @@ foreach $a ("$kid $pr", "$remid $pr " . &tilde_expand ($config{'pubring'}), "$kid $sr $defsr") { @@ -368,7 +387,7 @@ # print STDERR "+ $invoc\n"; my $result = `$invoc`; unless ($result =~ /^Key extracted/m) { -@@ -5300,7 +5322,7 @@ +@@ -5300,7 +5328,7 @@ EOF <STDIN>; @@ -377,7 +396,7 @@ # print STDERR "+ $invoc\n"; if (system ($invoc)) { print STDERR "Edit failed.\n"; -@@ -5495,6 +5517,7 @@ +@@ -5495,6 +5523,7 @@ } } } @@ -385,7 +404,7 @@ if ($#args >= 1) { $to = $args[1]; } elsif ($#args < 0) { -@@ -5609,7 +5632,6 @@ +@@ -5609,7 +5638,6 @@ $fullname = &query ('Full name of pseudonym (not just ' . 'E-mail address)', $fullname); $fullname =~ s/[\'\^\n]//g; # kludge for secrets file @@ -393,7 +412,7 @@ $signsend = &query ('Sign mail with (R)emailer key, ' . '(P)seudonym key or (N)o key?', $signsend); -@@ -5771,6 +5793,7 @@ +@@ -5771,6 +5799,7 @@ if (!open (IN, $body)) { &error ("Internal error opening replyblock\n"); } @@ -401,7 +420,7 @@ @in_headers = ("To: $to\n"); push (@in_headers, "Chain: $chain\n") if $chain; $header_sep = "\n"; -@@ -5784,6 +5807,7 @@ +@@ -5784,6 +5813,7 @@ } &send_group ($groups[0]); close (IN); @@ -409,7 +428,7 @@ } sub find_nym { -@@ -5997,7 +6021,7 @@ +@@ -5997,7 +6027,7 @@ # The main loop $quit = 0; @@ -418,7 +437,7 @@ while (!$quit) { $rin = $win = $ein = ''; vec ($rin, fileno(STDIN), 1) = 1 unless $ineof; -@@ -6315,7 +6339,7 @@ +@@ -6315,7 +6345,7 @@ # Open a Web connection for the file as file handle WWW. my ($url) = @_; my ($host, $port, $suf); @@ -427,7 +446,7 @@ my ($name, $proto); my ($that, $thataddr); my ($savesel, $gotsep); -@@ -6330,7 +6354,7 @@ +@@ -6330,7 +6360,7 @@ $host = $1; $port = $2; $suf = $3; @@ -436,3 +455,34 @@ else { $port = 80; } ($fqdn, $aliases, $type, $len, $thataddr) = gethostbyname ($host); return &pdv ("Host not found: $host\n") if ($thataddr eq ''); +@@ -6345,7 +6375,7 @@ + unpack ('C4', $thataddr), $port)); + eval { + $SIG{'ALRM'} = sub { die "Timeout error on $url\n" }; +- alarm (5); ++ alarm (10); + # bind(WWW, $this) || &die_disarm ("bind: $!\n"); + # &pdv ("bound the socket...\n"); + connect(WWW, $that) || &die_disarm ("connect: $!\n"); +@@ -6368,6 +6398,21 @@ + }; + if ($@) { return &pdv ($@); } + return &pdv ("No response from server\n") unless $gotsep; ++ } elsif ($url =~ /^finger:(.*)$/) { ++ my $target = @RELAYS ? $1 . '@' . $RELAYS[time % @RELAYS] : $1; ++ &error("`$target' contains no hostname\n") unless ($target =~ /(.*)@([^@]+)/); ++ my ($user,$host,$port,$ipaddr,$sin) = ($1, $2); ++ return &pdv ("Unknown host: $host\n") unless ($ipaddr = inet_aton ($host)); ++ &error ("Internal error: unknown service finger\n") ++ unless ($port = getservbyname ('finger', 'tcp')); ++ socket (WWW, PF_INET, SOCK_STREAM, getprotobyname ('tcp')) ++ || return &pdv ("socket: $!\n"); ++ $sin = sockaddr_in ($port, $ipaddr); ++ connect (WWW, $sin) || return &pdv ("$! while connecting to $host\n"); ++ &pdv ("connected to the socket...\n"); ++ select ((select(WWW), $|=1)[0]); ++ ++ print WWW "$user\r\n"; + } else { + &error ("Misformed URL: $url\n"); + } |