summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Hansen <steffen@kdab.com>2005-05-29 22:43:08 (GMT)
committerSteffen Hansen <steffen@kdab.com>2005-05-29 22:43:08 (GMT)
commit99d0076e17cd8f178234f58a51eb292a86110645 (patch)
treeec3f1449a15d870848273f3ef0e95606ac00e692
parent8ad55fba5c63bd3f72cf88c372d45de7427ece9b (diff)
downloadperl-Kolab-99d0076e17cd8f178234f58a51eb292a86110645.tar.gz
added postfix virtual map template (Issue768)
-rw-r--r--Kolab-Conf/Conf.pm32
-rw-r--r--perl-kolab.spec2
2 files changed, 23 insertions, 11 deletions
diff --git a/Kolab-Conf/Conf.pm b/Kolab-Conf/Conf.pm
index eb9dee9..acb8e48 100644
--- a/Kolab-Conf/Conf.pm
+++ b/Kolab-Conf/Conf.pm
@@ -217,21 +217,32 @@ sub build {
sub buildPostfixTransportMap
{
- Kolab::log('T', 'Building Postfix transport map', KOLAB_DEBUG);
+ buildPostfixMap( 'transport' );
+}
+
+sub buildPostfixVirtualMap
+{
+ buildPostfixMap( 'virtual' );
+}
+
+sub buildPostfixMap
+{
+ my $map = shift;
+ Kolab::log('T', "Building Postfix $map map", KOLAB_DEBUG);
my $prefix = $Kolab::config{'prefix'};
- my $cfg = "$prefix/etc/postfix/transport";
+ my $cfg = "$prefix/etc/postfix/$map";
my $oldcfg = $cfg . '.old';
my $oldmask = umask 077;
copy($cfg, $oldcfg);
chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
umask $oldmask;
- copy("$prefix/etc/kolab/templates/transport.template", $cfg);
+ copy("$prefix/etc/kolab/templates/$map.template", $cfg);
my $transport;
if (!($transport = IO::File->new($cfg, 'a'))) {
- Kolab::log('T', 'Unable to create Postfix transport map', KOLAB_ERROR);
+ Kolab::log('T', "Unable to create Postfix $map map", KOLAB_ERROR);
exit(1);
}
@@ -248,22 +259,22 @@ sub buildPostfixTransportMap
filter => '(objectclass=*)'
);
if ($mesg->code) {
- Kolab::log('T', 'Unable to locate Postfix transport map entries in LDAP', KOLAB_ERROR);
+ Kolab::log('T', "Unable to locate Postfix $map map entries in LDAP", KOLAB_ERROR);
exit(1);
}
my $ldapobject;
if ($mesg->code <= 0) {
foreach $ldapobject ($mesg->entries) {
- my $routes = $ldapobject->get_value('postfix-transport', asref => 1);
+ my $routes = $ldapobject->get_value("postfix-$map", asref => 1);
foreach (@$routes) {
$_ = trim($_);
- Kolab::log('T', "Adding SMTP route `$_'");
+ Kolab::log('T', "Adding entry `$_' to $map");
print $transport $_ . "\n";
}
}
} else {
- Kolab::log('T', 'No Postfix transport map entries found');
+ Kolab::log('T', "No Postfix $map map entries found");
}
Kolab::LDAP::destroy($ldap);
@@ -271,7 +282,7 @@ sub buildPostfixTransportMap
# FIXME: bad way of doing things...
#system("chown root:root $prefix/etc/postfix/*");
- system("$prefix/sbin/postmap $prefix/etc/postfix/transport");
+ system("$prefix/sbin/postmap $prefix/etc/postfix/$map");
if (-f $oldcfg) {
my $rc = `diff -q $cfg $oldcfg`;
@@ -284,7 +295,7 @@ sub buildPostfixTransportMap
$Kolab::haschanged{'postfix'} = 1;
}
- Kolab::log('T', 'Finished building Postfix transport map', KOLAB_DEBUG);
+ Kolab::log('T', 'Finished building Postfix $map map', KOLAB_DEBUG);
}
sub buildCyrusConfig
@@ -638,6 +649,7 @@ sub rebuildTemplates
}
buildPostfixTransportMap;
+ buildPostfixVirtualMap;
buildLDAPReplicas;
buildCyrusConfig;
buildCyrusGroups;
diff --git a/perl-kolab.spec b/perl-kolab.spec
index d9a29b6..619ae9b 100644
--- a/perl-kolab.spec
+++ b/perl-kolab.spec
@@ -48,7 +48,7 @@ Class: PLUS
Group: Language
License: GPL/Artistic
Version: %{V_perl}
-Release: 20050527
+Release: 20050529
# list of sources
Source0: http://www.cpan.org/authors/id/S/ST/STEPHANB/Kolab-%{V_kolab}.tar.gz