Changeset 608 for trunk/dns.cgi


Ignore:
Timestamp:
04/04/14 16:32:11 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

To override the note in r607; NetAddr::IP will resolve hostnames or domain
names by way of gethostbyname() and use the resulting IP to create the
object. In most cases this shouldn't be an issue but some code segments
will now need an additional regex check before feeding things to NetAddr::IP
to ensure strange local DNS data doesn't cause user input to get mangled.

Fix code comment from r607; the bug is arguably in my use of NetAddr::IP
to answer "Is this an IP address?".

Remove NetAddr:IP call from a segment in dns.cgi; a simple regex check on
the zone CIDR retrieved from the database should be enough to answer "Is
this an IPv6 zone?".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r592 r608  
    20692069    $page->param(name   => ($webvar{name} ? $webvar{name} : $domroot));
    20702070    my $zname = ($webvar{defrec} eq 'y' ? 'ZONE' : $dnsdb->revName($webvar{parentid}, 'y'));
    2071     my $cidr = new NetAddr::IP $zname;
    20722071    $zname =~ s|\d*/\d+$||;
    20732072    $page->param(address        => ($webvar{address} ? $webvar{address} : $zname));
    20742073    $page->param(typelist => $dnsdb->getTypelist($webvar{revrec},
    2075         $webvar{type} || ($cidr->{isv6} ? $reverse_typemap{'AAAA+PTR'} : $reverse_typemap{'A+PTR'})));
     2074        $webvar{type} || ($zname =~ /:/ ? $reverse_typemap{'AAAA+PTR'} : $reverse_typemap{'A+PTR'})));
    20762075  }
    20772076# retrieve the right ttl instead of falling (way) back to the hardcoded system default
Note: See TracChangeset for help on using the changeset viewer.