steffen: server/perl-kolab/Kolab-Conf Conf.pm,1.52,1.53

cvs at intevation.de cvs at intevation.de
Mon May 30 00:43:11 CEST 2005


Author: steffen

Update of /kolabrepository/server/perl-kolab/Kolab-Conf
In directory doto:/tmp/cvs-serv10126/Kolab-Conf

Modified Files:
	Conf.pm 
Log Message:
added postfix virtual map template (Issue768)

Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-Conf/Conf.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- Conf.pm	27 May 2005 12:27:01 -0000	1.52
+++ Conf.pm	29 May 2005 22:43:08 -0000	1.53
@@ -217,21 +217,32 @@
 
 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 @@
         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 @@
 
     # 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 @@
         $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 @@
     }
 
     buildPostfixTransportMap;
+    buildPostfixVirtualMap;
     buildLDAPReplicas;
     buildCyrusConfig;
     buildCyrusGroups;





More information about the commits mailing list