Skip Menu |

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

Report information
The Basics
Id: 36957
Status: open
Priority: 0/
Queue: Net-Radius

People
Owner: Nobody in particular
Requestors: robert.goliasz [...] uk.clara.net
stanislaw.sawa [...] sns.bskyb.com
Cc:
AdminCc:

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



Subject: improvements for dictionary handling.
Date: Fri, 20 Jun 2008 16:16:55 +0100
To: <bug-Net-Radius [...] rt.cpan.org>
From: "Stanislaw Sawa" <stanislaw.sawa [...] sns.bskyb.com>
Hia, The attached patch makes possible to load recent freeradius dictionary definitions. Changes are: * support for $INCLUDE directive * support for ATTRIBUTE definition between BEGIN-VENDOR and END-VENDOR * ignore encrypt/has_tag flags on attributes i dared not to go deeper into dictionary handling as it seems slightly insane. patch is for 1.56 Information in this email including any attachments may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and are used under licence. British Sky Broadcasting Limited (Registration No. 2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) are direct or indirect subsidiaries of British Sky Broadcasting Group plc (Registration No. 2247735). All of the companies mentioned in this paragraph are incorporated in England and Wales and share the same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Subject: [Bug #36957] Fix for Stan's fix
Date: Tue, 30 Mar 2010 14:55:07 +0100
To: bug-Net-Radius [...] rt.cpan.org
From: Robert Goliasz <robert.goliasz [...] uk.clara.net>
If after applying Stan's patch you experience stuff like: readline() on closed filehandle at /usr/local/share/perl/5.10.1/Net/Radius/Dictionary.pm line 39. ... then here's a fix attached :-) Please apply on Dictionary.pm AFTER applying Stan's original fix. -- Robert Goliasz Core Development Team Leader Claranet Limited 21 Southampton Row London, WC1B 5HA Tel: +44 (0) 20 7685 8062 Email: robert.goliasz@uk.clara.net Web: www.clara.net Company registration: 3152737 place of registration: England All the information contained within this electronic message from Claranet Ltd is covered by the disclaimer at http://www.uk.clara.net/disclaimer

Message body is not shown because sender requested not to inline it.

Subject: [rt.cpan.org #36957] Fix for Stan's fix
Date: Tue, 30 Mar 2010 14:58:31 +0100
To: bug-Net-Radius [...] rt.cpan.org
From: Robert Goliasz <robert.goliasz [...] uk.clara.net>
If after applying Stan's patch you experience stuff like: readline() on closed filehandle at /usr/local/share/perl/5.10.1/Net/Radius/Dictionary.pm line 39. ... then here's a fix attached :-) Please apply on Dictionary.pm AFTER applying Stan's original fix. Maybe this time I'll manage to get it recorded with the original submission... -- Robert Goliasz Core Development Team Leader Claranet Limited 21 Southampton Row London, WC1B 5HA Tel: +44 (0) 20 7685 8062 Email: robert.goliasz@uk.clara.net Web: www.clara.net Company registration: 3152737 place of registration: England All the information contained within this electronic message from Claranet Ltd is covered by the disclaimer at http://www.uk.clara.net/disclaimer

Message body is not shown because sender requested not to inline it.

Thanks for your patch. I will look into integrating it into the distribution, along with suitable tests. Best regards -lem
Subject: improvements for dictionary handling ... another way
Seems this was something like a year ago ... any news on patching this in? I'm going to admit to writing my own parser revisions before I even noticed this thread on RT. I've attached it because it'd be very easy for someone to drop in place as a work around, not because it'd be a good fix for the actual package. -- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.
Subject: Dict.pm
package Dict; use common::sense; use File::Slurp qw(slurp); use base 'Net::Radius::Dictionary'; use File::Basename; sub myslurp { my $fname = shift; my @lines = slurp($fname); my $line = 0; return map {[$fname, ++$line, $_]} @lines; } sub readfile { my ( $self, $filename ) = @_; my $def_vendor; # used in vendor attribute blocks my @lines = myslurp($filename); my ($_fname, $_line); my $read = sub { my $lfs = shift @lines; my $line; ($_fname, $_line, $line) = @$lfs; return $line; }; while ( defined( my $l = $read->() ) ) { next if $l =~ /^\#/; next unless my @l = split /\s+/, $l; if ( lc($l[0]) eq "vendor" ) { if ( defined $l[1] and defined $l[2] and $l[2] =~ /^[xo0-9]+$/ ) { if ( substr( $l[2], 0, 1 ) eq "0" ) { #allow hex or octal my $num = lc( $l[2] ); $num =~ s/^0b//; $l[2] = oct($num); } $self->{vendors}->{ $l[1] } = $l[2]; } else { warn "Garbled VENDOR line $l in $_fname $_line"; } } elsif ( lc($l[0]) eq "begin-vendor" ) { $def_vendor = $l[1]; } elsif ( lc($l[0]) eq "end-vendor" ) { undef $def_vendor; } elsif ( lc($l[0]) eq "attribute" ) { if( $def_vendor and @l == 4 ) { push @l, $def_vendor; } if ( @l == 4 ) { $self->{attr}->{ $l[1] } = [ @l[ 2, 3 ] ]; $self->{rattr}->{ $l[2] } = [ @l[ 1, 3 ] ]; } elsif ( @l == 5 ) { # VENDORATTR if ( $l[2] =~ m/^0[xb]?[a-fA-F0-9]$/ ) { $l[2] = eval $l[2]; } if ( exists $self->{vendors}->{ $l[4] } ) { $self->{vsattr}->{ $self->{vendors}->{ $l[4] } }->{ $l[1] } = [ @l[ 2, 3 ] ]; $self->{rvsattr}->{ $self->{vendors}->{ $l[4] } }->{ $l[2] } = [ @l[ 1, 3 ] ]; } elsif ( $l[4] =~ m/^\d+$/ ) { $self->{vsattr}->{ $l[4] }->{ $l[1] } = [ @l[ 2, 3 ] ]; $self->{rvsattr}->{ $l[4] }->{ $l[2] } = [ @l[ 1, 3 ] ]; } else { if( $l[4] =~ m/(?:has_tag|encrypt)/ ) { # just ignore these unless we learn what to do with them some day } else { warn "Warning: Unknown vendor $l[4] in $_fname $_line"; } } } } elsif ( lc($l[0]) eq "value" ) { if ( exists $self->{attr}->{ $l[1] } ) { $self->{val}->{ $self->{attr}->{ $l[1] }->[0] }->{ $l[2] } = $l[3]; $self->{rval}->{ $self->{attr}->{ $l[1] }->[0] }->{ $l[3] } = $l[2]; } else { for my $v ( keys %{ $self->{vsattr} } ) { if ( defined $self->{vsattr}->{$v}->{ $l[1] } ) { $self->{vsaval}->{$v}->{ $self->{vsattr}->{$v}->{ $l[1] }->[0] }->{ $l[2] } = $l[3]; $self->{rvsaval}->{$v}->{ $self->{vsattr}->{$v}->{ $l[1] }->[0] }->{ $l[3] } = $l[2]; } } } } elsif ( lc($l[0]) eq "vendorattr" ) { if ( substr( $l[3], 0, 1 ) eq "0" ) { #allow hex or octal my $num = lc( $l[3] ); $num =~ s/^0b//; $l[3] = oct($num); } if ( exists $self->{vendors}->{ $l[1] } ) { $self->{vsattr}->{ $self->{vendors}->{ $l[1] } }->{ $l[2] } = [ @l[ 3, 4 ] ]; $self->{rvsattr}->{ $self->{vendors}->{ $l[1] } }->{ $l[3] } = [ @l[ 2, 4 ] ]; } elsif ( $l[1] =~ m/^\d+$/ ) { $self->{vsattr}->{ $l[1] }->{ $l[2] } = [ @l[ 3, 4 ] ]; $self->{rvsattr}->{ $l[1] }->{ $l[3] } = [ @l[ 2, 4 ] ]; } else { warn "Warning: Unknown vendor $l[1] in $_fname $_line"; } } elsif ( lc($l[0]) eq "vendorvalue" ) { if ( substr( $l[4], 0, 1 ) eq "0" ) { #allow hex or octal my $num = lc( $l[4] ); $num =~ s/^0b//; $l[4] = oct($num); } if ( exists $self->{vendors}->{ $l[1] } ) { $self->{vsaval}->{ $self->{vendors}->{ $l[1] } } ->{ $self->{vsattr}->{ $self->{vendors}->{ $l[1] } }->{ $l[2] }->[0] }->{ $l[3] } = $l[4]; $self->{rvsaval}->{ $self->{vendors}->{ $l[1] } } ->{ $self->{vsattr}->{ $self->{vendors}->{ $l[1] } }->{ $l[2] }->[0] }->{ $l[4] } = $l[3]; } elsif ( $l[1] =~ m/^\d+$/ ) { $self->{vsaval}->{ $l[1] }->{ $self->{vsattr}->{ $l[1] }->{ $l[2] }->[0] }->{ $l[3] } = $l[4]; $self->{rvsaval}->{ $l[1] }->{ $self->{vsattr}->{ $l[1] }->{ $l[2] }->[0] }->{ $l[4] } = $l[3]; } else { warn "Warning: $filename contains vendor value for unknown vendor attribute - ignored [@l] in $_fname $_line"; } } elsif ( lc( $l[0] ) eq 'packet' ) { my ( $name, $value ) = @l[ 1, 2 ]; $self->{packet}{$name} = $value; $self->{rpacket}{$value} = $name; } elsif ( $l[0] eq '$INCLUDE' ) { my $dir = dirname($filename); splice @lines, 0, 0, myslurp("$dir/$l[1]"); } else { warn "Warning: Weird dictionary line: [@l] in $_fname $_line"; } } } 1;