Changeset 775
- Timestamp:
- 07/31/19 15:44:20 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r774 r775 5656 5656 my $logparent; 5657 5657 5658 # Snarf the zone serial. Doing it here lets us log the serial we ultimately 5659 # import with, and cleanly override or not as per the options 5660 my $res = Net::DNS::Resolver->new; 5661 $res->nameservers($ifrom); 5662 my ($origsoa) = rr($res, $zone, 'SOA'); 5663 my $ser = $origsoa->{serial}; 5664 if ($args{rwsoa}) { 5665 if (!$args{keepserial}) { 5666 $ser = scalar(time); 5667 } 5668 } 5669 5658 5670 if ($rev eq 'n') { 5659 ##fixme: serial 5660 $dbh->do("INSERT INTO domains (domain,group_id,status) VALUES (?,?,?)", undef, 5661 ($zone, $group, $args{status}) ) or die $dbh->errstr; 5671 $dbh->do("INSERT INTO domains (domain,group_id,status,zserial) VALUES (?,?,?,?)", undef, 5672 ($zone, $group, $args{status}, $ser) ) or die $dbh->errstr; 5662 5673 # get domain id so we can do the records 5663 5674 ($zone_id) = $dbh->selectrow_array("SELECT currval('domains_domain_id_seq')"); 5664 5675 $domain_id = $zone_id; 5665 5676 $logparent = $self->_log(group_id => $group, domain_id => $domain_id, 5666 entry => "[Added ".($args{status} ? 'active' : 'inactive')." domain $zone via AXFR]");5677 entry => "[Added ".($args{status} ? 'active' : 'inactive')." domain $zone with serial $ser via AXFR]"); 5667 5678 } else { 5668 ##fixme: serial 5669 $dbh->do("INSERT INTO revzones (revnet,group_id,status) VALUES (?,?,?)", undef, 5670 ($cidr,$group,$args{status}) ); 5679 $dbh->do("INSERT INTO revzones (revnet,group_id,status,zserial) VALUES (?,?,?,?)", undef, 5680 ($cidr,$group,$args{status}, $ser) ); 5671 5681 # get revzone id so we can do the records 5672 5682 ($zone_id) = $dbh->selectrow_array("SELECT currval('revzones_rdns_id_seq')"); 5673 5683 $rdns_id = $zone_id; 5674 5684 $logparent = $self->_log(group_id => $group, rdns_id => $rdns_id, 5675 entry => "[Added ".($args{status} ? 'active' : 'inactive')." reverse zone $cidr via AXFR]");5685 entry => "[Added ".($args{status} ? 'active' : 'inactive')." reverse zone $cidr with serial $ser via AXFR]"); 5676 5686 } 5677 5687 … … 5681 5691 ## caused a commit instead of barfing 5682 5692 5683 my $res = Net::DNS::Resolver->new;5684 $res->nameservers($ifrom);5685 5693 $res->axfr_start($zone) 5686 5694 or die "Couldn't begin AXFR\n";
Note:
See TracChangeset
for help on using the changeset viewer.