initial commit of file from CVS for smeserver-mxbackup on Sat Sep 7 20:44:45 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:44:45 +10:00
parent 9a401a3cbe
commit 41ac27ebb3
43 changed files with 4482 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
{
# vim: ft=perl ts=4 sw=4 et:
# perltidy -pbp
if ( ( $mxbackup{status} || "disabled" ) eq "enabled" ) {
$OUT = "# Following is a list of systems or domains.\n";
$OUT .= "# This system is configured to act as a MX Backup for\n";
$OUT .= "# these systems (if there's only one line) or domains.\n";
$OUT .= "# If there is a line beginning with a dot, then this\n";
$OUT .= "# system will accept mails for any hosts of this domain\n";
$OUT .= "# MX Backup start\n";
my $MXFlag = 0;
my %MXValues = split /,/, ( $mxbackup{name} || "" );
foreach my $data (
sort {
( join( "\.", reverse( split /\./, $a ) ) )
cmp( join( "\.", reverse( split /\./, $b ) ) )
}
keys %MXValues
) {
$OUT .= "$data\n";
$OUT .= ".$data\n" if ( $MXValues{$data} );
$MXFlag = 1;
}
$OUT .= "### No MX Backup set Now ...\n" if ( !$MXFlag );
$OUT .= "# MX Backup end\n";
}
}

View File

@@ -0,0 +1,35 @@
{
# vim: ft=perl ts=4 sw=4 et:
# perltidy -pbp
$OUT = "";
# ------------------------------------------------
# if mxbackup is enabled, we have to check if
# there a 'smart host'. If yes, the smart host
# should not be used for all 'MX-Backuped' domains.
# ------------------------------------------------
if ( ( $mxbackup{status} || "disabled" ) eq "enabled" ) {
#--------------------------------------------------
# Now check for SMTP smart host
#--------------------------------------------------
if ( $SMTPSmartHost
&& ( $SMTPSmartHost ne 'off' )
&& ( $SMTPSmartHost !~ /^\s*$/ ) ) {
my %MXValues = split /,/, ( $mxbackup{name} || "" );
foreach my $data (
sort {
( join( "\.", reverse( split /\./, $a ) ) )
cmp( join( "\.", reverse( split /\./, $b ) ) )
}
keys %MXValues
) {
$OUT .= "$data:\n";
$OUT .= ".$data:\n" if ( $MXValues{$data} );
}
}
}
chomp($OUT);
}