(RADIATOR) Bug in radiator 3.1 (in radius::RDict) ?
Frederic Olivie
alf at club-internet.fr
Fri Aug 23 08:41:46 CDT 2002
Hi,
First of all, please don't flame me if I'm totally wrong :-)
I think there's a small bug in Radius::Rdict inside the parse()
function.
The new() constructor calls the parse function as follows :
$self = undef
if ! $self->parse($file) ;
Which means that parse() should return with 0 in case
of a problem. it does indeed return with 1 when everything goes
well, but the bad cases are not handled :
- Dictionary file not found
- Dictionary file corrupted
Both do use &main::log to log an error (which is properly logged),
but the daemon carries on without exiting (with an empty dictionary).
Of course, it should not work that well, and the logged message is
obviously explaining why, but, as the case is supposedly handled, I
don't see why it should not be handled completely.
I propose the following patch (knowing that no PERL guru, don't hesitate
to clean up) :
<CUT HERE>
*** RDict.pm Sat Jul 27 03:39:08 2002
--- RDict.pm.patched Fri Aug 23 15:32:50 2002
***************
*** 66,74 ****
my ($self, $file) = @_;
$self->{Filename} = $file;
! open(FILE, $file)
! || &main::log($main::LOG_ERR,
! "Could not open dictionary file '$file': $!");
while (<FILE>)
{
--- 66,76 ----
my ($self, $file) = @_;
$self->{Filename} = $file;
! if (! open(FILE, $file)) {
! &main::log($main::LOG_ERR,
! "Could not open dictionary file '$file': $!") ;
! return(0) ;
! }
while (<FILE>)
{
<CUT HERE>
And, for cleaner reporting, a simple message change in radiusd :
<CUT HERE>
*** radiusd Wed Aug 7 16:23:57 2002
--- radiusd.patched Fri Aug 23 13:06:34 2002
***************
*** 315,321 ****
my $filename =
&Radius::Util::format_special($config->{DictionaryFile});
$dictionary = new Radius::RDict $filename
! or die "Couldn't create dictionary from '$filename': $!";
my $proto = getprotobyname('udp');
--- 315,321 ----
my $filename =
&Radius::Util::format_special($config->{DictionaryFile});
$dictionary = new Radius::RDict $filename
! or die "Couldn't create dictionary from '$filename'. Check logfile
for more info :$!";
my $proto = getprotobyname('udp');
<CUT HERE>
I just hope I'm not wrong and wasting your time. Cheers,
--
Frédéric Olivié (Alf)
Mailto: alf at club-internet.fr
Phoneto: +33 603 03 33 50
Very funny Scotty... Now beam down my clothes (Capt. James T. Kirk.
Starship Enterprise).
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
More information about the radiator
mailing list