X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/80989f28059ef378b7473f65a5cf3afdecc722f3..HEAD:/onak-mail.pl.in diff --git a/onak-mail.pl.in b/onak-mail.pl.in index 263b727..96fce71 100644 --- a/onak-mail.pl.in +++ b/onak-mail.pl.in @@ -2,8 +2,7 @@ # # onak-mail.pl - Mail processing interface for onak, an OpenPGP Keyserver. # -# Written by Jonathan McDowell -# Copyright 2002-2005 Project Purple +# Copyright 2002-2005 Jonathan McDowell # Released under the GPL. # @@ -88,7 +87,7 @@ sub processmail($$$$$) { # HELP, ADD, INCREMENTAL, VERBOSE INDEX , INDEX , # GET , LAST - if ($subject =~ /^INCREMENTAL$/i) { + if ($subject =~ /^(INCREMENTAL|ADD)$/i) { my $site; my $count; my $i; @@ -110,6 +109,21 @@ sub processmail($$$$$) { $time[2], $time[1], $time[0]; print LOG "] onak-mail[$$]: Syncing with $count sites.\n"; close LOG; + + if ($subject =~ /ADD/i) { + open(MAIL, "|$config{mta}"); + print MAIL "From: $config{adminemail}\n"; + print MAIL "To: $replyto\n"; + print MAIL "Subject: Reply to ADD\n"; + print MAIL "Precedence: list\n"; + print MAIL "MIME-Version: 1.0\n"; + print MAIL "Content-Type: text/plain\n"; + print MAIL "\n"; + print MAIL "Thank you for your recent key submission.", + " It has been processed and synced\n", + "with ", $count, " other keyservers.\n"; + close MAIL; + } if ((! defined($newupdate[0])) || $newupdate[0] eq '') { open (LOG, ">>$config{'logfile'}"); @@ -198,11 +212,12 @@ my $tmpfile = sprintf "%s/%04d%02d%02d-%02d%02d%02d-%d.onak", $time[1], $time[0], $$; -open(MAILFILE, '>'.$tmpfile); +open(MAILFILE, '>'.$tmpfile.'.tmp'); while (<>) { print MAILFILE $_; } close(MAILFILE); +rename $tmpfile.".tmp", $tmpfile; # # Lock here to ensure that only one copy of us is processing the incoming @@ -242,7 +257,7 @@ while ($file = readdir(MAILDIR)) { push @body, $_; } } - if (! defined($replyto)) { + if ($replyto eq '') { $replyto = $from; } close(FILE);