ispman/lib dns.bind8.lib,1.19,1.20

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-serv2769/lib

Modified Files:
	dns.bind8.lib 
Log Message:
added DNS TTL patch
(thanks to Armand)

Index: dns.bind8.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/dns.bind8.lib,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- dns.bind8.lib	1 Aug 2004 21:16:42 -0000	1.19
+++ dns.bind8.lib	4 Aug 2004 17:31:54 -0000	1.20
@@ -164,9 +164,12 @@
     open "ZONE", ">$namedPriDir/$domain" || die "$!";
     logsay("Writing zone file for $domain");
     my $soa = $ispman->getSOA($domain);
+    my $ttldefault = $soa->{'minimum'};
+    my $ttl = $soa->{'ttl'};
 
     if ($soa) {
-        print ZONE "@ 1D 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'} ),
@@ -189,7 +192,7 @@
             print ZONE join(
                 "\t",
                 (
-                    $_->{'origion'}, "1D", "IN", "NS",
+                    $_->{'origion'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "NS",
                     $ispman->staticHost( $_->{'host'} )
                 )
               ),
@@ -203,7 +206,7 @@
             print ZONE join(
                 "\t",
                 (
-                    $_->{'origion'}, "1D", "IN", "MX", $_->{'pref'},
+                    $_->{'origion'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "MX", $_->{'pref'},
                     $ispman->staticHost( $_->{'host'} )
                 )
               ),
@@ -215,7 +218,7 @@
         my $arecords = $ispman->getDNSaRecords($domain);
         for (@$arecords) {
             print ZONE
-              join( "\t", ( $_->{'host'}, "1D", "IN", "A", $_->{'ip'} ) ), "\n";
+              join( "\t", ( $_->{'host'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "A", $_->{'ip'} ) ), "\n";
         }
 
         # print CNAMES
@@ -224,14 +227,14 @@
         for (@$cnames) {
             print ZONE
               join( "\t",
-                ( $_->{'alias'}, "1D", "IN", "CNAME", $_->{'host'} ) ), "\n";
+                ( $_->{'alias'}, ($_->{'ttl'})?$_->{'ttl'}:"\t", "IN", "CNAME", $_->{'host'} ) ), "\n";
         }
 
         if (   $ispman->getConf('catchAllCNAME')
             && $ispman->getConf('catchAllCNAME') ne "none" )
         {
             print ZONE join( "\t",
-                ( "*", "1D", "IN", "CNAME", $ispman->getConf('catchAllCNAME') )
+                ( "*", "\t", "IN", "CNAME", $ispman->getConf('catchAllCNAME') )
               ),
               "\n";
         }



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
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.