Changeset 468 for trunk/tiny-import.pl
- Timestamp:
- 03/12/13 13:39:49 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tiny-import.pl
r461 r468 27 27 28 28 use lib '.'; 29 use DNSDB qw(:ALL); 30 31 if (!loadConfig()) { 32 warn "Using default configuration; unable to load custom settings: $DNSDB::errstr"; 33 } 29 use DNSDB; 30 31 my $dnsdb = new DNSDB; 34 32 35 33 usage() if !@ARGV; … … 77 75 78 76 my $code; 79 my ($dbh,$msg) = connectDB($config{dbname}, $config{dbuser}, $config{dbpass}, $config{dbhost}); 80 initGlobals($dbh) if $dbh; 77 my $dbh = $dnsdb->{dbh}; 81 78 82 79 $dbh->{AutoCommit} = 0; … … 251 248 my $nodefer = shift || 0; 252 249 my $impok = 1; 250 my $msg; 253 251 254 252 $errstr = $rec; # this way at least we have some idea what went <splat> … … 269 267 $loc = '' if !$loc; 270 268 $loc = '' if $loc =~ /^:+$/; 271 my $fparent = DNSDB::_hostparent($dbh,$host);269 my $fparent = $dnsdb->_hostparent($host); 272 270 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($ip)); 273 271 if ($fparent && $rparent) { … … 308 306 309 307 } else { 310 my $fparent = DNSDB::_hostparent($dbh,$host);308 my $fparent = $dnsdb->_hostparent($host); 311 309 if ($fparent) { 312 310 $recsth->execute($fparent, 0, $host, 5, $targ, 0, 0, 0, $ttl, $loc); … … 344 342 } 345 343 } else { 346 my $fparent = DNSDB::_hostparent($dbh,$zone);344 my $fparent = $dnsdb->_hostparent($zone); 347 345 if ($fparent) { 348 346 $recsth->execute($fparent, 0, $zone, 2, $ns, 0, 0, 0, $ttl, $loc); … … 396 394 $loc = '' if $loc =~ /^:+$/; 397 395 398 my $domid = DNSDB::_hostparent($dbh,$host);396 my $domid = $dnsdb->_hostparent($host); 399 397 if ($domid) { 400 398 $recsth->execute($domid, 0, $host, 1, $ip, 0, 0, 0, $ttl, $loc); … … 447 445 448 446 # allow for subzone MXes, since it's perfectly legitimate to simply stuff it all in a single parent zone 449 my $domid = DNSDB::_hostparent($dbh,$zone);447 my $domid = $dnsdb->_hostparent($zone); 450 448 if ($domid) { 451 449 $recsth->execute($domid, 0, $zone, 15, $host, $dist, 0, 0, $ttl, $loc); … … 473 471 $recsth->execute(0, $rparent, $rdata, 16, "$msg", 0, 0, 0, $ttl, $loc); 474 472 } else { 475 my $domid = DNSDB::_hostparent($dbh,$fqdn);473 my $domid = $dnsdb->_hostparent($fqdn); 476 474 if ($domid) { 477 475 $recsth->execute($domid, 0, $fqdn, 16, $rdata, 0, 0, 0, $ttl, $loc); … … 588 586 # } 589 587 590 my $domid = DNSDB::_hostparent($dbh,$fqdn);588 my $domid = $dnsdb->_hostparent($fqdn); 591 589 if ($domid) { 592 590 $recsth->execute($domid, 0, $fqdn, 33, $target, $prio, $weight, $port, $ttl, $loc) if $domid; … … 606 604 my $val = NetAddr::IP->new(join(':', @v6)); 607 605 608 my $fparent = DNSDB::_hostparent($dbh,$fqdn);606 my $fparent = $dnsdb->_hostparent($fqdn); 609 607 if ($fparent) { 610 608 $recsth->execute($fparent, 0, $fqdn, 28, $val->addr, 0, 0, 0, $ttl, $loc); … … 628 626 } 629 627 } else { 630 my $domid = DNSDB::_hostparent($dbh,$fqdn);628 my $domid = $dnsdb->_hostparent($fqdn); 631 629 if ($domid) { 632 630 $recsth->execute($domid, 0, $fqdn, 16, $txtstring, 0, 0, 0, $ttl, $loc); … … 656 654 } 657 655 } else { 658 my $domid = DNSDB::_hostparent($dbh,$fqdn);656 my $domid = $dnsdb->_hostparent($fqdn); 659 657 if ($domid) { 660 658 $recsth->execute($domid, 0, $fqdn, 17, "$email $txtrec", 0, 0, 0, $ttl, $loc); … … 672 670 673 671 # these do not make sense in a reverse zone, since they're logically attached to an A record 674 my $domid = DNSDB::_hostparent($dbh,$fqdn);672 my $domid = $dnsdb->_hostparent($fqdn); 675 673 if ($domid) { 676 674 $recsth->execute($domid, 0, $fqdn, 44, $sshfp, 0, 0, 0, $ttl, $loc);
Note:
See TracChangeset
for help on using the changeset viewer.