Skip to content

Commit

Permalink
Fixed: postmap file before restart (Postfix server implementatio)
Browse files Browse the repository at this point in the history
CS fixes
  • Loading branch information
nuxwin committed May 20, 2015
1 parent 8d29cfc commit 46e9a7f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
7 changes: 2 additions & 5 deletions contrib/Listeners/Named/10_bind9_localnets.pl
Expand Up @@ -25,13 +25,10 @@ package Listener::Bind9::Localnets;

sub onBeforeNamedBuildConf
{
my $tplContent = shift;
my $tplName = shift;
my ($tplContent, $tplName) = @_;

if($tplName eq 'named.conf.options') {
$$tplContent =~ s/^(\s*allow-recursion).*$/$1 { localnets; };/m;
$$tplContent =~ s/^(\s*allow-query-cache).*$/$1 { localnets; };/m;
$$tplContent =~ s/^(\s*allow-transfer).*$/$1 { localnets; };/m;
$$tplContent =~ s/^(\s*allow-(?:recursion|query-cache|transfer)).*$/$1 { localnets; };/gm;
}

0;
Expand Down
21 changes: 17 additions & 4 deletions engine/PerlLib/Servers/mta/postfix.pm
Expand Up @@ -149,8 +149,19 @@ sub postinstall
iMSCP::Service->getInstance()->enable($self->{'config'}->{'MTA_SNAME'});

$self->{'eventManager'}->register(
'beforeSetupRestartServices', sub { push @{$_[0]}, [ sub { $self->restart(); }, 'Postfix' ]; 0; }
);
'beforeSetupRestartServices', sub { push @{$_[0]}, [
sub {
my $rs = 0;

for(keys %{$self->{'postmap'}}) {
$rs ||= $self->postmap($_);
}

$rs ||= $self->restart();
},
'Postfix'
]; 0;
});

$self->{'eventManager'}->trigger('afterMtaPostinstall', 'postfix');
}
Expand Down Expand Up @@ -1433,8 +1444,10 @@ END
my $self = __PACKAGE__->getInstance();
my $rs = $?;

for(keys %{$self->{'postmap'}}) {
$rs ||= $self->postmap($_);
unless($main::execmode && $main::execmode eq 'setup') {
for(keys %{$self->{'postmap'}}) {
$rs ||= $self->postmap($_);
}
}

$? = $rs;
Expand Down

0 comments on commit 46e9a7f

Please sign in to comment.