Changeset 548 for branches/stable/tiny-import.pl
- Timestamp:
- 12/11/13 16:01:18 (10 years ago)
- Location:
- branches/stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable
- Property svn:mergeinfo changed
/trunk merged: 493-534,536-543
- Property svn:mergeinfo changed
-
branches/stable/tiny-import.pl
r547 r548 3 3 ## 4 4 # $Id$ 5 # Copyright 2012 Kris Deugau <kdeugau@deepnet.cx>5 # Copyright 2012,2013 Kris Deugau <kdeugau@deepnet.cx> 6 6 # 7 7 # This program is free software: you can redistribute it and/or modify … … 25 25 use strict; 26 26 use warnings; 27 28 use lib '.'; 27 use POSIX; 28 use Time::TAI64 qw(:tai); 29 30 use lib '.'; ##uselib## 29 31 use DNSDB; 30 32 … … 37 39 conv => 0, 38 40 trial => 0, 41 legacy => 0, 39 42 ); 40 43 # Handle some command-line arguments 41 44 while ($ARGV[0] =~ /^-/) { 42 45 my $arg = shift @ARGV; 43 usage() if $arg !~ /^-[rc t]+$/;46 usage() if $arg !~ /^-[rclt]+$/; 44 47 # -r rewrite imported files to comment imported records 45 48 # -c coerce/downconvert A+PTR = records to PTR 49 # -l swallow A+PTR as-is 46 50 # -t trial mode; don't commit to DB or actually rewrite flatfile (disables -r) 47 51 $arg =~ s/^-//; … … 50 54 $importcfg{rw} = 1 if $_ eq 'r'; 51 55 $importcfg{conv} = 1 if $_ eq 'c'; 56 $importcfg{legacy} = 1 if $_ eq 'l'; 52 57 $importcfg{trial} = 1 if $_ eq 't'; 53 58 } … … 65 70 Multiple passes may be necessary if SOA and = records are heavily 66 71 intermixed and not clustered together. 72 -l (for "legacy") Force import of A+PTR records as-is. Mutually exclusive 73 with -c. -l takes precedence as -c is lossy. 67 74 -t Trial run mode; spits out records that would be left unimported. 68 75 Disables -r if set. … … 120 127 } 121 128 122 our $recsth = $dbh->prepare("INSERT INTO records (domain_id,rdns_id,host,type,val,distance,weight,port,ttl,location ) ".123 " VALUES (?,?,?,?,?,?,?,?,?,? )");129 our $recsth = $dbh->prepare("INSERT INTO records (domain_id,rdns_id,host,type,val,distance,weight,port,ttl,location,stamp,expires,stampactive) ". 130 " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); 124 131 125 132 my %deleg; … … 243 250 } 244 251 252 sub calcstamp { 253 my $stampin = shift; 254 my $ttl = shift; 255 my $pzone = shift; 256 my $revrec = shift; 257 258 return ($ttl, 'n', 'n', '1970-01-01 00:00:00 -0') if !$stampin; 259 260 ##fixme Yes, this fails for records in 2038 sometime. No, I'm not going to care for a while. 261 $stampin = "\@$stampin"; # Time::TAI64 needs the leading @. Feh. 262 my $u = tai2unix($stampin); 263 $stampin = strftime("%Y-%m-%d %H:%M:%S %z", localtime($u)); 264 my $expires = 'n'; 265 if ($ttl) { 266 # TTL can stay put. 267 } else { 268 # TTL on import is 0, almost certainly wrong. Get the parent zone's SOA and use the minttl. 269 my $soa = $dnsdb->getSOA('n', $revrec, $pzone); 270 $ttl = $soa->{minttl}; 271 $expires = 'y'; 272 } 273 return ($ttl, 'y', $expires, $stampin); 274 } 245 275 246 276 sub recslurp { … … 263 293 $host =~ s/^=//; 264 294 $host =~ s/\.$//; 265 $ttl = 0 if !$ttl;295 $ttl = -1 if $ttl eq ''; 266 296 $stamp = '' if !$stamp; 267 297 $loc = '' if !$loc; … … 269 299 my $fparent = $dnsdb->_hostparent($host); 270 300 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($ip)); 301 302 my $stampactive = 'n'; 303 my $expires = 'n'; 304 305 # can't set a timestamp on an orphaned record. we'll actually fail import of this record a little later. 306 if ($fparent || $rparent) { 307 if ($fparent) { 308 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $fparent, 'n'); 309 } else { 310 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 311 } 312 } 313 271 314 if ($fparent && $rparent) { 272 $recsth->execute($fparent, $rparent, $host, 65280, $ip, 0, 0, 0, $ttl, $loc); 273 } else { 274 if ($importcfg{conv}) { 315 $recsth->execute($fparent, $rparent, $host, 65280, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 316 } else { 317 if ($importcfg{legacy}) { 318 # Just import it already! Record may still be subject to downconversion on editing. 319 $fparent = 0 if !$fparent; 320 $rparent = 0 if !$rparent; 321 if ($fparent || $rparent) { 322 $recsth->execute($fparent, $rparent, $host, 65280, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 323 } else { 324 # No parents found, cowardly refusing to add a dangling record 325 push @deferred, $rec unless $nodefer; 326 $impok = 0; 327 } 328 } elsif ($importcfg{conv}) { 275 329 # downconvert A+PTR if forward zone is not found 276 $recsth->execute(0, $rparent, $host, 12, $ip, 0, 0, 0, $ttl, $loc );330 $recsth->execute(0, $rparent, $host, 12, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 277 331 $converted++; 278 332 } else { … … 290 344 $host =~ s/\.$//; 291 345 $host =~ s/^\\052/*/; 292 $ttl = 0 if !$ttl; 293 $stamp = '' if !$stamp; 294 $loc = '' if !$loc; 295 $loc = '' if $loc =~ /^:+$/; 346 $ttl = -1 if $ttl eq ''; 347 $stamp = '' if !$stamp; 348 $loc = '' if !$loc; 349 $loc = '' if $loc =~ /^:+$/; 350 351 my $stampactive = 'n'; 352 my $expires = 'n'; 353 296 354 if ($host =~ /\.arpa$/) { 297 355 ($code,$msg) = DNSDB::_zone2cidr($host); 298 356 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($msg)); 299 $recsth->execute(0, $rparent, $targ, 5, $msg->addr, 0, 0, 0, $ttl, $loc); 357 if ($rparent) { 358 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 359 $recsth->execute(0, $rparent, $targ, 5, $msg->addr, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 360 } else { 361 push @deferred, $rec unless $nodefer; 362 $impok = 0; 363 # print "$tmporig deferred; can't find parent zone\n"; 364 } 300 365 301 366 ##fixme: automagically convert manually maintained sub-/24 delegations … … 308 373 my $fparent = $dnsdb->_hostparent($host); 309 374 if ($fparent) { 310 $recsth->execute($fparent, 0, $host, 5, $targ, 0, 0, 0, $ttl, $loc); 375 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $fparent, 'n'); 376 $recsth->execute($fparent, 0, $host, 5, $targ, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 311 377 } else { 312 378 push @deferred, $rec unless $nodefer; … … 324 390 $ns =~ s/\.$//; 325 391 $ns = "$ns.ns.$zone" if $ns !~ /\./; 326 $ttl = 0 if !$ttl; 327 $stamp = '' if !$stamp; 328 $loc = '' if !$loc; 329 $loc = '' if $loc =~ /^:+$/; 392 $ttl = -1 if $ttl eq ''; 393 $stamp = '' if !$stamp; 394 $loc = '' if !$loc; 395 $loc = '' if $loc =~ /^:+$/; 396 397 my $stampactive = 'n'; 398 my $expires = 'n'; 399 330 400 if ($zone =~ /\.arpa$/) { 331 401 ($code,$msg) = DNSDB::_zone2cidr($zone); … … 336 406 # if !$rparent; 337 407 if ($rparent) { 338 $recsth->execute(0, $rparent, $ns, 2, $msg, 0, 0, 0, $ttl, $loc); 408 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 409 $recsth->execute(0, $rparent, $ns, 2, $msg, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 339 410 } else { 340 411 push @deferred, $rec unless $nodefer; … … 344 415 my $fparent = $dnsdb->_hostparent($zone); 345 416 if ($fparent) { 346 $recsth->execute($fparent, 0, $zone, 2, $ns, 0, 0, 0, $ttl, $loc); 347 $recsth->execute($fparent, 0, $ns, 2, $ip, 0, 0, 0, $ttl, $loc) if $ip; 417 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $fparent, 'n'); 418 $recsth->execute($fparent, 0, $zone, 2, $ns, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 419 $recsth->execute($fparent, 0, $ns, 2, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive) if $ip; 348 420 } else { 349 421 push @deferred, $rec unless $nodefer; … … 358 430 $rip =~ s/^\^//; 359 431 $rip =~ s/\.$//; 360 $ttl = 0 if !$ttl; 361 $stamp = '' if !$stamp; 362 $loc = '' if !$loc; 363 $loc = '' if $loc =~ /^:+$/; 432 $ttl = -1 if $ttl eq ''; 433 $stamp = '' if !$stamp; 434 $loc = '' if !$loc; 435 $loc = '' if $loc =~ /^:+$/; 436 437 my $stampactive = 'n'; 438 my $expires = 'n'; 439 364 440 my $rparent; 365 441 if (my ($i, $z) = ($rip =~ /^(\d+)\.(\d+-(?:\d+\.){4}in-addr.arpa)$/) ) { … … 376 452 } 377 453 if ($rparent) { 378 $recsth->execute(0, $rparent, $host, 12, $msg->addr, 0, 0, 0, $ttl, $loc); 454 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 455 $recsth->execute(0, $rparent, $host, 12, $msg->addr, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 379 456 } else { 380 457 push @deferred, $rec unless $nodefer; … … 389 466 $host =~ s/\.$//; 390 467 $host =~ s/^\\052/*/; 391 $ttl = 0 if !$ttl; 392 $stamp = '' if !$stamp; 393 $loc = '' if !$loc; 394 $loc = '' if $loc =~ /^:+$/; 468 $ttl = -1 if $ttl eq ''; 469 $stamp = '' if !$stamp; 470 $loc = '' if !$loc; 471 $loc = '' if $loc =~ /^:+$/; 472 473 my $stampactive = 'n'; 474 my $expires = 'n'; 395 475 396 476 my $domid = $dnsdb->_hostparent($host); 397 477 if ($domid) { 398 $recsth->execute($domid, 0, $host, 1, $ip, 0, 0, 0, $ttl, $loc); 478 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 479 $recsth->execute($domid, 0, $host, 1, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 399 480 } else { 400 481 push @deferred, $rec unless $nodefer; … … 410 491 $master =~ s/\.$//; 411 492 $contact =~ s/\.$//; 412 $ttl = 0 if !$ttl; 413 $stamp = '' if !$stamp; 414 $loc = '' if !$loc; 415 $loc = '' if $loc =~ /^:+$/; 493 $ttl = -1 if $ttl eq ''; 494 $stamp = '' if !$stamp; 495 $loc = '' if !$loc; 496 $loc = '' if $loc =~ /^:+$/; 497 498 my $stampactive = 'n'; 499 my $expires = 'n'; 500 501 ##fixme er... what do we do with an SOA with a timestamp? O_o 502 # fail for now, since there's no clean way I can see to handle this (yet) 503 # maybe (ab)use the -l flag to import as-is? 504 if ($stamp) { 505 push @deferred, $rec unless $nodefer; 506 return 0; 507 } 508 509 ##fixme: need more magic on TTL, so we can decide whether to use the minttl or newttl 510 # my $newttl; 511 # ($newttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $minttl, 0, 'n'); 512 # $ttl = $newttl if !$ttl; 513 416 514 if ($zone =~ /\.arpa$/) { 417 515 ($code,$msg) = DNSDB::_zone2cidr($zone); … … 419 517 undef, ($msg, $loc)); 420 518 my ($rdns) = $dbh->selectrow_array("SELECT currval('revzones_rdns_id_seq')"); 421 $recsth->execute(0, $rdns, "$contact:$master", 6, "$refresh:$retry:$expire:$minttl", 0, 0, 0, $ttl, $loc); 519 my $newttl; 520 ($newttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $minttl, 0, 'y'); 521 $ttl = $newttl if !$ttl; 522 $recsth->execute(0, $rdns, "$contact:$master", 6, "$refresh:$retry:$expire:$minttl", 0, 0, 0, $ttl, 523 $loc, $stamp, $expires, $stampactive); 422 524 } else { 423 525 $dbh->do("INSERT INTO domains (domain,group_id,status,default_location) VALUES (?,1,1,?)", 424 526 undef, ($zone, $loc)); 425 527 my ($domid) = $dbh->selectrow_array("SELECT currval('domains_domain_id_seq')"); 426 $recsth->execute($domid, 0, "$contact:$master", 6, "$refresh:$retry:$expire:$minttl", 0, 0, 0, $ttl, $loc); 528 my $newttl; 529 ($newttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $minttl, 0, 'n'); 530 $ttl = $newttl if !$ttl; 531 $recsth->execute($domid, 0, "$contact:$master", 6, "$refresh:$retry:$expire:$minttl", 0, 0, 0, $ttl, 532 $loc, $stamp, $expires, $stampactive); 427 533 } 428 534 … … 436 542 $host =~ s/\.$//; 437 543 $host = "$host.mx.$zone" if $host !~ /\./; 438 $ttl = 0 if !$ttl; 439 $stamp = '' if !$stamp; 440 $loc = '' if !$loc; 441 $loc = '' if $loc =~ /^:+$/; 544 $ttl = -1 if $ttl eq ''; 545 $stamp = '' if !$stamp; 546 $loc = '' if !$loc; 547 $loc = '' if $loc =~ /^:+$/; 548 549 my $stampactive = 'n'; 550 my $expires = 'n'; 442 551 443 552 # note we don't check for reverse domains here, because MX records don't make any sense in reverse zones. … … 447 556 my $domid = $dnsdb->_hostparent($zone); 448 557 if ($domid) { 449 $recsth->execute($domid, 0, $zone, 15, $host, $dist, 0, 0, $ttl, $loc); 450 $recsth->execute($domid, 0, $host, 1, $ip, 0, 0, 0, $ttl, $loc) if $ip; 558 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 559 $recsth->execute($domid, 0, $zone, 15, $host, $dist, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 560 $recsth->execute($domid, 0, $host, 1, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive) if $ip; 451 561 } else { 452 562 push @deferred, $rec unless $nodefer; … … 461 571 $fqdn =~ s/^\\052/*/; 462 572 _deoctal(\$rdata); 463 $ttl = 0 if !$ttl; 464 $stamp = '' if !$stamp; 465 $loc = '' if !$loc; 466 $loc = '' if $loc =~ /^:+$/; 573 $ttl = -1 if $ttl eq ''; 574 $stamp = '' if !$stamp; 575 $loc = '' if !$loc; 576 $loc = '' if $loc =~ /^:+$/; 577 578 my $stampactive = 'n'; 579 my $expires = 'n'; 467 580 468 581 if ($fqdn =~ /\.arpa$/) { 469 582 ($code,$msg) = DNSDB::_zone2cidr($fqdn); 470 583 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($msg)); 471 $recsth->execute(0, $rparent, $rdata, 16, "$msg", 0, 0, 0, $ttl, $loc); 584 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 585 $recsth->execute(0, $rparent, $rdata, 16, "$msg", 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 472 586 } else { 473 587 my $domid = $dnsdb->_hostparent($fqdn); 474 588 if ($domid) { 475 $recsth->execute($domid, 0, $fqdn, 16, $rdata, 0, 0, 0, $ttl, $loc); 589 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 590 $recsth->execute($domid, 0, $fqdn, 16, $rdata, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 476 591 } else { 477 592 push @deferred, $rec unless $nodefer; … … 488 603 $ns =~ s/\.$//; 489 604 $ns = "$ns.ns.$fqdn" if $ns !~ /\./; 490 $ttl = 0 if !$ttl; 491 $stamp = '' if !$stamp; 492 $loc = '' if !$loc; 493 $loc = '' if $loc =~ /^:+$/; 605 $ttl = -1 if $ttl eq ''; 606 $stamp = '' if !$stamp; 607 $loc = '' if !$loc; 608 $loc = '' if $loc =~ /^:+$/; 609 610 my $stampactive = 'n'; 611 my $expires = 'n'; 612 613 ##fixme er... what do we do with an SOA with a timestamp? O_o 614 # fail for now, since there's no clean way I can see to handle this (yet) 615 # maybe (ab)use the -l flag to import as-is? 616 if ($stamp) { 617 push @deferred, $rec unless $nodefer; 618 return 0; 619 } 620 621 ##fixme: need more magic on TTL, so we can decide whether to use the minttl or newttl 622 # my $newttl; 623 # ($newttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $minttl, 0, 'n'); 494 624 495 625 if ($fqdn =~ /\.arpa$/) { … … 501 631 undef, ($msg, $loc)); 502 632 ($rdns) = $dbh->selectrow_array("SELECT currval('revzones_rdns_id_seq')"); 633 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, 2560, 0, 'y'); 503 634 # this would probably make a lot more sense to do hostmaster.$config{admindomain} 504 $recsth->execute(0, $rdns, "hostmaster.$fqdn:$ns", 6, "16384:2048:1048576:2560", 0, 0, 0, "2560", $loc); 505 } 506 $recsth->execute(0, $rdns, $ns, 2, "$msg", 0, 0, 0, $ttl, $loc); 635 # otherwise, it's as per the tinydns defaults that work tolerably well on a small scale 636 # serial -> modtime of data file, ref -> 16384, ret -> 2048, exp -> 1048576, min -> 2560 637 $recsth->execute(0, $rdns, "hostmaster.$fqdn:$ns", 6, "16384:2048:1048576:2560", 0, 0, 0, "2560", 638 $loc, $stamp, $expires, $stampactive); 639 } 640 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, 2560, $rdns, 'y') if !$stamp; 641 $recsth->execute(0, $rdns, $ns, 2, "$msg", 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 507 642 ##fixme: (?) implement full conversion of tinydns . records? 508 643 # -> problem: A record for NS must be added to the appropriate *forward* zone, not the reverse 509 #$recsth->execute(0, $rdns, $ns, 1, $ip, 0, 0, 0, $ttl )644 #$recsth->execute(0, $rdns, $ns, 1, $ip, 0, 0, 0, $ttl, $stamp, $expires, $stampactive) 510 645 # ... auto-A-record simply does not make sense in reverse zones. Functionally 511 646 # I think it would work, sort of, but it's a nasty mess and anyone hosting reverse … … 521 656 undef, ($fqdn, $loc)); 522 657 ($domid) = $dbh->selectrow_array("SELECT currval('domains_domain_id_seq')"); 523 $recsth->execute($domid, 0, "hostmaster.$fqdn:$ns", 6, "16384:2048:1048576:2560", 0, 0, 0, "2560", $loc); 524 } 525 $recsth->execute($domid, 0, $fqdn, 2, $ns, 0, 0, 0, $ttl, $loc); 526 $recsth->execute($domid, 0, $ns, 1, $ip, 0, 0, 0, $ttl, $loc) if $ip; 658 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, 2560, 0, 'n'); 659 $recsth->execute($domid, 0, "hostmaster.$fqdn:$ns", 6, "16384:2048:1048576:2560", 0, 0, 0, "2560", 660 $loc, $stamp, $expires, $stampactive); 661 } 662 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n') if !$stamp; 663 $recsth->execute($domid, 0, $fqdn, 2, $ns, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 664 $recsth->execute($domid, 0, $ns, 1, $ip, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive) if $ip; 527 665 } 528 666 … … 556 694 $fqdn =~ s/\.$//; 557 695 $fqdn =~ s/^\\052/*/; 558 $ttl = 0 if !$ttl; 559 $stamp = '' if !$stamp; 560 $loc = '' if !$loc; 561 $loc = '' if $loc =~ /^:+$/; 696 $ttl = -1 if $ttl eq ''; 697 $stamp = '' if !$stamp; 698 $loc = '' if !$loc; 699 $loc = '' if $loc =~ /^:+$/; 700 701 my $stampactive = 'n'; 702 my $expires = 'n'; 562 703 563 704 if ($type == 33) { … … 588 729 my $domid = $dnsdb->_hostparent($fqdn); 589 730 if ($domid) { 590 $recsth->execute($domid, 0, $fqdn, 33, $target, $prio, $weight, $port, $ttl, $loc) if $domid; 731 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 732 $recsth->execute($domid, 0, $fqdn, 33, $target, $prio, $weight, $port, $ttl, $loc, $stamp, $expires, $stampactive) if $domid; 591 733 } else { 592 734 push @deferred, $rec unless $nodefer; … … 605 747 606 748 my $fparent = $dnsdb->_hostparent($fqdn); 749 607 750 if ($fparent) { 608 $recsth->execute($fparent, 0, $fqdn, 28, $val->addr, 0, 0, 0, $ttl, $loc); 751 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $fparent, 'n'); 752 $recsth->execute($fparent, 0, $fqdn, 28, $val->addr, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 609 753 } else { 610 754 push @deferred, $rec unless $nodefer; … … 620 764 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($msg)); 621 765 if ($rparent) { 622 $recsth->execute(0, $rparent, $txtstring, 16, "$msg", 0, 0, 0, $ttl, $loc); 766 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 767 $recsth->execute(0, $rparent, $txtstring, 16, "$msg", 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 623 768 } else { 624 769 push @deferred, $rec unless $nodefer; … … 628 773 my $domid = $dnsdb->_hostparent($fqdn); 629 774 if ($domid) { 630 $recsth->execute($domid, 0, $fqdn, 16, $txtstring, 0, 0, 0, $ttl, $loc); 775 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 776 $recsth->execute($domid, 0, $fqdn, 16, $txtstring, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 631 777 } else { 632 778 push @deferred, $rec unless $nodefer; … … 648 794 my ($rparent) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >> ?", undef, ($msg)); 649 795 if ($rparent) { 650 $recsth->execute(0, $rparent, "$email $txtrec", 17, "$msg", 0, 0, 0, $ttl, $loc); 796 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $rparent, 'y'); 797 $recsth->execute(0, $rparent, "$email $txtrec", 17, "$msg", 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive ); 651 798 } else { 652 799 push @deferred, $rec unless $nodefer; … … 656 803 my $domid = $dnsdb->_hostparent($fqdn); 657 804 if ($domid) { 658 $recsth->execute($domid, 0, $fqdn, 17, "$email $txtrec", 0, 0, 0, $ttl, $loc); 805 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 806 $recsth->execute($domid, 0, $fqdn, 17, "$email $txtrec", 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 659 807 } else { 660 808 push @deferred, $rec unless $nodefer; … … 672 820 my $domid = $dnsdb->_hostparent($fqdn); 673 821 if ($domid) { 674 $recsth->execute($domid, 0, $fqdn, 44, $sshfp, 0, 0, 0, $ttl, $loc); 822 ($ttl, $stampactive, $expires, $stamp) = calcstamp($stamp, $ttl, $domid, 'n'); 823 $recsth->execute($domid, 0, $fqdn, 44, $sshfp, 0, 0, 0, $ttl, $loc, $stamp, $expires, $stampactive); 675 824 } else { 676 825 push @deferred, $rec unless $nodefer;
Note:
See TracChangeset
for help on using the changeset viewer.