#!/usr/bin/perl -w # $Id: receive.in,v 1.8 2000/10/10 23:39:12 joy Exp $ # usage: mail is piped directly into program #set umask in order to have group-writable incoming/* #umask 002; #load configuration file require( '/etc/debbugs/config' ); #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: $!"); rename("T.$id","I$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 }