| 1 |
#!/usr/bin/perl -T |
| 2 |
# SPDX-License-Identifier: GPL-2.0-or-later |
| 3 |
|
| 4 |
### profiling: |
| 5 |
### #!/usr/bin/perl -d:NYTProf |
| 6 |
### NYTPROF=start=no:addpid=1:forkdepth=1 amavisd -m 5 foreground |
| 7 |
|
| 8 |
#------------------------------------------------------------------------------ |
| 9 |
# This is amavis. |
| 10 |
# It is an interface between a message transfer agent (MTA) and virus |
| 11 |
# scanners and/or spam scanners, functioning as a mail content filter. |
| 12 |
# |
| 13 |
# It is a performance-enhanced and feature-enriched version of amavisd |
| 14 |
# (which in turn is a daemonized version of AMaViS), initially based |
| 15 |
# on amavisd-snapshot-20020300). |
| 16 |
# |
| 17 |
# All work since amavisd-snapshot-20020300: |
| 18 |
# Copyright (C) 2002-2018 Mark Martinec, |
| 19 |
# All Rights Reserved. |
| 20 |
# with contributions from the amavis-user mailing list and individuals, |
| 21 |
# as acknowledged in the release notes. |
| 22 |
# |
| 23 |
# This program is free software; you can redistribute it and/or modify |
| 24 |
# it under the terms of the GNU General Public License as published by |
| 25 |
# the Free Software Foundation; either version 2 of the License, or |
| 26 |
# (at your option) any later version. |
| 27 |
# |
| 28 |
# This program is distributed in the hope that it will be useful, |
| 29 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 30 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 31 |
# GNU General Public License for details. |
| 32 |
# |
| 33 |
# You should have received a copy of the GNU General Public License |
| 34 |
# along with this program; if not, write to the Free Software |
| 35 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 36 |
|
| 37 |
# Author: Mark Martinec <[email protected]> |
| 38 |
# Patches and problem reports are welcome. |
| 39 |
# |
| 40 |
# The latest version of this program is available at: |
| 41 |
# http://www.ijs.si/software/amavisd/ |
| 42 |
#------------------------------------------------------------------------------ |
| 43 |
|
| 44 |
# Here is a boilerplate from the amavisd(-snapshot) version, which is |
| 45 |
# the version (from 2002-03) that served as a base code for the initial |
| 46 |
# version of amavisd-new. License terms were the same: |
| 47 |
# |
| 48 |
# Author: Chris Mason <[email protected]> |
| 49 |
# Current maintainer: Lars Hecking <[email protected]> |
| 50 |
# Based on work by: |
| 51 |
# Mogens Kjaer, Carlsberg Laboratory, <[email protected]> |
| 52 |
# Juergen Quade, Softing GmbH, <[email protected]> |
| 53 |
# Christian Bricart <[email protected]> |
| 54 |
# Rainer Link <[email protected]> |
| 55 |
# This script is part of the AMaViS package. For more information see: |
| 56 |
# http://amavis.org/ |
| 57 |
# Copyright (C) 2000 - 2002 the people mentioned above |
| 58 |
# This software is licensed under the GNU General Public License (GPL) |
| 59 |
# See: http://www.gnu.org/copyleft/gpl.html |
| 60 |
#------------------------------------------------------------------------------ |
| 61 |
|
| 62 |
BEGIN { pop @INC if $INC[-1] eq '.' } # CVE-2016-1238 (perl) |
| 63 |
use sigtrap qw(stack-trace BUS SEGV EMT FPE ILL SYS TRAP); # ABRT |
| 64 |
|
| 65 |
use strict; |
| 66 |
use re 'taint'; |
| 67 |
use warnings; |
| 68 |
use warnings FATAL => qw(utf8 void); |
| 69 |
no warnings 'uninitialized'; |
| 70 |
# use warnings 'extra'; no warnings 'experimental::re_strict'; use re 'strict'; |
| 71 |
|
| 72 |
BEGIN { |
| 73 |
# Will be overwritten late inside Amavis module. |
| 74 |
# Is used to transform a die() in top evaluation scope |
| 75 |
# into an exit in order to avoid compilation aborted messages: |
| 76 |
# demo@vm:~ perl -T -Ilib bin/amavisd -V |
| 77 |
# amavis-2.12.0 (20190725) |
| 78 |
# Compilation failed in require at bin/amavisd line 96. |
| 79 |
# BEGIN failed--compilation aborted at bin/amavisd line 96. |
| 80 |
$SIG{__DIE__} = sub { |
| 81 |
my $eval = 0; |
| 82 |
for (my $i = 0;; $i++) { |
| 83 |
my ($package, $subroutine) = (caller $i)[0, 3]; |
| 84 |
last unless $package && $subroutine; |
| 85 |
if ($package ne 'main' && $subroutine eq '(eval)') { |
| 86 |
$eval = 1; |
| 87 |
last; |
| 88 |
} |
| 89 |
} |
| 90 |
if ($eval) { |
| 91 |
die @_; |
| 92 |
} else { |
| 93 |
print @_; |
| 94 |
exit 1; |
| 95 |
} |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
use Amavis::Boot; |
| 100 |
use Amavis; |