Subject: | Net::DNS::Resolver::Win32 parses the searchlist incorrectly if there is a domain value |
Because there is no comma seperating the $domain value from the rest of
the search list.
Also not all duplicates are removed from the searchlist because of case-
matching (i.e., Example.com != example.com in regex) but DNS doesn't
care about case. So lowercase the searchlist just to be defensive.
The attached patch fixes these issues and some minor whitespace issues.
Subject: | win32.pm.diff |
--- Win32-orig.pm Tue Sep 28 10:53:14 2010
+++ Win32.pm Tue Sep 28 11:09:20 2010
@@ -16,7 +16,7 @@
use Data::Dumper;
sub init {
- my $debug=0;
+ my $debug=0;
my ($class) = @_;
my $defaults = $class->defaults;
@@ -52,7 +52,7 @@
}
my $domain=$FIXED_INFO->{'DomainName'}||'';
- my $searchlist = "$domain" ;
+ my $searchlist;
#
@@ -70,23 +70,25 @@
or $opened_registry =0;
}
+ if ($domain) {
+ $defaults->{'domain'} = $domain;
+ $searchlist = $domain;
+ }
if ($opened_registry && $resobj->GetValues(\%keys)){
+ $searchlist .= "," if $searchlist; # $domain already in there
$searchlist .= $keys{'SearchList'}->[2];
}
- if ($domain) {
- $defaults->{'domain'} = $domain;
- }
my $usedevolution = $keys{'UseDomainNameDevolution'}->[2];
if ($searchlist) {
# fix devolution if configured, and simultaneously make sure no dups (but keep the order)
my @a;
my %h;
- foreach my $entry (split(m/[\s,]+/, $searchlist)) {
+ foreach my $entry (split(m/[\s,]+/, lc $searchlist)) {
push(@a, $entry) unless $h{$entry};
$h{$entry} = 1;
if ($usedevolution) {