mirror of
https://github.com/MailScanner/v5.git
synced 2024-11-10 09:13:31 +08:00
postfix updates
none
This commit is contained in:
parent
8ad3b65283
commit
ae1a882137
8 changed files with 71 additions and 64 deletions
|
@ -296,9 +296,6 @@ do_perms()
|
|||
# set owner:group
|
||||
chown ${RDUSER}:${RDGROUP} $WORKDIR
|
||||
|
||||
# processing.db and spamassassin.cache.db
|
||||
chmod 660 ${WORKDIR}/*.db
|
||||
|
||||
# ramdisk
|
||||
if [ -d $ramdisk_store ];then
|
||||
chown ${RDUSER}:${RDGROUP} $ramdisk_store
|
||||
|
|
|
@ -43,11 +43,11 @@ ARMOD+=('Pod::Simple'); ARMOD+=('POSIX'); ARMOD+=('Scalar::Util');
|
|||
ARMOD+=('Socket'); ARMOD+=('Storable'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('Test::Pod'); ARMOD+=('Test::Simple'); ARMOD+=('Time::HiRes');
|
||||
ARMOD+=('Time::localtime'); ARMOD+=('Sys::Hostname::Long'); ARMOD+=('Sys::SigAction');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env'); ARMOD+=('File::ShareDir::Install');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
|
||||
# not required but nice to have
|
||||
ARMOD+=('bignum'); ARMOD+=('Business::ISBN'); ARMOD+=('Business::ISBN::Data');
|
||||
ARMOD+=('bignum');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('DBD::SQLite');
|
||||
ARMOD+=('DBI'); ARMOD+=('Digest'); ARMOD+=('Encode::Detect');
|
||||
ARMOD+=('Error'); ARMOD+=('ExtUtils::CBuilder'); ARMOD+=('ExtUtils::ParseXS');
|
||||
|
|
|
@ -79,15 +79,14 @@ sub new {
|
|||
#print STDERR "Creating SMDiskStore($id)\n";
|
||||
$this->{hdname} = $mta->HDFileName($id);
|
||||
$this->{tname} = $mta->TFileName($id);
|
||||
|
||||
#
|
||||
# Alvaro Marin alvaro@hostalia.com - 2016/08/25
|
||||
#
|
||||
# Long queue IDs and hash queue support
|
||||
#
|
||||
my $long_queue_id=0;
|
||||
my $hex=$this->{hdname};
|
||||
if ($this->{hdname} =~ /[A-Za-z0-9]{15}$/) {
|
||||
my $hex=$this->{hdname};
|
||||
if ($this->{hdname} =~ /[A-Za-z0-9]{12,20}$/) {
|
||||
# long queue id
|
||||
$long_queue_id=1;
|
||||
# With long queue IDs, when hash queues is enabled, the directory hierarchy
|
||||
|
@ -98,42 +97,42 @@ sub new {
|
|||
my $total=0;
|
||||
my $count=0;
|
||||
my %BASE52_CHARACTERS = (0 => "0",1 => "1",2 => "2",3 => "3",4 => "4",5 => "5",6 => "6",7 => "7",8 => "8",9 => "9",
|
||||
10 => "B",11 => "C",12 => "D",13 => "F",14 => "G",15 => "H",16 => "J",17 => "K",18 => "L",
|
||||
19 => "M",20 => "N",21 => "P",22 => "Q",23 => "R",24 => "S",25 => "T",26 => "V",27 => "W",
|
||||
28 => "X",29 => "Y",30 => "Z",31 => "b",32 => "c",33 => "d",34 => "f",35 => "g",36 => "h",
|
||||
37 => "j",38 => "k",39 => "l",40 => "m",41 => "n",42 => "p",43 => "q",44 => "r",45 => "s",
|
||||
46 => "t",47 => "v",48 => "w",49 => "x",50 => "y",51 => "z");
|
||||
10 => "B",11 => "C",12 => "D",13 => "F",14 => "G",15 => "H",16 => "J",17 => "K",18 => "L",
|
||||
19 => "M",20 => "N",21 => "P",22 => "Q",23 => "R",24 => "S",25 => "T",26 => "V",27 => "W",
|
||||
28 => "X",29 => "Y",30 => "Z",31 => "b",32 => "c",33 => "d",34 => "f",35 => "g",36 => "h",
|
||||
37 => "j",38 => "k",39 => "l",40 => "m",41 => "n",42 => "p",43 => "q",44 => "r",45 => "s",
|
||||
46 => "t",47 => "v",48 => "w",49 => "x",50 => "y",51 => "z");
|
||||
# To avoid using external modules...reverse the hash
|
||||
my %rBASE52_CHARACTERS = reverse %BASE52_CHARACTERS;
|
||||
for my $c (split //, $msecs) {
|
||||
my $index = $rBASE52_CHARACTERS{$c};
|
||||
$total+=$index * (52**$count);
|
||||
$count++;
|
||||
$total+=$index * (52**$count);
|
||||
$count++;
|
||||
}
|
||||
$hex = sprintf("%05X", $total); # 5 chars...from Postfix's code!
|
||||
#print STDERR "Microseconds of ".$this->{hdname}.":$msecs -> HEX: $hex\n";
|
||||
}
|
||||
if ($MailScanner::SMDiskStore::HashDirDepth == 2) {
|
||||
if ($long_queue_id){
|
||||
$hex =~ /^(.)(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/$2/" . $this->{hdname};
|
||||
$hex =~ /^(.)(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/$2/" . $this->{hdname};
|
||||
} else {
|
||||
$this->{hdname} =~ /^(.)(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/$2/" . $this->{hdname};
|
||||
$this->{hdname} =~ /^(.)(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/$2/" . $this->{hdname};
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($MailScanner::SMDiskStore::HashDirDepth == 1) {
|
||||
if ($long_queue_id){
|
||||
$hex =~ /^(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/" . $this->{hdname};
|
||||
$hex =~ /^(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/" . $this->{hdname};
|
||||
} else {
|
||||
$this->{hdname} =~ /^(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/" . $this->{hdname};
|
||||
$this->{hdname} =~ /^(.)(.*)$/;
|
||||
$this->{hdpath} = "$dir/$1/" . $this->{hdname};
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($MailScanner::SMDiskStore::HashDirDepth == 0) {
|
||||
$this->{hdname} =~ /^(.*)$/;
|
||||
$this->{hdpath} = "$dir/" . $this->{hdname};
|
||||
$this->{hdname} =~ /^(.*)$/;
|
||||
$this->{hdpath} = "$dir/" . $this->{hdname};
|
||||
}
|
||||
#print STDERR "Created new message object at " . $this->{hdpath} . "\n";
|
||||
|
||||
|
|
|
@ -277,21 +277,24 @@ sub new {
|
|||
#
|
||||
my $long_queue_id=0;
|
||||
my $hex;
|
||||
if ($file =~ /\-[A-Za-z0-9]{15}\.[A-Za-z0-9]{5}$/) {
|
||||
if ($file =~ /\-[A-Za-z0-9]{12,20}\.[A-Za-z0-9]{5}$/) {
|
||||
my $file_orig=$file;
|
||||
# Long queue IDs
|
||||
$long_queue_id=1;
|
||||
my $seconds=0;
|
||||
my $microseconds=0;
|
||||
use Time::HiRes qw( gettimeofday );
|
||||
my ($seconds, $microseconds) = gettimeofday;
|
||||
my $microseconds_aux=$microseconds;
|
||||
($seconds, $microseconds) = gettimeofday;
|
||||
my $microseconds_orig=$microseconds;
|
||||
my @BASE52_CHARACTERS = ("0","1","2","3","4","5","6","7","8","9",
|
||||
"B","C","D","F","G","H","J","K","L","M",
|
||||
"N","P","Q","R","S","T","V","W","X","Y",
|
||||
"Z","b","c","d","f","g","h","j","k","l",
|
||||
"m","n","p","q","r","s","t","v","w","x","y","z");
|
||||
my $encoded;
|
||||
my $encoded='';
|
||||
my $file_out;
|
||||
my $count=0;
|
||||
while ( ($seconds > 0) && ($count < 6)) {
|
||||
while ($count < 6) {
|
||||
$encoded.=$BASE52_CHARACTERS[$seconds%52];
|
||||
$seconds/=52;
|
||||
$count++;
|
||||
|
@ -299,7 +302,7 @@ sub new {
|
|||
$file_out=reverse $encoded;
|
||||
$encoded='';
|
||||
$count=0;
|
||||
while ( ($microseconds > 0) && ($count < 4)) {
|
||||
while ($count < 4) {
|
||||
$encoded.=$BASE52_CHARACTERS[$microseconds%52];
|
||||
$microseconds/=52;
|
||||
$count++;
|
||||
|
@ -311,15 +314,23 @@ sub new {
|
|||
my $inode=(stat("$file"))[1];
|
||||
$encoded='';
|
||||
$count=0;
|
||||
while ( ($inode > 0) && ($count < 4)) {
|
||||
while ($count < 4) {
|
||||
$encoded.=$BASE52_CHARACTERS[$inode%51];
|
||||
$inode/=51;
|
||||
$count++;
|
||||
}
|
||||
$file=$file_out.reverse $encoded;
|
||||
# We need this for later use...
|
||||
$hex = sprintf("%05X", $microseconds_aux);
|
||||
#print STDERR "long_queue_id: New Filename is $file\n";
|
||||
# We need this for later use...
|
||||
$hex = sprintf("%05X", $microseconds_orig);
|
||||
#print STDERR "long_queue_id: New Filename is $file\n";
|
||||
|
||||
# We check the generated ID...
|
||||
if ($file !~ /[A-Za-z0-9]{12,20}/) {
|
||||
# Something has gone wrong, back to short ID for safety
|
||||
MailScanner::Log::WarnLog("ERROR generating long queue ID ($file), back to short ID ($file_orig)");
|
||||
$file = sprintf("%05X%lX", int(rand 1000000)+1, (stat($file_orig))[1]);
|
||||
$long_queue_id=0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Short queue IDs
|
||||
|
@ -330,27 +341,27 @@ sub new {
|
|||
}
|
||||
|
||||
if ($MailScanner::SMDiskStore::HashDirDepth == 2) {
|
||||
if ($long_queue_id){
|
||||
# hash queues with long queue IDs
|
||||
$hex =~ /^(.)(.)/;
|
||||
return ($dir,$1,$2,$file);
|
||||
}
|
||||
else {
|
||||
# hash queues with short queue IDs
|
||||
$file =~ /^(.)(.)/;
|
||||
return ($dir,$1,$2,$file);
|
||||
}
|
||||
if ($long_queue_id){
|
||||
# hash queues with long queue IDs
|
||||
$hex =~ /^(.)(.)/;
|
||||
return ($dir,$1,$2,$file);
|
||||
}
|
||||
else {
|
||||
# hash queues with short queue IDs
|
||||
$file =~ /^(.)(.)/;
|
||||
return ($dir,$1,$2,$file);
|
||||
}
|
||||
} elsif ($MailScanner::SMDiskStore::HashDirDepth == 1) {
|
||||
if ($long_queue_id){
|
||||
# hash queues with long queue IDs
|
||||
if ($long_queue_id){
|
||||
# hash queues with long queue IDs
|
||||
$hex =~ /^(.)/;
|
||||
return ($dir,$1,$file);
|
||||
}
|
||||
else {
|
||||
# hash queues with short queue IDs
|
||||
$file =~ /^(.)/;
|
||||
return ($dir,$1,$file);
|
||||
}
|
||||
return ($dir,$1,$file);
|
||||
}
|
||||
else {
|
||||
# hash queues with short queue IDs
|
||||
$file =~ /^(.)/;
|
||||
return ($dir,$1,$file);
|
||||
}
|
||||
} elsif ($MailScanner::SMDiskStore::HashDirDepth == 0) {
|
||||
return ($dir,$file);
|
||||
} else {
|
||||
|
|
4
debian/install.sh
vendored
4
debian/install.sh
vendored
|
@ -259,11 +259,11 @@ ARMOD+=('Pod::Simple'); ARMOD+=('POSIX'); ARMOD+=('Scalar::Util');
|
|||
ARMOD+=('Socket'); ARMOD+=('Storable'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('Test::Pod'); ARMOD+=('Test::Simple'); ARMOD+=('Time::HiRes');
|
||||
ARMOD+=('Time::localtime'); ARMOD+=('Sys::Hostname::Long'); ARMOD+=('Sys::SigAction');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env'); ARMOD+=('File::ShareDir::Install');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
|
||||
# not required but nice to have
|
||||
ARMOD+=('bignum'); ARMOD+=('Business::ISBN'); ARMOD+=('Business::ISBN::Data');
|
||||
ARMOD+=('bignum');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('DBD::SQLite');
|
||||
ARMOD+=('DBI'); ARMOD+=('Digest'); ARMOD+=('Encode::Detect');
|
||||
ARMOD+=('Error'); ARMOD+=('ExtUtils::CBuilder'); ARMOD+=('ExtUtils::ParseXS');
|
||||
|
|
|
@ -86,11 +86,11 @@ ARMOD+=('Pod::Simple'); ARMOD+=('POSIX'); ARMOD+=('Scalar::Util');
|
|||
ARMOD+=('Socket'); ARMOD+=('Storable'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('Test::Pod'); ARMOD+=('Test::Simple'); ARMOD+=('Time::HiRes');
|
||||
ARMOD+=('Time::localtime'); ARMOD+=('Sys::Hostname::Long'); ARMOD+=('Sys::SigAction');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env'); ARMOD+=('File::ShareDir::Install');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
|
||||
# not required but nice to have
|
||||
ARMOD+=('bignum'); ARMOD+=('Business::ISBN'); ARMOD+=('Business::ISBN::Data');
|
||||
ARMOD+=('bignum');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('DBD::SQLite');
|
||||
ARMOD+=('DBI'); ARMOD+=('Digest'); ARMOD+=('Encode::Detect');
|
||||
ARMOD+=('Error'); ARMOD+=('ExtUtils::CBuilder'); ARMOD+=('ExtUtils::ParseXS');
|
||||
|
|
|
@ -399,11 +399,11 @@ ARMOD+=('Pod::Simple'); ARMOD+=('POSIX'); ARMOD+=('Scalar::Util');
|
|||
ARMOD+=('Socket'); ARMOD+=('Storable'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('Test::Pod'); ARMOD+=('Test::Simple'); ARMOD+=('Time::HiRes');
|
||||
ARMOD+=('Time::localtime'); ARMOD+=('Sys::Hostname::Long'); ARMOD+=('Sys::SigAction');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env'); ARMOD+=('File::ShareDir::Install');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
|
||||
# not required but nice to have
|
||||
ARMOD+=('bignum'); ARMOD+=('Business::ISBN'); ARMOD+=('Business::ISBN::Data');
|
||||
ARMOD+=('bignum');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('DBD::SQLite');
|
||||
ARMOD+=('DBI'); ARMOD+=('Digest'); ARMOD+=('Encode::Detect');
|
||||
ARMOD+=('Error'); ARMOD+=('ExtUtils::CBuilder'); ARMOD+=('ExtUtils::ParseXS');
|
||||
|
|
|
@ -264,11 +264,11 @@ ARMOD+=('Pod::Simple'); ARMOD+=('POSIX'); ARMOD+=('Scalar::Util');
|
|||
ARMOD+=('Socket'); ARMOD+=('Storable'); ARMOD+=('Test::Harness');
|
||||
ARMOD+=('Test::Pod'); ARMOD+=('Test::Simple'); ARMOD+=('Time::HiRes');
|
||||
ARMOD+=('Time::localtime'); ARMOD+=('Sys::Hostname::Long'); ARMOD+=('Sys::SigAction');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env'); ARMOD+=('File::ShareDir::Install');
|
||||
ARMOD+=('Sys::Syslog'); ARMOD+=('Env');
|
||||
ARMOD+=('Mail::SpamAssassin');
|
||||
|
||||
# not required but nice to have
|
||||
ARMOD+=('bignum'); ARMOD+=('Business::ISBN'); ARMOD+=('Business::ISBN::Data');
|
||||
ARMOD+=('bignum');
|
||||
ARMOD+=('Data::Dump'); ARMOD+=('DB_File'); ARMOD+=('DBD::SQLite');
|
||||
ARMOD+=('DBI'); ARMOD+=('Digest'); ARMOD+=('Encode::Detect');
|
||||
ARMOD+=('Error'); ARMOD+=('ExtUtils::CBuilder'); ARMOD+=('ExtUtils::ParseXS');
|
||||
|
|
Loading…
Reference in a new issue