CVS: ispman/lib dns.bind8.lib,1.10,1.11

Atif Ghaffar <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv16657

Modified Files:
	dns.bind8.lib 
Log Message:
merge with 1.0 removing Id tag since it gets confusing then merging with different brnaches. This file should be usable in 1.0 also.. i-e production ready

Index: dns.bind8.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/dns.bind8.lib,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** dns.bind8.lib	17 Jun 2003 16:23:31 -0000	1.10
--- dns.bind8.lib	8 Oct 2003 00:49:30 -0000	1.11
***************
*** 1,6 ****
  sub make_named_conf {
          my $zone=shift;
- 	my $filter=shift;
-         
          checkDirectories();
          $domains=$ispman->makeDomainHash($ispman->getDomains($filter));
--- 1,4 ----
***************
*** 37,43 ****
  	for (keys %$ADDR) {
  		$_=~s/\.$//;
! 	   
!            print CONF "\nzone \"$_\" IN  {\n\ttype master;\n\tfile \"" . $namedRevDir . $_ .".\";\n};\n";
!            
  	}
  	undef %$ADDR;
--- 35,40 ----
  	for (keys %$ADDR) {
  		$_=~s/\.$//;
! 	      my $entry=RevEntry($_, "$namedRevDir/$_");
! 	      print CONF $entry;
  	}
  	undef %$ADDR;
***************
*** 57,61 ****
                          
                  unless (-d $_){
! 			print  "Directory $_ did not existed. I am creating it now\n";
  			mkpath ($_);
                          chown $uid, $gid, $_;
--- 54,58 ----
                          
                  unless (-d $_){
!                        log_message("Directory $_ did not existed. I am creating it now\n");
  			mkpath ($_);
                          chown $uid, $gid, $_;
***************
*** 114,118 ****
     for (keys %$rev) {
        my @ip=split('\.', $_);
!       my $origin=join '.', ($ip[2], $ip[1], $ip[0], "in-addr" , "arpa.");
        my $ip=$ip[3];
        $ADDR->{$origin}{$ip}=join ("\t", ($ip, "1D", "IN", "PTR", $rev->{$_}, "\n"));
--- 111,115 ----
     for (keys %$rev) {
        my @ip=split('\.', $_);
!       my $origin=join '.', ($ip[2], $ip[1], $ip[0], "in-addr" , "arpa");
        my $ip=$ip[3];
        $ADDR->{$origin}{$ip}=join ("\t", ($ip, "1D", "IN", "PTR", $rev->{$_}, "\n"));
***************
*** 156,160 ****
     my $domain=shift;
     open "ZONE", ">$namedPriDir/$domain" || die "$!";
!    print "Writting zone file for $domain\n";
     my $soa=$ispman->getSOA($domain);
     
--- 153,157 ----
     my $domain=shift;
     open "ZONE", ">$namedPriDir/$domain" || die "$!";
!    log_message("Writting zone file for $domain\n");
     my $soa=$ispman->getSOA($domain);
     
***************
*** 256,259 ****
--- 253,260 ----
     
     $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#Dont forget to reload your dns server software after\n\n|;
+    }
+    
     my $slaveTemplate = join '/',  ($ispman->getConf("installDir") ,  "templates/zone.slave.entry.template");
     if (-e $slaveTemplate) {
***************
*** 262,265 ****
--- 263,282 ----
     } else {
             return  qq|\nzone "$hash->{'domain'}" IN {\n\ttype slave;\n\tfile "$hash->{'file'}";\n\tmasters {\n$hash->{'masters'}\n\t};\n};\n|;
+    }
+ }
+ 
+ sub RevEntry {
+    my $hash={};
+    ($hash->{'zone'}, $hash->{'file'} )=@_;
+    $hash->{'file'}=~s!//!/!g;
+    #print CONF "\nzone \"$_\" IN  {\n\ttype master;\n\tfile \"" . $namedRevDir . $_ .".\";\n};\n";
+    
+    my $revTemplate = join '/',  ($ispman->getConf("installDir") ,  "templates/zone.rev.entry.template");
+    if (-e $revTemplate) {
+         my $template=$ispman->getTemplate($revTemplate);
+         return  $template->fill_in(HASH => $hash);
+    } else {
+         #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|;
     }
  }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.