ispman/lib/ISPMan DomainMan.pm,1.68,1.69

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17905

Modified Files:
	DomainMan.pm 
Log Message:
final changes to fix bug [ 972117 ] wrong postfix maps/configuration


Index: DomainMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/DomainMan.pm,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- DomainMan.pm	5 Jun 2004 12:45:24 -0000	1.68
+++ DomainMan.pm	14 Jun 2004 08:08:30 -0000	1.69
@@ -260,7 +260,7 @@
         $self->addVhost($q);
     }
 
-    # create directories for this domain
+    # add processes if this is a replica domain
     if ( $r->param("ispmanDomainType") eq "replica" ) {
 
         # Add entry for canonical map
@@ -275,7 +275,6 @@
                 "ModifyVirtualHost",              $vhost
             );
         }
-
     }
     else {
 
@@ -286,18 +285,19 @@
             "createDomainDirectories" );
     }
 
-    # All domains are relay domains.
-    # we can relay  mails for these domains
-    $self->addDomainSMTPProcess( $r->param("ispmanDomain"),
-        "AddRelayDomainEntry" );
-
-    if ( $r->param("ispmanDomainServices") =~ /mail/ ) {
+    # add domain to mail relay map for delivery method "smtp"
+    if ( $r->param("ispmanDomainMailDeliveryMethod") eq "smtp" ) {
+        $self->addDomainSMTPProcess( $r->param("ispmanDomain"),
+            "AddRelayDomainEntry" );
+    }
+    else {
 
-        # we can accept  mails for these domains
+        # otherwise add domain to destination map
         $self->addDomainSMTPProcess( $r->param("ispmanDomain"),
             "AddDestinationDomainEntry" );
     }
 
+    # domain service "db"
     if ( $r->param("ispmanDomainServices") =~ /db/ ) {
 
         # setup a database for this domain
@@ -305,11 +305,11 @@
             "dbgroup", "AddDomainDatabase" );
     }
 
+    # reload nameserver
     unless ( $r->param("ispmanDomainType") eq "nodns" ) {
-
-        # reload named
         $self->addDomainDNSProcess( $r->param("ispmanDomain"), "modifyDomain" );
     }
+
     print $self->refreshSignal( $r->param("ispmanDomain") );
     print "Domain ", $r->param("ispmanDomain"), " was added\n";
 
@@ -473,9 +473,6 @@
         $self->addDomainFileServerProcess( $domain, "deleteDomainDirectories",
             join ',',
             map { $domain_info->{$_} } qw(homeDirectory uidNumber gidNumber) );
-
-# old code to send the process to the group
-# $self->addProcessToGroup($domain, "fileservergroup", "deleteDomainDirectories", join ',', map {$domain_info->{$_}} qw(homeDirectory uidNumber gidNumber));
     }
 
     # Remove this domain from RelayDomains
@@ -484,9 +481,8 @@
     # Remove from destination
     $self->addDomainSMTPProcess( $domain, "RemoveDestinationDomainEntry" );
 
+    # Reload nameserver
     unless ( $domain_info->{"ispmanDomainType"} eq "nodns" ) {
-
-        # reload named
         $self->addDomainDNSProcess( $domain, "modifyDomain" );
     }
 
@@ -624,8 +620,30 @@
           $r->param("ispmanDomainMailDeliveryMethod");
     }
 
+    # add changes to LDAP and generate processes
     if ( $self->{'ldap'}->updateEntryWithData( $dn, $data ) ) {
         $self->addDomainSMTPProcess( $domain, "modifyTransport" );
+
+        # adjust mail maps when delivery method has changed
+        if ( $data->{'ispmanDomainMailDeliveryMethod'} ) {
+            if ( $domain_info->{'ispmanDomainMailDeliveryMethod'} eq "local" ) {
+                $self->addDomainSMTPProcess(
+                    $domain,
+                    "RemoveDestinationDomainEntry",
+                    $r->param("ispmanReplicaMaster")
+                );
+                $self->addDomainSMTPProcess( $domain, "AddRelayDomainEntry",
+                    $r->param("ispmanReplicaMaster") );
+            }
+            else {
+                $self->addDomainSMTPProcess( $domain, "RemoveRelayDomainEntry",
+                    $r->param("ispmanReplicaMaster") );
+                $self->addDomainSMTPProcess( $domain,
+                    "AddDestinationDomainEntry",
+                    $r->param("ispmanReplicaMaster") );
+            }
+        }
+
         if ( $ispmanDomainType eq "replica" ) {
 
             # ispmanReplicaMaster changed?



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.