- Timestamp:
- 07/20/11 18:01:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r107 r108 1605 1605 $recsth->execute($domid); 1606 1606 while (my ($host,$type,$val,$dist,$weight,$port,$ttl,$lval) = $recsth->fetchrow_array) { 1607 ##fixme: need to store location in the db, and retrieve it here. 1608 # temporarily hardcoded to empty so we can include it further down. 1609 my $loc = ''; 1610 1611 ##fixme: record validity timestamp. tinydns supports fiddling with timestamps. 1612 # note $ttl must be set to 0 if we want to use tinydns's auto-expiring timestamps. 1613 # timestamps are TAI64 1614 # ~~ 2^62 + time() 1615 my $stamp = ''; 1616 1607 1617 $val = $lval if $lval; 1608 1618 … … 1616 1626 # val is abused to contain refresh:retry:expire:minttl 1617 1627 ##fixme: "manual" serial vs tinydns-autoserial 1618 print $datafile "Z$host"."::$val:$ttl \n";1628 print $datafile "Z$host"."::$val:$ttl:$stamp:$loc\n"; 1619 1629 1620 1630 } elsif ($typemap{$type} eq 'A') { 1621 1631 1622 print $datafile "+$host:$val:$ttl \n";1632 print $datafile "+$host:$val:$ttl:$stamp:$loc\n"; 1623 1633 1624 1634 } elsif ($typemap{$type} eq 'NS') { 1625 1635 1626 print $datafile "\&$host"."::$val:$ttl \n";1636 print $datafile "\&$host"."::$val:$ttl:$stamp:$loc\n"; 1627 1637 1628 1638 } elsif ($typemap{$type} eq 'AAAA') { … … 1631 1641 my $altgrp = 0; 1632 1642 my @altconv; 1633 # Split in to up to 8 groups of hex digits (allows for :: 0-collapsing)1643 # Split in to up to 8 groups of hex digits (allows for IPv6 :: 0-collapsing) 1634 1644 foreach (split /:/, $val) { 1635 1645 if (/^$/) { … … 1647 1657 print $datafile '\000\000'x(9-$altgrp) if $octet =~ /^s$/; 1648 1658 } 1649 print $datafile ":$ttl \n";1659 print $datafile ":$ttl:$stamp:$loc\n"; 1650 1660 1651 1661 } elsif ($typemap{$type} eq 'MX') { 1652 1662 1653 print $datafile "\@$host"."::$val:$dist:$ttl \n";1663 print $datafile "\@$host"."::$val:$dist:$ttl:$stamp:$loc\n"; 1654 1664 1655 1665 } elsif ($typemap{$type} eq 'TXT') { … … 1657 1667 ##fixme: split v-e-r-y long TXT strings? will need to do so for BIND export, at least 1658 1668 $val =~ s/:/\\072/g; # may need to replace other symbols 1659 print $datafile "'$host:$val:$ttl \n";1669 print $datafile "'$host:$val:$ttl:$stamp:$loc\n"; 1660 1670 1661 1671 # by-hand TXT … … 1678 1688 } elsif ($typemap{$type} eq 'CNAME') { 1679 1689 1680 print $datafile "C$host:$val:$ttl \n";1690 print $datafile "C$host:$val:$ttl:$stamp:$loc\n"; 1681 1691 1682 1692 } elsif ($typemap{$type} eq 'SRV') { … … 1691 1701 printf $datafile "\\%0.3o%s", length($_), $_; 1692 1702 } 1693 print $datafile "\\000:$ttl \n";1703 print $datafile "\\000:$ttl:$stamp:$loc\n"; 1694 1704 1695 1705 } elsif ($typemap{$type} eq 'RP') { … … 1707 1717 printf $datafile "\\%0.3o%s", length($_), $_; 1708 1718 } 1709 print $datafile "\\000:$ttl \n";1719 print $datafile "\\000:$ttl:$stamp:$loc\n"; 1710 1720 1711 1721 } elsif ($typemap{$type} eq 'PTR') { … … 1713 1723 # must handle both IPv4 and IPv6 1714 1724 ##work 1725 # data should already be in suitable reverse order. 1726 print $datafile "^$host:$val:$ttl:$stamp:$loc\n"; 1727 1728 } else { 1729 # raw record. we don't know what's in here, so we ASS-U-ME the user has 1730 # put it in correctly, since either the user is messing directly with the 1731 # database, or the record was imported via AXFR 1732 # <split by char> 1733 # convert anything not a-zA-Z0-9.- to octal coding 1734 1735 ##fixme: add flag to export "unknown" record types - note we'll probably end up 1736 # mangling them since they were written to the DB from Net::DNS::RR::<type>->rdatastr. 1737 #print $datafile ":$host:$type:$val:$ttl:$stamp:$loc\n"; 1715 1738 1716 1739 } # record type if-else
Note:
See TracChangeset
for help on using the changeset viewer.