#!/usr/bin/perl # # File: qmail-scanner-queue.pl # Version: 1.12 # # # This file was auto-generated by: # # ./configure --spooldir /var/spool/qmailscan --qmaildir /ISP/qmail --bindir /ISP/qmail/bin --qmail-queue-binary / var/qmail/bin/qmail-queue --admin ispadmin --domain ***.net --notify sender,admin,recips --local-domains ***.net,***.com,***.com,***.com --lang en_GB --debug 1 --unzip 1 --add-dscr-hdrs 0 --archive 0 --re dundant 0 --log-details 0 --fix-mime 1 --scanners "auto" ... eval { $SIG{ALRM} = sub { die "Maximum time exceeded. Something cannot handle this message." }; alarm $MAXTIME; ... if ($quarantine_event) { &debug("unsetting TCPREMOTEIP env var"); delete $ENV{'TCPREMOTEIP'}; &email_quarantine_report; } else { &qmail_parent_check; &qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id"); } alarm 0; }; $alarm_status=$@; if ($alarm_status and $alarm_status ne "" ) { if ($alarm_status eq "Maximum time exceeded. Something cannot handle this message.") { &tempfail("ALARM: taking longer than $MAXTIME secs. Requeuing..."); } else { &tempfail("Requeuing: $alarm_status"); } } ... sub qmail_requeue { my($sender,$env_recips,$msg)=@_; my ($temp,$findate); ... local $SIG{PIPE} = 'IGNORE'; my $pid = fork; if (not defined $pid) { &tempfail ("Unable to fork. (#4.3.0) - $!"); } elsif ($pid == 0) { # In child. Mutilate our file handles. close EIN; open(STDIN,"<$msg")|| &tempfail ("Unable to reopen fd 0. (#4.3.0) - $!"); ... } else { # In parent. close EOUT; # Feed the envelope addresses to qmail-queue. print EIN "$sender\0$env_recips"; close EIN || &tempfail ("Write error to envelope pipe. (#4.3.0) - $!"); } # We should now have queued the message. Let's find out the exit status # of qmail-queue. waitpid ($pid, 0); my $status =($? >> 8); if ($status != 0) { &tempfail ("Unable to queue message ($status). (#4.3.0) - $!" )} } sub tempfail { syslog('mail|info',"$V_HEADER-$VERSION:[$file_id] @_"); if ($log_details ne "syslog") { warn "$V_HEADER-$VERSION:[$file_id] ",@_, "\n"; } $nowtime = sprintf "%02d/%02d/%02d %02d:%02d:%02d", $mday, $mon+1, $year+1900, $hour, $min, $sec; &debug("tempfail: $V_HEADER-$VERSION: ",@_); close(LOG); &cleanup; exit 111; }