ispman/lib dns.bind8.lib,1.25,1.26

Joerg Delker <[email protected]> Sun, 18 Feb 2007 17:57:46 +0000
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv18098/lib

Modified Files:
	dns.bind8.lib 
Log Message:
fixed bug [ 1658359 ] Adding Replica-Domain to Domain w slave DNS -> fails!

Index: dns.bind8.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/dns.bind8.lib,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dns.bind8.lib	6 Jul 2006 21:29:48 -0000	1.25
+++ dns.bind8.lib	18 Feb 2007 17:57:44 -0000	1.26
@@ -37,16 +37,23 @@
             logsay(" parent check: $primaryName/$primaryType");
             if ( $primaryType eq "nodns" ) {
                 logsay(
-" skipping over $domain because it's primary($primaryName) is nodns"
+                    " skipping over $domain because it's primary($primaryName) is nodns"
                 );
                 next;
             }
-
-            my $entry = PrimaryEntry(
-                $domain,
-                join( "/",
-                    ( $namedPriDir, $domainInfo->{'ispmanReplicaMaster'} ) )
-            );
+            my $entry;
+            if ( $primaryType eq "primary" ) {
+                $entry =
+                  PrimaryEntry( $domain,
+                    join( "/", ( $namedPriDir, $primaryName ) ) );
+            }
+            if ( $primaryType eq "slave" ) {
+                $entry = SecondaryEntry(
+                    $domain,
+                    join( "/", ( $namedSecDir, $primaryName ) ),
+                    $primaryInfo->{'ispmanDnsMasters'}
+                );
+            }
             print CONF $entry;
         }
 
@@ -137,7 +144,7 @@
     my $headers = "";
     for $origin ( keys %$ADDR ) {
         $header =
-qq|\@   1D      IN SOA @{[$ispman->staticHost($ispman->getConf('primaryDNS'))]}  @{[$ispman->getConf('dnsMasterEmail')]}. (
+          qq|\@   1D      IN SOA @{[$ispman->staticHost($ispman->getConf('primaryDNS'))]}  @{[$ispman->getConf('dnsMasterEmail')]}. (
         @{[time()]}     ; Serial#
         3H              ; refresh
         15M             ; retry
@@ -194,7 +201,7 @@
 
         # print a warning to not edit this fille.
         print ZONE
-"; HEY YOU WITH THE EDITOR\n; This file is generated automatically.\n; All manual changes will be wiped out without a notice.\n\n";
+          "; HEY YOU WITH THE EDITOR\n; This file is generated automatically.\n; All manual changes will be wiped out without a notice.\n\n";
 
         # print NS RECORDS
         my $nsrecords = $ispman->getDNSnSRecords($domain);
@@ -261,7 +268,7 @@
                 "\t",
                 (
                     $_->{'host'}, ( $_->{'ttl'} ) ? $_->{'ttl'} : "\t",
-                    "IN", "TXT", "\"".$_->{'txt'}."\""
+                    "IN", "TXT", "\"" . $_->{'txt'} . "\""
                 )
               ),
               "\n";
@@ -271,13 +278,20 @@
         if (   $ispman->getConf('catchAllCNAME')
             && $ispman->getConf('catchAllCNAME') ne "none" )
         {
+
             # check if CNAME is pointing to an A record
             my $arec = $ispman->getConf('catchAllCNAME');
-            if (! $ispman->isArecord($arec,$domain)) {
-                logsay("WARNING! CatchAllCNAME \"$arec\" has no matching A-record!");
-                print ZONE "; WARNING!!! Deactivated catchAllCNAME, because A-record doesn't exist!\n; ";            
+            if ( !$ispman->isArecord( $arec, $domain ) ) {
+                logsay(
+                    "WARNING! CatchAllCNAME \"$arec\" has no matching A-record!"
+                );
+                print ZONE
+                  "; WARNING!!! Deactivated catchAllCNAME, because A-record doesn't exist!\n; ";
             }
-            print ZONE join( "\t", ( "*", "\t", "IN", "CNAME", $ispman->getConf('catchAllCNAME') )), "\n";
+            print ZONE join( "\t",
+                ( "*", "\t", "IN", "CNAME", $ispman->getConf('catchAllCNAME') )
+              ),
+              "\n";
         }
 
 # look if there is a local file where more entries for this zone are  defined.
@@ -317,7 +331,7 @@
 
         #only if this version does not have the custom files.
         return
-qq|\nzone "$hash->{'domain'}" IN {\n\ttype master;\n\tfile "$hash->{'file'}";\n};\n|;
+          qq|\nzone "$hash->{'domain'}" IN {\n\ttype master;\n\tfile "$hash->{'file'}";\n};\n|;
     }
 }
 
@@ -330,7 +344,7 @@
     $hash->{'masters'} = join "\n", map { "\t\t$_;" } @masters;
     unless (@masters) {
         return
-qq|\n#zone $hash->{'domain'} not being added\n#no masters were defined for this slave entry\n#Correct this in LDAP and re-run ispman.ldap2named to fixme\n#Don't forget to reload your dns server software after\n\n|;
+          qq|\n#zone $hash->{'domain'} not being added\n#no masters were defined for this slave entry\n#Correct this in LDAP and re-run ispman.ldap2named to fixme\n#Don't forget to reload your dns server software after\n\n|;
     }
 
     my $slaveTemplate = join '/',
@@ -341,7 +355,7 @@
     }
     else {
         return
-qq|\nzone "$hash->{'domain'}" IN {\n\ttype slave;\n\tfile "$hash->{'file'}";\n\tmasters {\n$hash->{'masters'}\n\t};\n};\n|;
+          qq|\nzone "$hash->{'domain'}" IN {\n\ttype slave;\n\tfile "$hash->{'file'}";\n\tmasters {\n$hash->{'masters'}\n\t};\n};\n|;
     }
 }
 
@@ -362,7 +376,7 @@
 
         #only if this version does not have the custom files.
         return
-qq|\nzone "$hash->{'zone'}" IN  {\n\ttype master;\n\tfile "$hash->{'file'}";\n};\n|;
+          qq|\nzone "$hash->{'zone'}" IN  {\n\ttype master;\n\tfile "$hash->{'file'}";\n};\n|;
     }
 }
 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV