#!/usr/bin/perl # $Id: receive.in,v 1.17 2005/07/24 18:42:41 don Exp $ # usage: mail is piped directly into program #set umask in order to have group-writable incoming/* #umask(002); use Debbugs::Config qw(:globals :text); my $lib_path = $gLibPath; $ENV{'PATH'} = '/usr/lib/debbugs:'.$ENV{'PATH'}; #set source of mail delivery #sets any prefix needed to get mailer to add it to error mail if ( $gMailer eq 'exim' ) { $gBadEmailPrefix = ''; $_ = $ENV{'LOCAL_PART'}; } elsif ( $gMailer eq 'qmail' ) { $gBadEmailPrefix = '//'; $_ = $ENV{'DEFAULT'}; # $_ = $ENV{'RECIPIENT'}; # s/^\w+-bugs--?//; } else { $gBadEmailPrefix = ''; $_ = $ARGV[0]; s/\>//; s/\T.$id") || &failure("open temporary file: $!"); printf(FILE "Received: (at %s) by $gEmailDomain; %d %s %d %02d:%02d:%02d +0000\n", $addrrec, $mday,$months[$mon],$year+1900, $hour,$min,$sec) || &failure("write header to temporary file: $!"); while() { print(FILE) || &failure("write temporary file: $!"); } close(FILE) || &failure("close temporary file: $!"); my $prefix; if ($gSpamScan) { $prefix = 'S'; } else { $prefix = 'I'; } rename("T.$id","$prefix$queue.$id") || &failure("rename spool message: $!"); exit(0); sub failure { length($id) && unlink("T.$id"); print STDERR "bugs receive failure: @_\n"; exit(75); # EX_TEMPFAIL }