#!/usr/local/bin/perl # save_record.cgi # Adds or updates a record of some type require './bind8-lib.pl'; &ReadParse(); &error_setup($text{'edit_err'}); $zone = &get_zone_name($in{'index'}, $in{'view'}); $dom = $zone->{'name'}; @zl = &list_zone_names(); $reverse = ($in{'origin'} =~ /\.in-addr\.arpa/i || $in{'origin'} =~ /\.$ipv6revzone/i); &can_edit_zone($zone) || &error($text{'recs_ecannot'}); &can_edit_type($in{'type'}) || &error($text{'recs_ecannottype'}); $access{'ro'} && &error($text{'master_ero'}); &lock_file(&make_chroot(&absolute_path($zone->{'file'}))); # Read the existing records if ($config{'largezones'} && !defined($in{'num'})) { # Adding to a large zone, so only read the SOA @recs = &read_zone_file($in{'file'}, $in{'origin'}, undef, 1); } else { # Read all records @recs = &read_zone_file($in{'file'}, $in{'origin'}); } # get the old record if needed $r = $recs[$in{'num'}] if (defined($in{'num'})); # check for deletion if ($in{'delete'}) { # Check if confirmation is needed if (!$in{'confirm'} && $config{'confirm_rec'}) { &ui_print_header(undef, $text{'edit_dtitle'}, ""); print "