Skip Menu |

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

Report information
The Basics
Id: 62386
Status: resolved
Priority: 0/
Queue: Net-DNS-SEC

People
Owner: Nobody in particular
Requestors: 1fea [...] packet-pushers.com
Cc:
AdminCc:

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



Subject: A patch to make Net::DNS::RR::DS->digtype() work
After grepping and reading the documentation, I expected to be able to write my $ds = Net::DNS::RR->new("... IN DS ..."); print $ds->digtype('mnemonic'); And see "SHA256" (etc) as the result. But it wasn't working. After some trial-and-error I got it to work the way I expected by having Net::DNS::RR::DS inherit from Net::DNS::SEC and by changing lots of "digest" to "digtype" My patch is attached.
Subject: digtype.patch
Index: RR/DS.pm =================================================================== --- RR/DS.pm (revision 861) +++ RR/DS.pm (working copy) @@ -25,7 +25,7 @@ $VERSION = do { my @r=(q$Revision$=~/\d+/g); sprintf "%d."."%03d"x$#r,@r }; my $debug=0; -@ISA = qw(Net::DNS::RR); +@ISA = qw(Net::DNS::RR Net::DNS::SEC); sub new { my ($class, $self, $data, $offset) = @_; Index: SEC.pm =================================================================== --- SEC.pm (revision 861) +++ SEC.pm (working copy) @@ -142,7 +142,7 @@ $memonic=$self->digtype("mnemonic"); -The algorithm method is used to set or read the value of the digest or +The digtype method is used to set or read the value of the digestype or hash algorithm field in Net::DNS::RR::DS and Net::DNS::RR::NSEC3 objects. @@ -300,39 +300,39 @@ if (!defined $argument){ return if $classmethod; - return $self->{"digest"}; + return $self->{"digtype"}; } # Argument has some value... $argument =~ s/\s//g; # Remove strings to be kind if ($argument =~ /^\d+$/ ){ #Numeric argument. - carp "$argument does not map to a valid digest" unless + carp "$argument does not map to a valid digest type" unless exists $digestbyval{$argument}; if ($classmethod){ return $argument ; }else{ - return $self->{"digest"}=$argument ; + return $self->{"digtype"}=$argument ; } }else{ # argument is not numeric if ($classmethod){ - carp "$argument does not map to a valid digest" unless + carp "$argument does not map to a valid digest type" unless exists $digestbyname{uc($argument)}; return $digestbyname{uc($argument)}; }else{ # Not a class method.. if (lc($argument) eq "mnemonic"){ - return $digestbyval{$self->{"digest"}}; + return $digestbyval{$self->{"digtype"}}; }else{ - carp "$argument does not map to a valid digest" unless + carp "$argument does not map to a valid digest type" unless exists $digestbyname{uc($argument)}; - return $self->{"digest"}=$digestbyname{uc($argument)}; + return $self->{"digtype"}=$digestbyname{uc($argument)}; } } } - die "digest method should never end here"; + die "digtype method should never end here"; }
On Fri 22 Oct 2010 18:16:54, wessels wrote: Show quoted text
> After grepping and reading the documentation, I expected to be able to
write Show quoted text
> > my $ds = Net::DNS::RR->new("... IN DS ..."); > print $ds->digtype('mnemonic'); > > And see "SHA256" (etc) as the result. But it wasn't working. After > some trial-and-error I got it to work the way I expected by having > Net::DNS::RR::DS inherit from Net::DNS::SEC and by changing lots of > "digest" to "digtype"
Absolutely. It looked like unfinished work. Thanks for the patch. --Willem