#!/usr/local/bin/perl # edit_recs.cgi # Display records of some type from some domain require './dns-lib.pl'; &ReadParse(); $conf = &get_config(); $zconf = $conf->[$in{'index'}]; $dom = $zconf->{'values'}->[0]; %access = &get_module_acl(); &can_edit_zone(\%access, $dom) || &error("You are not allowed to edit records in this zone"); &header("$code_map{$in{'type'}} Records", ""); print "
In ",&arpa_to_ip($dom),"
\n"; print "

\n"; $file = $zconf->{'values'}->[1]; &foreign_call("bind8", "record_input", $in{'index'}, undef, $in{'type'}, $file, $dom); @recs = &read_zone_file($file, $dom); @recs = grep { $_->{'type'} eq $in{'type'} } @recs; if (@recs) { @recs = &sort_records(@recs); %hmap = ( "A", [ "Address" ], "NS", [ "Name Server" ], "CNAME", [ "Real Name" ], "MX", [ "Priority", "Mail Server" ], "HINFO", [ "Hardware", "Operating System" ], "TXT", [ "Message" ], "WKS", [ "Address", "Protocol", "Service" ], "RP", [ "Email Address", "Text Record" ], "PTR", [ "Hostname" ] ); if ($in{'type'} =~ /HINFO|WKS|RP/) { &recs_table(@recs); } else { $mid = int((@recs+1)/2); print "
\n"; &recs_table(@recs[0 .. $mid-1]); print "\n"; if ($mid < @recs) { &recs_table(@recs[$mid .. $#recs]); } print "

\n"; } print "

\n"; } print &ui_hr(); &footer("edit_master.cgi?index=$in{'index'}", "record types"); sub recs_table { print "\n"; print "\n"; @hmap = @{$hmap{$in{'type'}}}; foreach $h (@hmap) { print "\n"; } print "\n"; for($i=0; $i<@_; $i++) { $r = $_[$i]; $name = &html_escape($in{'type'} eq "PTR" ? &arpa_to_ip($r->{'name'}) : $r->{'name'}); print "\n"; print "\n"; for($j=0; $j<@hmap; $j++) { print "\n"; } print "\n"; } print "
",$in{'type'} eq "PTR" ? "Address" : "Name", " TTL$h
{'num'}\">$name", "",$r->{'ttl'} ? $r->{'ttl'} : "Default","",&html_escape($r->{'values'}->[$j]),"
\n"; }