Skip Menu |

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

Report information
The Basics
Id: 24226
Status: resolved
Priority: 0/
Queue: Net-Radius

People
Owner: luismunoz [...] cpan.org
Requestors: bitcard.org [...] fremnet.net
Cc:
AdminCc:

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



Subject: Improvements for vendor attribute handling
The attached patch will bring set_vsattr into line with set_attr - IE set_vsattr($vendor, $name, $val, $rewrite_flag) Also introduced is unset_csattr($vendor, $name)
Subject: packet.patch
--- Net-Radius-1.51/Radius/Packet.pm 2006-11-15 09:30:23.000000000 +1000 +++ Net-Radius-1.51/Radius/Packet.pm 2007-01-05 13:26:34.000000000 +1000 @@ -12,7 +12,7 @@ $VSA = 26; # Type assigned in RFC2138 to the # Vendor-Specific Attributes -# Be shure our dictionaries are current +# Be sure our dictionaries are current use Net::Radius::Dictionary 1.50; use Carp; use Socket; @@ -49,7 +49,33 @@ sub vendors { keys %{$_[0]->{VSAttributes}}; } sub vsattributes { keys %{$_[0]->{VSAttributes}->{$_[1]}}; } sub vsattr { $_[0]->{VSAttributes}->{$_[1]}->{$_[2]}; } -sub set_vsattr { push @{$_[0]->{VSAttributes}->{$_[1]}->{$_[2]}},$_[3]} +sub set_vsattr { + my ($self, $vendor, $name, $value, $rewrite_flag) = @_; + + $self->{VSAttributes}->{$vendor} = {} unless exists($self->{VSAttributes}->{$vendor}); + my $attr = $self->{VSAttributes}->{$vendor}; + + if ($rewrite_flag) { + my $found = 0; + + if (exists($attr->{$name})) { + $found = $#{$attr->{$name}} + 1; + } + + if ($found == 1) { + $attr->{$name}[0] = $value; + return; + } + } + + push @{$attr->{$name}}, $value; +} + +sub unset_vsattr { + my ($self, $vendor, $name) = @_; + + delete($self->{VSAttributes}->{$name}); +} sub show_unknown_entries { $_[0]->{unknown_entries} = $_[1]; }
Patch added in 1.52 circa Jan 8. Forgot to close this ticket. Thanks a lot. -lem