Skip Menu |

This queue is for tickets about the Net-Bonjour CPAN distribution.

Report information
The Basics
Id: 130281
Status: new
Priority: 0/
Queue: Net-Bonjour

People
Owner: Nobody in particular
Requestors: bugs [...] innuce.ch
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Unknown method 'char_str_list' / Unknown method 'property'
Date: Fri, 9 Aug 2019 16:37:09 +0200
To: bug-Net-Bonjour [...] rt.cpan.org
From: bugs [...] innuce.ch
Devices sometimes delivers other RR than queried. This causes the following NET::DNS fatal error ***  FATAL PROGRAM ERROR!!      Unknown method 'char_str_list' ***  which the program has attempted to call for the object: *** _mqtt._tcp.local.       255     IN      PTR     Roomba-xxxxxxx._mqtt._tcp.local. *** ***  Net::DNS::RR::PTR 1406 has no instance method 'char_str_list' *** ***  THIS IS A BUG IN THE CALLING SOFTWARE, which incorrectly assumes ***  that the object would be of a particular type.  The type of an ***  object should be checked before calling any of its methods. Below a patch which checks typ of RR before parsing it: -- Entry_patched.pm    Fri Aug 09 16:27:50 2019 +++ Entry.pm    Fri Aug 09 16:28:05 2019 @@ -177,23 +177,24 @@      my $srv   = $res->query($self->fqdn(), 'SRV') || return;      my $srvrr = ($srv->answer)[0];   -    $self->priority($srvrr->priority); -    $self->weight($srvrr->weight); -    $self->port($srvrr->port); -    $self->hostname($srvrr->target); +    if (ref($srvrr) eq "Net::DNS::RR::SRV"){ +        $self->priority($srvrr->priority); +        $self->weight($srvrr->weight); +        $self->port($srvrr->port); +        $self->hostname($srvrr->target);   -    if ($srv->additional) { -        foreach my $additional ($srv->additional) { -            $self->{'_' . uc($additional->type)} = $additional->address; -        } -    } else { -        my $aquery = $res->query($srvrr->target, 'A'); -        my $arr = ($aquery->answer)[0]; -        if ( $arr->type eq 'A' ) { -             $self->{'_' . uc($arr->type)} = $arr->address; +        if ($srv->additional) { +            foreach my $additional ($srv->additional) { +                $self->{'_' . uc($additional->type)} = $additional->address; +            } +        } else { +            my $aquery = $res->query($srvrr->target, 'A'); +            my $arr = ($aquery->answer)[0]; +            if ( $arr->type eq 'A' ) { +                $self->{'_' . uc($arr->type)} = $arr->address; +            }          }      } -      my $txt = $res->query($self->fqdn, 'TXT');        # Text::Parsewords, which is called by Net::DNS::RR::TXT can spew @@ -202,13 +203,15 @@          my $txti = 0;            foreach my $txtrr ( $txt->answer ) { -            $self->txtdata([$txtrr->char_str_list ]); -            $self->index($txti++); -            foreach my $txtln ( $txtrr->char_str_list ) { -                my ($key,$val) = split(/=/,$txtln,2); -                $self->attribute($key, $val); +            if (ref($txtrr) eq "Net::DNS::RR::TXT"){ +                $self->txtdata([$txtrr->char_str_list ]); +                $self->index($txti++); +                foreach my $txtln ( $txtrr->char_str_list ) { +                    my ($key,$val) = split(/=/,$txtln,2); +                    $self->attribute($key, $val); +                } +                $txti++;              } -            $txti++;          }      }