Subject: | CNAME lookups are just A lookups in disguise (patch included) |
my %_lookups = (
'a' => \&_lookup_a,
'cname' => \&_lookup_a,
...
Ugh.
--- /usr/lib/perl5/site_perl/5.8.5/Net/Nslookup.pm 2008-04-15
16:20:54.000000000 +0100
+++ Net/Nslookup.pm 2009-10-21 00:26:42.000000000 +0100
@@ -43,7 +43,7 @@
my %_lookups = (
'a' => \&_lookup_a,
- 'cname' => \&_lookup_a,
+ 'cname' => \&_lookup_cname,
'mx' => \&_lookup_mx,
'ns' => \&_lookup_ns,
'ptr' => \&_lookup_ptr,
@@ -147,6 +147,21 @@
return @answers;
}
+sub _lookup_cname {
+ my ($term, $server) = @_;
+ my $res = ns($server);
+ my (@answers, $query, $rr);
+
+ debug("Performing 'CNAME' lookup on `$term'");
+
+ $query = $res->search($term, "CNAME") || return;
+ for $rr ($query->answer) {
+ push @answers, $rr->cname;
+ }
+
+ return @answers;
+}
+
sub _lookup_ptr {
my ($term, $server) = @_;
my $res = ns($server);