ispman/lib dns.bind8.lib,1.20,1.21
Joerg Delker <[email protected]>
| Newsgroups | gmane.comp.isp.ispman.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ispman/ispman/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3803/lib Modified Files: dns.bind8.lib Log Message: from Wim Kerkhoff <[email protected]>: Here's a small patch to prevent ISPMan from pointing a replica at a zone file that doesn't exist, causing errors in the BIND logs. (+ perltidy) Index: dns.bind8.lib =================================================================== RCS file: /cvsroot/ispman/ispman/lib/dns.bind8.lib,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- dns.bind8.lib 4 Aug 2004 17:31:54 -0000 1.20 +++ dns.bind8.lib 7 Jun 2005 20:36:22 -0000 1.21 @@ -19,8 +19,8 @@ my $domainInfo = $ispman->getDomainInfo($domain); my $domaintype = $domainInfo->{'ispmanDomainType'}; - $msg=" domain: $domain, type: $domaintype"; - $msg.=", filter: $filter" if ($filter); + $msg = " domain: $domain, type: $domaintype"; + $msg .= ", filter: $filter" if ($filter); logsay($msg); if ( $domaintype eq "slave" ) { @@ -31,6 +31,17 @@ } if ( $domaintype eq "replica" ) { + my $primaryName = $domainInfo->{'ispmanReplicaMaster'}; + my $primaryInfo = $ispman->getDomainInfo($primaryName); + my $primaryType = $primaryInfo->{'ispmanDomainType'}; + logsay(" parent check: $primaryName/$primaryType"); + if ( $primaryType eq "nodns" ) { + logsay( +" skipping over $domain because it's primary($primaryName) is nodns" + ); + next; + } + my $entry = PrimaryEntry( $domain, join( "/", @@ -163,13 +174,13 @@ my $domain = shift; open "ZONE", ">$namedPriDir/$domain" || die "$!"; logsay("Writing zone file for $domain"); - my $soa = $ispman->getSOA($domain); + my $soa = $ispman->getSOA($domain); my $ttldefault = $soa->{'minimum'}; - my $ttl = $soa->{'ttl'}; + my $ttl = $soa->{'ttl'}; if ($soa) { - print ZONE ($ttl)?"\$TTL $ttl\n":"\$TTL $ttldefault\n"; - print ZONE ($ttl)?"@ $ttl IN SOA ":"@ IN SOA "; + print ZONE ($ttl) ? "\$TTL $ttl\n" : "\$TTL $ttldefault\n"; + print ZONE ($ttl) ? "@ $ttl IN SOA " : "@ IN SOA "; print ZONE join " ", ( $ispman->staticHost( $soa->{'primary'} ), @@ -192,8 +203,8 @@ print ZONE join( "\t", ( - $_->{'origion'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "NS", - $ispman->staticHost( $_->{'host'} ) + $_->{'origion'}, ( $_->{'ttl'} ) ? $_->{'ttl'} : "\t", + "IN", "NS", $ispman->staticHost( $_->{'host'} ) ) ), "\n"; @@ -206,8 +217,9 @@ print ZONE join( "\t", ( - $_->{'origion'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "MX", $_->{'pref'}, - $ispman->staticHost( $_->{'host'} ) + $_->{'origion'}, ( $_->{'ttl'} ) ? $_->{'ttl'} : "\t", + "IN", "MX", + $_->{'pref'}, $ispman->staticHost( $_->{'host'} ) ) ), "\n"; @@ -217,17 +229,28 @@ print ZONE "\n; A RECORDS\n"; my $arecords = $ispman->getDNSaRecords($domain); for (@$arecords) { - print ZONE - join( "\t", ( $_->{'host'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "A", $_->{'ip'} ) ), "\n"; + print ZONE join( + "\t", + ( + $_->{'host'}, ( $_->{'ttl'} ) ? $_->{'ttl'} : "\t", + "IN", "A", $_->{'ip'} + ) + ), + "\n"; } # print CNAMES print ZONE "\n; RR RECORDS\n"; my $cnames = $ispman->getDNScNAMERecords($domain); for (@$cnames) { - print ZONE - join( "\t", - ( $_->{'alias'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "CNAME", $_->{'host'} ) ), "\n"; + print ZONE join( + "\t", + ( + $_->{'alias'}, ( $_->{'ttl'} ) ? $_->{'ttl'} : "\t", + "IN", "CNAME", $_->{'host'} + ) + ), + "\n"; } if ( $ispman->getConf('catchAllCNAME') ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20